# Contributor: Olivier Mauras <olivier@mauras.ch>
pkgname=pdns-recursor
pkgver=4.0.7
pkgrel=0
pkgdesc="PowerDNS Recursive Server"
url="https://www.powerdns.com/"
arch="all !s390x"
license="GPL"
depends=""
depends_dev=""
makedepends="$depends_dev boost-dev lua-dev libressl-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc"
pkgusers="pdns"
pkggroups="pdns"
source="http://downloads.powerdns.com/releases/pdns-recursor-$pkgver.tar.bz2
	pdns-recursor.initd
	recursor.conf
	"

builddir="$srcdir/$pkgname-$pkgver"

# secfixes:
#   4.0.7-r0:
#     - CVE-2017-15090
#     - CVE-2017-15092
#     - CVE-2017-15093
#     - CVE-2017-15094

build() {
	cd "$builddir"
	./configure --prefix=/usr \
		--sysconfdir=/etc/pdns \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--libdir=/usr/lib/pdns \
		--disable-static
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	rm "$pkgdir"/etc/pdns/recursor.conf-dist

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname

	install -m600 -D "$srcdir"/recursor.conf \
		"$pkgdir"/etc/pdns/recursor.conf
}

sha512sums="0c8873adcce5ed9b41f161bc71635da23496b4ae48dbffff7dcdf9c5181e720f9aa94e18bd64e0dff9fa03eae8410dc93585a74d13f0c16d38b0d1c0f4146bb2  pdns-recursor-4.0.7.tar.bz2
f23cb30d943e0b0aea09371dc57aa43e55b8f91062a3caa3fac17e3565a8e36dfd304f45eba588f625ca2337cd2ade450ea5ae1776872c006204cdaf912f6651  pdns-recursor.initd
954df537693a202fc195e751011bbfaa605b3f3df42ac386fa82eb809b73c2b987f5e418b5c96bb3b0669497426ce0daa39a719844701e06990b82843a4cf0d4  recursor.conf"
