# Contributor: Jesse Young <jlyo@jlyo.org>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=ucspi-tcp6
pkgver=1.13.02
pkgrel=0
pkgdesc="IPv6 enabled ucspi-tcp superserver"
url="http://www.fehcom.de/ipnet/ucspi-tcp6.html"
arch="all"
license="Public-Domain"
subpackages="$pkgname-doc"
provides="ucspi-tcp"
makedepends="fehqlibs"
options="!check"
source="https://www.fehcom.de/ipnet/ucspi-tcp6/ucspi-tcp6-$pkgver.tgz"

builddir="$srcdir/net/$pkgname/$pkgname-${pkgver%%[a-zA-Z]}"

build() {
	echo "/usr/lib/qlibs" > conf-qlibs
	echo "/usr" > conf-home
	echo "/usr" > src/home

	export CFLAGS="$CFLAGS -I/usr/lib/qlibs/include"
	export LDFLAGS="$LDFLAGS -L/usr/lib/qlibs"

	make -C src -j1 # makefiles are not threadsafe, use one thread only.
}

package() {
	cat package/commands-base | while IFS= read -r file
	do
		install -Dm0755 "src/$file" "$pkgdir/usr/bin/$file"
	done

	# need to `cd` here to keep code shorter
	(
	cd man
	for file in *.[0-9]; do
		install -Dm0644 -t "$pkgdir/usr/share/man/man${file##*[a-zA-Z.]}" "$file"
	done
	)

	install -Dm0644 doc/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

sha512sums="
a7a74654e3448f89a9aab4dd6dcfae66e5c6b71a4f747d0e79d51e370278b38a49ee1e65334e8b700071b1bcd128b4047e248a76b27e1388310282a303f61f18  ucspi-tcp6-1.13.02.tgz
"
