# -*- 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.18.1 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  8713cdc79f32e7fe62abc43d25ed875a487fc0a8 \
                    sha256  3dbde020f345d397f4cf1eb1fceabba552ea3aaf83108785b1a9e9a1d6430f18 \
                    size    341917

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
"
