# -*- 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.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  d247ba64e93c533883ac539991a4fa487971832d \
                    sha256  c452a886503277260b7c82c07031800340f892bb2147bb3af67dca7268a410b5 \
                    size    328965

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
"
