# Template file for 'kcgi'
pkgname=kcgi
version=0.10.7
revision=1
build_style=gnu-makefile
checkdepends="pkg-config libcurl-devel"
short_desc="Minimal CGI library for web applications in C"
maintainer="Duncaen <duncaen@voidlinux.eu>"
license="ISC"
homepage="http://kristaps.bsd.lv/kcgi/"
distfiles="http://kristaps.bsd.lv/kcgi/snapshots/kcgi-${version}.tgz"
checksum=7bb64212262de06c1203a326cf5873aebac3b80fa35ee9dc7e13a494a762723f

do_configure() {
	local _libc=glibc
	case "$XBPS_TARGET_MACHINE" in
		*-musl) _libc=musl ;;
	esac
	if [ -n "$CROSS_BUILD" ]; then
		cp "${FILESDIR}/configure.$_libc" configure.local
	fi
	case "$XBPS_TARGET_MACHINE" in
		x86_64*|i686*|armv*) ;;
		*) sed -i 's/HAVE_SECCOMP_FILTER=1/HAVE_SECCOMP_FILTER=0/' configure.local ;;
	esac
	./configure PREFIX=/usr MANDIR=/usr/share/man SBINDIR=/usr/bin
}

do_check() {
	make regress
}

post_install() {
	sed -n '2,16p' kcgi.c > LICENSE
	vlicense LICENSE
}
