# -*- 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.0 v
go.toolchain_min    1.27.3
go.offline_build    no
revision            0

checksums           rmd160  c25baf9bf2c97ea55ab95ec4f8bd7fe81bc17e0d \
                    sha256  4a76b675ba797cf9ee3200c33c0452fd74da429b93b32bd4a56e00307ca4d6ef \
                    size    6090773

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}
    }
}
