# Mainainer: Sébastien Luttringer <seblu@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Andreas Radke <andyrtr@archlinux.org>

pkgname=diffutils
pkgver=3.10
pkgrel=1.1
pkgdesc='Utility programs used for creating patch files'
arch=('aarch64')
url='https://www.gnu.org/software/diffutils'
license=('GPL3')
depends=('glibc' 'bash')
makedepends=('make' 'gcc' 'patch' 'coreutils')
validpgpkeys=('155D3FC500C834486D1EEA677FD9FCCB000BEEEE') # Jim Meyering
source=("https://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
sha256sums=('90e5e93cc724e4ebe12ede80df1634063c7a855692685919bfe60b556c9bd09e'
            'SKIP')

prepare() {
  cd $pkgname-$pkgver
  # apply patch from the source array (should be a pacman feature)
  local src
  for src in "${source[@]}"; do
    src="${src%%::*}"
    src="${src##*/}"
    [[ $src = *.patch ]] || continue
    msg2 "Applying patch $src..."
    patch -Np1 < "../$src"
  done
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  make
}

# # The test suite depends on having diffutils installed (which it
# # usually would be through base-devel). However, we have no
# # pre-existing diffutils to test against in bootstrap, so we're forced
# # to drop the test suite (TODO: patch out the bad gnulib tests?)
# check() {
#   cd $pkgname-$pkgver
#   make check
# }

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

# vim:set ts=2 sw=2 et:
