# Template file for 'ndhc'
pkgname=ndhc
version=20170928
revision=1
build_style=cmake
make_dirs="/var/lib/ndhc/state 0755 root root
 /var/lib/ndhc/jail/dev 0755 root root"
hostmakedepends="ragel"
makedepends="libcap-devel"
short_desc="Privilege-seperated secure DHCPv4 client"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="2-clause-BSD"
homepage="https://github.com/niklata/ndhc"
nocross=yes   # needs heavy CMakeLists patching
_ndhcsum=8bb00c9c3650e49f7d1b8eee310009c5d49c7339
_libsum=343c2b5be2631aac85161f8de606c32db35abc2b
distfiles="https://github.com/niklata/ndhc/archive/$_ndhcsum.tar.gz
 https://github.com/niklata/ncmlib/archive/$_libsum.tar.gz"
checksum="9c43851264bdcaeb2de729104e967bd1326590c79cfe6363c34da4c5228a8800
 edecd07f335db0254ad98680a15be429e45a725a88a5c9cc82e0f51a64626b42"
wrksrc="ndhc-$_ndhcsum"

# XXX we use only one account for privsep, not three, because they
# should have the same primary group.  to be verified.
system_accounts="ndhc"
ndhc_homedir="/var/lib/ndhc/jail"

build_options="static"
if [ "$build_option_static" ]; then
	LDFLAGS+=" -static"
fi

post_extract() {
	mv $XBPS_BUILDDIR/ncmlib-* $wrksrc/ncmlib
}

do_install() {
	vbin build/src/ndhc
	vman src/ndhc.8
	vsv ndhc
	vlicense LICENSE
}
