# Template file for 'unbound'
pkgname=unbound
version=1.22.0
revision=1
build_style=gnu-configure
configure_args="--with-libevent --with-conf-file=/etc/unbound/unbound.conf
 --with-pidfile=/run/unbound.pid --with-ssl=${XBPS_CROSS_BASE}/usr
 --with-libevent=${XBPS_CROSS_BASE}/usr --with-libexpat=${XBPS_CROSS_BASE}/usr
 --enable-dnscrypt --enable-event-api --sbindir=/usr/bin
 --with-rootkey-file=/etc/dns/root.key --with-username=_unbound"
conf_files="/etc/unbound/unbound.conf"
makedepends="expat-devel libevent-devel libsodium-devel"
depends="dnssec-anchors"
short_desc="Validating, recursive, and caching DNS resolver"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="BSD-3-Clause"
homepage="https://nlnetlabs.nl/projects/unbound/about/"
distfiles="https://nlnetlabs.nl/downloads/unbound/${pkgname}-${version}.tar.gz"
checksum=c5dd1bdef5d5685b2cedb749158dd152c52d44f65529a34ac15cd88d4b1b3d43
system_accounts="_unbound"

post_install() {
	vsconf doc/example.conf unbound.conf
	vinstall ${FILESDIR}/unbound.conf 644 etc/unbound
	vsv unbound
	vlicense LICENSE
}

libunbound_package() {
	short_desc+=" - shared library"
	pkg_install() {
		vmove "usr/lib/libunbound.so.*"
	}
}

unbound-devel_package() {
	depends="libunbound>=${version}_${revision} openssl-devel libevent-devel"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
		vmove usr/share/man/man3
	}
}
