# -*- 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.2.2 v
github.tarball_from     archive
license                 MIT
categories              sysutils
platforms               any
supported_archs         noarch

maintainers             {amake @amake} openmaintainer

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

checksums               rmd160  b170dbfbf6465c0a2be23b6901a515059369d344 \
                        sha256  c9c8b2e2588cf026aafa9803dfdefdfc7aa258577c24ea9624fe53f764edea47 \
                        size    80290

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}
"
