# Template file for 'ndhc'
pkgname=ndhc
version=20180218
revision=2
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=e08d3b15b53f54ae47993e229bfd40ed3d643f86
_libsum=fb9ee14a9e343d83fcf9d761de719d8410168e71
distfiles="https://github.com/niklata/ndhc/archive/$_ndhcsum.tar.gz
 https://github.com/niklata/ncmlib/archive/$_libsum.tar.gz"
checksum="704dd0f9a340b7e3faaf054c119832d749525d83b3364114151a88853ea6ae53
 6b47f624f17616dbebfec223b1b57c745e6d6dbd5d678ee898666651f37e1355"
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
}
