# Template file for 'kcgi'
pkgname=kcgi
version=0.9.1
revision=1
build_style=gnu-configure
short_desc="Minimal CGI library for web applications in C"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="ISC"
homepage="http://kristaps.bsd.lv/kcgi/"
distfiles="http://kristaps.bsd.lv/kcgi/snapshots/kcgi-${version}.tgz"
checksum=9d4eb242b95eab948069bc32fc43bd04f3bc1f21cd1f25415a6a2f6538b896b3

broken="https://build.voidlinux.eu/builders/x86_64_builder/builds/27071/steps/shell_3/logs/stdio"

post_extract() {
	case "$XBPS_TARGET_MACHINE" in
		*-musl)
			sed -i 's/u_int/uint/g' md5.c md5.h
			sed -i '/_DECLS/d' md5.h
		;;
	esac
	sed -i '/CC.*-o/s/$/ $(LDFLAGS)/' Makefile
	sed -n '2,16p' kcgi.c > LICENSE
}

do_install() {
	make \
		PREFIX=${DESTDIR}/usr \
		SBINDIR=${DESTDIR}/usr/bin \
		MAN3DIR=${DESTDIR}/usr/share/man/man3 \
		MAN8DIR=${DESTDIR}/usr/share/man/man8 \
		install
	vlicense LICENSE
}
