# Maintainer (ArchLinux): Merkil <merkil@savhon.org>
# Maintainer (MSYS2): Ray Donnelly <mingw.android@gmail.com>

pkgname=delta
pkgver=20060803
pkgrel=1
dapkgver=2006.08.03
license=('BSD')
url="http://delta.tigris.org/"
pkgdesc="An useful tool that lets you minimize interesting files subject to a test of their interestingness."
arch=(i686 x86_64)
depends=('perl')
makedepends=('make' 'gcc' 'flex')
source=("http://www.tigris.org/files/documents/3103/33566/delta-${dapkgver}.tar.gz"
        "0001-Cygwin-MSYS2-WIN32-Reopen-stdin-in-text-mode.patch")
sha256sums=('38184847a92b01b099bf927dbe66ef88fcfbe7d346a7304eeaad0977cb809ca0'
            'af6302fd7fcc2d277b678b6aae78330635ce08939bb9dbcf1d75f0d93a1f8460')

prepare() {
  cd "${srcdir}/${pkgname}-${dapkgver}/"
  patch -p1 -i "${srcdir}"/0001-Cygwin-MSYS2-WIN32-Reopen-stdin-in-text-mode.patch
}

build() {
  cd "${srcdir}/${pkgname}-${dapkgver}/"
  make clean
  make || return 1
  make check || return 1
}

package() {
  cd "${srcdir}/${pkgname}-${dapkgver}/"
  install -Dm 755 ./topformflat "${pkgdir}/usr/bin/topformflat"
  install -Dm 755 ./delta "${pkgdir}/usr/bin/delta"
  install -Dm 755 ./multidelta "${pkgdir}/usr/bin/multidelta"
  install -Dm 644 ./License.txt "${pkgdir}/usr/share/licenses/${pkgname}/License.txt"
}
