# -*- 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.2 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  bfd970bebe4226c55cda23333cf4b67b71ad3e65 \
                    sha256  29f5b702f532f345270e2f7bb8b01ea07dbc6892e34ec8c97a180002794684e3 \
                    size    327226

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
"
