# -*- 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.42.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  a96874ef436af4233ed2ad157958c309ebd983ae \
                    sha256  038541bc4d22fe52f79e2925d6b64d25398970ac9ddc32a4ff1823f189cd8ea4 \
                    size    466926

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