# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$

PortSystem 1.0

name			nsd
version			3.2.8
revision  1
categories		net
platforms		darwin
maintainers		gmail.com:arhbkb
description		Authoritative only, high performance, simple name server.
long_description	NSD is an authoritative only, high performance, simple and \
			open source name server.

set nsduser		nsd
set nsdgroup		nsd

homepage		http://www.nlnetlabs.nl/nsd/
master_sites		http://www.nlnetlabs.nl/downloads/nsd/

checksums		sha1    e8db690a09f53152f0dca6e4fbfabcc89003fced \
			rmd160  b3dcb965e65c4d65a7618997305ff9600b365898

depends_lib		path:lib/libssl.dylib:openssl

configure.args		--with-ssl=${prefix} \
			--with-pidfile=${prefix}/var/run/nsd/nsd.pid

platform darwin {
    configure.cppflags-append -D_DARWIN_C_SOURCE
}

pre-destroot {
	addgroup ${nsdgroup}
	set gid [existsgroup ${nsdgroup}]
	adduser ${nsduser} gid=${gid} shell=/sbin/nologin \
		{realname=NSD Server} home=${prefix}/var/db/nsd
}

post-destroot {
	xinstall -d ${destroot}${prefix}/share/doc/nsd
	eval xinstall -m 644 [glob ${worksrcpath}/doc/*] ${destroot}${prefix}/share/doc/nsd
	xinstall -o ${nsduser} -g ${nsdgroup} -m 755 -d ${destroot}${prefix}/var/db/nsd
	xinstall -o ${nsduser} -g ${nsdgroup} -m 755 -d ${destroot}${prefix}/var/run/nsd
}

destroot.keepdirs	${destroot}${prefix}/var/run/nsd \
			${destroot}${prefix}/var/db/nsd

variant stats description {Enable BIND8-style statistics} {
	configure.args-append	--enable-bind8-stats
}

variant rootserver description {Allows NSD to function as a root server} {
	configure.args-append	--enable-root-server
}

livecheck.type  regex
livecheck.url   ${master_sites}
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"