# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=heirloom-doctools
pkgver=160308
pkgrel=6
pkgdesc="The Heirloom Documentation Tools"
url="http://n-t-roff.github.io/heirloom/doctools.html"
arch="all"
license="CDDL"
depends="!coreutils !util-linux !mdocml-soelim"
depends_dev=""
makedepends="flex bison"
install=""
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/n-t-roff/${pkgname}/archive/${pkgver}.tar.gz"

_makeargs="
	CC="${CC:-gcc}" \
	CCC="${CCX:-g++}" \
	EUC=-DEUC \
	STRIP=true \
	RANLIB=ranlib \
	INSTALL=install \
	BINDIR=/usr/bin \
	MANDIR=/usr/share/man \
	LIBDIR=/usr/lib/$pkgname \
	REFDIR=/usr/lib/$pkgname/reftools \
	MACDIR=/usr/share/$pkgname/tmac \
	FNTDIR=/usr/share/$pkgname/font \
	TABDIR=/usr/share/$pkgname/nterm \
	HYPDIR=/usr/share/$pkgname/hyphen \
	PUBDIR=/usr/share/$pkgname/pub \
	PSTDIR=/usr/share/$pkgname/font/devpost/postscript
"

builddir="$srcdir"/$pkgname-$pkgver
build() {
	# Unfortunately parallel build isn't supported.
	make -j1 $_makeargs -C "$builddir" || return 1
}

package() {
	# Unfortunately parallel install isn't supported.
	make -j1 ROOT="$pkgdir" $_makeargs \
		-C "$builddir" install || return 1

	# Don't conflict with mdocml-doc
	rm -f "$pkgdir"/usr/share/man/man1/soelim.1
}

md5sums="f9759a099fca6b3021da33b94b1f37a9  heirloom-doctools-160308.tar.gz"
sha256sums="d54e22e89acfddae4cd7a1fb583ca5fce097ba4c91c7b32f634944f137af175b  heirloom-doctools-160308.tar.gz"
sha512sums="46a5b2969a807abeb4a45eb63db918c903fe02226edddccabc4eabc7e6ad77dd1c0cf633fe55981f16907cb96f3a94a769383966d2f5f5dcde276734f7ad00d7  heirloom-doctools-160308.tar.gz"
