# Contributor: Jesse Young <jlyo@jlyo.org>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=ucspi-tcp6
pkgver=1.12.4
pkgrel=1
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/fehQlibs" > 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="
8adca678f331b185750fba41adb65698a1e25740bcbed730899dd858b5f6d3dde7256e772fb4c5109feb24cc1f3a51619e4659e14d6b676febecdf6ee7a2c79e  ucspi-tcp6-1.12.4.tgz
"
