# Template file for 'ndhc'
pkgname=ndhc
version=20170224
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=2a26acacdd61671f5440a5c1d361c1da4ce60a0e
_libsum=6c9f48031a5408eb6775f86e9f86e5d5f2895ed1
distfiles="https://github.com/niklata/ndhc/archive/$_ndhcsum.tar.gz
 https://github.com/niklata/ncmlib/archive/$_libsum.tar.gz"
checksum="45f7edddd5c42fa2c5f5f5943a1c789895f0deccb82bb2fd4fff70493d10148b
 1ff1e8a6159337093ea45d512460ab8ffa41e3b893ae838bcb203bd730b37a3f"
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
}
