# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=findutils
pkgver=4.9.0
pkgrel=3
pkgdesc="GNU utilities to locate files"
arch=('i686' 'x86_64')
license=('GPL3')
depends=('libiconv' 'libintl')
makedepends=('libiconv-devel' 'gettext-devel' 'autotools' 'gcc')
url="https://www.gnu.org/software/findutils"
source=(https://ftp.gnu.org/pub/gnu/findutils/${pkgname}-${pkgver}.tar.xz{,.sig})
sha256sums=('a2bfb8c09d436770edc59f50fa483e785b161a3b7b9d547573cb08065fd462fe'
            'SKIP')
validpgpkeys=('A5189DB69C1164D33002936646502EF796917195')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  autoreconf -fi
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  # Don't build or install locate because we use mlocate,
  # which is a secure version of locate.
  # sed -i '/^SUBDIRS/s/locate//' Makefile.in

  export CYGWIN_CHOST="${CHOST/-msys/-cygwin}"

  ./configure \
    --build=${CYGWIN_CHOST} \
    --prefix=/usr \
    --without-libiconv-prefix \
    --without-libintl-prefix \
    DEFAULT_ARG_SIZE="(32u*1024)"

  make
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make check
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR=${pkgdir} install
}
