# Template file for 'ndhc'
pkgname=ndhc
version=20150703
revision=1
build_style=cmake
make_dirs="/var/lib/ndhc/state 0755 root root
 /var/lib/ndhc/jail/dev 0755 root root"
hostmakedepends="cmake ragel"
makedepends="libcap-devel"
short_desc="Privilege-seperated secure DHCPv4 client"
maintainer="Christian Neukirchen <chneukirchen@gmail.com>"
license="BSD"
homepage="https://github.com/niklata/ndhc"
nocross=yes   # needs heavy CMakeLists patching

# 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

_ndhcsum="e0b5ff8eaf2dba7beb37ca49df5521f83a3eead5"
_libsum="9c2fd471442db3d927e76132b736b41084d9b119"
distfiles="https://github.com/niklata/ndhc/archive/$_ndhcsum.tar.gz
https://github.com/niklata/ncmlib/archive/$_libsum.tar.gz"
checksum="43713c1481eea26a9a46980ec652e10ac64365361d45b3c7f86d41ae3a9ab4bd 26fe5ec4ce174f5d4fe43bd272ea288b686e6d9da9ed8d6853995958b7d6b667"

wrksrc="ndhc-$_ndhcsum"

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

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