# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=moreutils
pkgver=0.70
pkgrel=0
pkgdesc="A growing collection of the unix tools that nobody thought to write thirty years ago"
url="https://joeyh.name/code/moreutils/"
arch="all"
license="GPL-2.0-or-later"
depends="perl perl-timedate perl-ipc-run"
checkdepends="bash"
makedepends="perl-dev docbook-xsl docbook-xml perl-xml-sax libxslt-dev linux-headers"
subpackages="$pkgname-doc"
source="https://git.joeyh.name/index.cgi/moreutils.git/snapshot/moreutils-$pkgver.tar.gz"

build() {
	_docbookpath="$(echo /usr/share/xml/docbook/xsl-stylesheets-* | \
		awk '{print $1}')"
	if [ -z "$_docbookpath" ]; then
		error "Couldn't get $_docbookpath, you need docbook-xsl installed"
	fi
	make DOCBOOKXSL=$_docbookpath
}

check() {
	make check
}

package() {
	make PREFIX=$pkgdir/usr install
	chmod 0644 $pkgdir/usr/share/man/man1/*
	mv $pkgdir/usr/share/man/man1/ts.1 $pkgdir/usr/share/man/man1/ts-moreutils.1
	mv $pkgdir/usr/share/man/man1/parallel.1 $pkgdir/usr/share/man/man1/parallel-moreutils.1
	mv $pkgdir/usr/bin/parallel $pkgdir/usr/bin/parallel-moreutils
}

sha512sums="
7e6623d4ecf50a79d1301f0c63b991f5eb32e4edccb46a99df5c39a7d5cb4d5965fb7d00214afd094f7ac4db311fe49b2a785e7429da99b4324214f0ace5c7d4  moreutils-0.70.tar.gz
"
