# -*- 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/goreleaser/nfpm 2.46.0 v
go.offline_build    no
go.package          github.com/goreleaser/nfpm/v2
revision            0

homepage            https://nfpm.goreleaser.com

description         \
    nFPM is Not FPM - a simple deb, rpm and apk packager written in Go

long_description    \
    {*}${description}: a simpler, 0-dependency, \
    as-little-assumptions-as-possible alternative to fpm.

categories          sysutils
installs_libs       no
license             MIT
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  20012ad3ffe62ff32cb605e975ae443217679924 \
                    sha256  b4d6f2065e3a6c2a59520086b149dd51872dc6362bbd8f9df9bd655ca82111f7 \
                    size    609095

build.pre_args-append \
    -ldflags \" \
        -X main.version=${github.tag_prefix}${version} \
        -X main.builtBy=macports \
    \"

build.args          ./cmd/${name}

post-build {
    system -W ${worksrcpath} ./scripts/completions.sh
    system -W ${worksrcpath} ./scripts/manpages.sh
}

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

    # install man page
    copy \
        ${worksrcpath}/manpages/${name}.1.gz \
        ${destroot}${prefix}/share/man/man1

    # install shell completions
    xinstall -d ${destroot}${prefix}/share/bash-completion/completions
    copy \
        ${worksrcpath}/completions/${name}.bash \
        ${destroot}${prefix}/share/bash-completion/completions/${name}

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

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