# -*- 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/mr-karan/doggo 1.0.5 v
go.offline_build    no
revision            0

description         Command-line DNS Client for Humans

long_description    doggo is a modern command-line DNS client (like dig) \
                    written in Golang. It outputs information in a neat \
                    concise manner and supports protocols like DoH, DoT and \
                    DNSCrypt as well. It supports DNS over HTTP, DNS over \
                    TLS, DNS over TCP/UDP, DNS over DNSCrypt, as well as JSON \
                    output.

categories          net sysutils
installs_libs       no
license             GPL-3
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  01ec3f2811271b1027fe8cef3df407c0b0f14990 \
                    sha256  92a34f5510a48ab657a980c39edf907c17e96e88a476187d5b57a8cef3becd5b \
                    size    2438614

build.cmd           make
build.pre_args      VERSION=${version}
build.args          build-cli

post-build {
    file mkdir ${worksrcpath}/completions

    foreach _shell {bash fish zsh} {
        system -W ${worksrcpath}/completions \
            "sh -c '../bin/${name}.bin completions ${_shell} > ${name}.${_shell}'"
    }
}

destroot {
    xinstall -m 0755 \
        ${worksrcpath}/bin/${name}.bin \
        ${destroot}${prefix}/bin/${name}

    xinstall -d ${destroot}${prefix}/share/bash-completion/completions
    xinstall -m 0644 ${worksrcpath}/completions/${name}.bash \
        ${destroot}${prefix}/share/bash-completion/completions/${name}

    xinstall -d -m 0644 ${destroot}${prefix}/share/zsh/site-functions
    xinstall -m 0644 ${worksrcpath}/completions/${name}.zsh \
        ${destroot}${prefix}/share/zsh/site-functions/_${name}

    xinstall -d -m 0644 ${destroot}${prefix}/share/fish/vendor_completions.d
    xinstall -m 0644 ${worksrcpath}/completions/${name}.fish \
        ${destroot}${prefix}/share/fish/vendor_completions.d/

    xinstall -d ${destroot}${prefix}/share/${name}/examples
    copy ${worksrcpath}/config-api-sample.toml \
        ${destroot}${prefix}/share/${name}/examples/
}
