# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=psutils
pkgver=1.17
pkgrel=0
pkgdesc="A set of postscript utilities"
url="http://knackered.org/angus/psutils"
arch="all"
license="custom"
depends="perl"
depends_dev="perl-dev"
makedepends="$depends_dev"
install=""
subpackages="$pkgname-dev $pkgname-doc"
source="https://sources.archlinux.org/other/$pkgname/$pkgname-$pkgver.tar.gz
	psutils-1.17.patch"

_builddir="$srcdir"/$pkgname
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	make -f Makefile.unix BINDIR=/usr/bin \
	    INCLUDEDIR=/usr/include/psutils PERL=/usr/bin/perl \
	    MANDIR=/usr/share/man/man1 \
	    CFLAGS="$CFLAGS -DPAPER=\\\"letter\\\" -DUNIX -Wall" \
	    CCFLAGS="$LDFLAGS"
}

package() {
	cd "$_builddir"
	install -d -m755 "${pkgdir}/usr/include"
	install -d -m755 "${pkgdir}/usr/share/man"
	make -f Makefile.unix BINDIR="${pkgdir}/usr/bin" \
	    INCLUDEDIR="${pkgdir}/usr/include/psutils" PERL=/usr/bin/perl \
	    MANDIR="${pkgdir}/usr/share/man/man1" install
	install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
	install -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/"
}

md5sums="b161522f3bd1507655326afa7db4a0ad  psutils-1.17.tar.gz
2b49e9e796000b42f42804d4b50a2be1  psutils-1.17.patch"
sha256sums="3853eb79584ba8fbe27a815425b65a9f7f15b258e0d43a05a856bdb75d588ae4  psutils-1.17.tar.gz
af2d2c72ee333491a188f0b9675ce26fdd45fbed793ced1e2bea2e9e079d2946  psutils-1.17.patch"
sha512sums="91feff88c885173ab1c4ba6b5ffd0d9e90bfa6105479b074065584fc2a87e78fbe71e4bc90d2e7079d86b467caf092b6744b0ea4234880ba78cad8dd7820de77  psutils-1.17.tar.gz
795f45c6315e3c02485d1d5243c1541992b669539257249a185f57136e623c489a9f3635d3f171f698428aeb9710332cf36bb0aa0ade8ea351514044630f12f0  psutils-1.17.patch"
