# -*- 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.20.0 v
go.toolchain_min    1.26.3
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  a4cc8f84ea6ac8fd14332a5c95ab05e938f0d918 \
                    sha256  49f47b5b5255c6f29384f7d403d6c27bae9ce9944a4ff9334c67987d4b6c97b4 \
                    size    323538

build.args          -ldflags '-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
"
