# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=strip-nondeterminism
pkgver=1.13.1
pkgrel=1
pkgdesc='Tool for stripping bits of non-deterministic information from files'
url='https://salsa.debian.org/reproducible-builds/strip-nondeterminism'
arch=('any')
license=('GPL-3.0-or-later')
depends=("perl" 'perl-archive-zip' 'perl-archive-cpio' 'perl-sub-override')
makedepends=('git')
options=('!emptydirs')
source=(https://salsa.debian.org/reproducible-builds/strip-nondeterminism/-/archive/${pkgver}/strip-nondeterminism-${pkgver}.tar.bz2
        https://salsa.debian.org/reproducible-builds/reproducible-lfs/raw/master/releases/strip-nondeterminism/strip-nondeterminism-${pkgver}.tar.bz2.asc)
sha256sums=('0bde4b23edd6cdb82fcdc4745ef9dc8ca0743e7c7e4fb2ea0bf78c76511f49f3'
            'SKIP')
b2sums=('ab9b989e6c6bf49d59e198c1c13648ca13a379c1ac04ff92c412bbee441edc08f11953024e360c961d5d76ba27d488c33eb664314a43e7ee34054ce7963d9480'
        'SKIP')
validpgpkeys=('C2FE4BD271C139B86C533E461E953E27D4311E58'  # Chris Lamb <lamby@debian.org>
              'EF5D84C1838F2EB6D8968C0410378EFC2080080C'  # Andrew Ayer <agwa@andrewayer.name>
              '2F5DAF3FC1F793D94F3D900CA721DA055374AA4F'  # Reiner Herrmann <reiner@reiner-h.de>
              'B8BF54137B09D35CF026FE9D091AB856069AAA1C'  # Holger Levsen <holger@layer-acht.org>
              '66AE2B4AFCCF3F52DA184D184B043FCDB9444540') # Mattia Rizzolo <mattia@debian.org>

prepare() {
  cd ${pkgname}-${pkgver}
  sed -r 's|bin/dh_strip_nondeterminism ||g' -i Makefile.PL
}

build() {
  cd ${pkgname}-${pkgver}
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  make -C ${pkgname}-${pkgver} test
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 README -t "${pkgdir}/usr/share/doc/${pkgname}"
  # Don't install the internal handler documentation generated from pod documents
  # https://salsa.debian.org/reproducible-builds/strip-nondeterminism/-/commit/b9b84287c654bd14d6489282475868977dec50c6
  rm -r "${pkgdir}/usr/share/man/man3"
}

# vim: ts=2 sw=2 et:
