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

go.setup            github.com/DNSControl/dnscontrol 5.7.1 v
go.toolchain_min    1.27.3
go.offline_build    no
revision            0

checksums           rmd160  6f79fcfe40b1eec17b89bc51a2f9cbd454548c98 \
                    sha256  5cf90a69313c601768d58719e48b934fe5995fa18fe48dc6f0036124d27ab52b \
                    size    6088147

homepage            https://dnscontrol.org

description         Synchronize your DNS to multiple providers from a simple DSL

long_description    \
    DNSControl is a system for maintaining DNS zones. It has two parts: a \
    domain specific language (DSL) for describing DNS zones plus software \
    that processes the DSL and pushes the resulting zones to DNS providers \
    such as Route53, Cloudflare, and Gandi. It can send the same DNS records \
    to multiple providers. It even generates the most beautiful BIND zone \
    files ever. It runs anywhere Go runs (Linux, macOS, Windows). The \
    provider model is extensible, so more providers can be added.

livecheck.url       ${github.homepage}/releases

categories          sysutils
installs_libs       no
license             MIT
maintainers         nomaintainer


build.args-append   -ldflags \"-s -w \
                                -X ${go.package}/v5/pkg/version.version=v${version} \"

post-build {
    foreach shell {bash zsh} {
        system -W ${worksrcpath} "./${name} shell-completion ${shell} > ${name}.${shell}"
    }
}

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/
    foreach {shell completion_path} [list \
        bash    share/bash-completion/completions/${name} \
        zsh     share/zsh/site-functions/_${name} \
    ] {
        xinstall -d ${destroot}${prefix}/[file dirname ${completion_path}]
        xinstall -m 0644 ${worksrcpath}/${name}.${shell} ${destroot}${prefix}/${completion_path}
    }
}
