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

pkgname=findutils
pkgver=4.8.0
pkgrel=1
pkgdesc="GNU utilities to locate files"
arch=('i686' 'x86_64')
license=('GPL3')
depends=('libiconv' 'libintl')
makedepends=('libiconv-devel' 'gettext-devel')
url="https://www.gnu.org/software/findutils"
source=(https://ftp.gnu.org/pub/gnu/findutils/${pkgname}-${pkgver}.tar.xz{,.sig}
        findutils-4.8.0-msysize.patch)
install=findutils.install
sha256sums=('57127b7e97d91282c6ace556378d5455a9509898297e46e10443016ea1387164'
            'SKIP'
            '8d40441ab1205e9cef908808cd32f16ff4aa691caa4cb7b98f9f55c7ca4b4885')
validpgpkeys=('A5189DB69C1164D33002936646502EF796917195')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i ${srcdir}/findutils-4.8.0-msysize.patch

  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

  ./configure \
    --build=${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
}
