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

pkgbase=diffstat
pkgname=diffstat
pkgver=1.64
pkgrel=1
pkgdesc="Display a histogram of diff changes"
arch=('i686' 'x86_64')
url="https://invisible-island.net/diffstat"
groups=('base-devel')
license=('MIT')
source=("https://invisible-mirror.net/archives/${pkgbase}/${pkgbase}-${pkgver}.tgz"{,.asc}
        "diffstat-1.62-msys2.patch")
sha256sums=('b8aee38d9d2e1d05926e6b55810a9d2c2dd407f24d6a267387563a4436e3f7fc'
            'SKIP'
            '56899c4b9587f1465bb1e0861d1487a714c794e6bc4dab44330ab4c355f40de1')
validpgpkeys=('C52048C0C0748FEE227D47A2702353E0F7E48EDB') # Thomas Dickey <dickey@invisible-island.net>

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i "${srcdir}/diffstat-1.62-msys2.patch"
}

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

  ./configure --build=${CHOST} \
    --prefix=/usr \
    --mandir=/usr/share/man
  make
}

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

  make DESTDIR=${pkgdir}/ install
  install -Dm644 package/debian/copyright "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
