# -*- 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/asdf-vm/asdf 0.17.0 v
go.offline_build    no
revision            0

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

description         Extendable version manager with support for Ruby, Node.js, \
                    Elixir, Erlang & more

long_description    ${name} is a CLI tool that can manage multiple language \
                    runtime versions on a per-project basis.
homepage            https://asdf-vm.com/

checksums           rmd160  7bd2d3bdb64347a78f2ab5240454aa2702f01fd1 \
                    sha256  47446cd6007b743ee207541fa8ebcddaae2c988f4cbd9dd845a2a7806d5d2f90 \
                    size    327814

build.args          -ldflags '-s -w -X main.Version=${github.tag_prefix}${version}' \
                    ./cmd/asdf

post-build {
    xinstall -d -m 0755 ${worksrcpath}/completions
    system -W ${worksrcpath} "./${name} completion bash > completions/${name}"
    system -W ${worksrcpath} "./${name} completion fish > completions/${name}.fish"
    system -W ${worksrcpath} "./${name} completion zsh > completions/_${name}"
}

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

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

    xinstall -d ${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/zsh/site-functions
    xinstall -m 0644 \
        ${worksrcpath}/completions/_${name} \
        ${destroot}${prefix}/share/zsh/site-functions
}

notes "
asdf has been completely rewritten in Go as of version 0.16.0.
Manual sourcing file like asdf.sh or asdf.fish, is no longer required to
activate asdf. Cuz 'asdf shell' command has been removed.

For details on the changes and migration steps, see:

- https://asdf-vm.com/guide/upgrading-to-v0-16.html
- https://asdf-vm.com/guide/getting-started.html
"
