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

pkgname=findutils
pkgver=4.5.14
pkgrel=4
pkgdesc="GNU utilities to locate files"
arch=('i686' 'x86_64')
license=('GPL3')
groups=('base')
depends=('libiconv' 'libintl')
makedepends=('libiconv-devel' 'gettext-devel')
url="http://www.gnu.org/software/findutils"
source=(http://mirror.lihnidos.org/GNU/alpha/gnu/findutils/${pkgname}-${pkgver}.tar.gz{,.sig}
        findutils-4.5.12-msys2.patch)
install=findutils.install
sha1sums=('13ddbbf19767975cdb54515a66dc2e785b35c117'
          'SKIP'
          '8c7227556ed99a4d08ef1e04c228045fcd541b7c')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i $srcdir/findutils-4.5.12-msys2.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
}
