# -*- 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               select 1.0
PortGroup               github 1.0

github.setup            tfutils tfenv 3.0.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
license                 MIT
categories              sysutils
platforms               any
supported_archs         noarch

maintainers             {amake @amake} openmaintainer

description             Terraform version manager
long_description        {*}${description}

checksums               rmd160  8bd4fbf1046407021368d64374cae49e0484abe5 \
                        sha256  5eb3a62e8f6b614f6fd435a0fc52b1fdf4636cbd880fbd36235377c02151a5be \
                        size    31492

depends_run             port:terraform_select

use_configure           no

select.group            terraform
select.file             ${filespath}/${name}

build {}

destroot {
    xinstall -d ${destroot}${prefix}/share/${name}
    copy {*}[glob ${worksrcpath}/*] ${destroot}${prefix}/share/${name}
    ln -s ../share/${name}/bin/${name} ${destroot}${prefix}/bin/${name}
}

notes "
Set the following environment variables before running `${name} install`:
    TFENV_ARCH=${os.arch}
    TFENV_CONFIG_DIR=~/.tfenv

To make the tfenv-managed terraform the default, run:
    sudo port select --set terraform ${name}
"
