# -*- 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             5.3.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_xz              yes

checksums           rmd160  e4cd07387562fad22ec755ed35bb32dc4ff3307e \
                    sha256  a7b633d4b5da3b5f14d51a78e21e17f1334c828ce96fcccdd97cd7aaaf14cbd5 \
                    size    1362088

depends_build       port:pkgconfig \
                    port:cargo

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-activate {
    if {![file exists ${prefix}/etc/powerdns/recursor.yml]} {
        copy ${prefix}/etc/powerdns/recursor.yml-dist ${prefix}/etc/powerdns/recursor.yml
    }
}

notes "
    If you upgraded to a version greater then v5.2 the old style settings format is deprecated\
    and you should use the YAML style settings.

    Read more at: https://doc.powerdns.com/recursor/yamlsettings.html
"

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