# -*- 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

PortSystem          1.0
PortGroup           boost 1.0
PortGroup           openssl 1.0

name                pdns-recursor
version             4.9.1
revision            0
categories          net
maintainers         {l2dy @l2dy} openmaintainer
license             {GPL-2 OpenSSLException}

description         a high-end, high-performance resolving name server

long_description    The PowerDNS Recursor is a high-end, high-performance \
                    resolving name server which powers the DNS resolution of \
                    at least a hundred million subscribers. Utilizing multiple \
                    processors and supporting the same powerful scripting ability \
                    of the Authoritative Server, the Recursor delivers top performance \
                    while retaining the flexibility modern DNS deployments require.

homepage            https://www.powerdns.com/recursor.html
master_sites        https://downloads.powerdns.com/releases/
use_bzip2           yes

checksums           rmd160  fb9fa2bca8133178ae7c403c6b30b02d0abeabad \
                    sha256  0a1edc13e8f2bd661f39e316387d941e22de6a03b8a7a2fc662fdf8b942ea2be \
                    size    1566613

depends_build       port:pkgconfig

boost.version       1.76

compiler.cxx_standard 2017
compiler.thread_local_storage yes

startupitem.create      yes
startupitem.executable  ${prefix}/sbin/pdns_recursor

configure.args      --sysconfdir=${prefix}/etc/powerdns \
                    --enable-reproducible \
                    --without-libsodium \
                    --without-lua \
                    --without-protobuf

variant lua conflicts luajit description {Build with Lua} {
    configure.args-replace  --without-lua --with-lua=lua
    depends_lib-append      port:lua
}

variant luajit conflicts lua description {Build with LuaJIT} {
    configure.args-replace  --without-lua --with-lua=luajit
    depends_lib-append      path:lib/libluajit-5.1.2.dylib:luajit
}

if {![variant_isset lua] && ![variant_isset luajit]} {
    default_variants +lua
}

post-destroot {
    move ${destroot}${prefix}/etc/powerdns/recursor.conf-dist ${destroot}${prefix}/etc/powerdns/recursor.conf.sample
}

post-activate {
    if {![file exists ${prefix}/etc/powerdns/recursor.conf]} {
        copy ${prefix}/etc/powerdns/recursor.conf.sample ${prefix}/etc/powerdns/recursor.conf
    }
}

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