# -*- 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.0 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  08eeaef451ba16adfd0b9d392ca3ead0b1e09f75 \
                        sha256  19c1c2d9d86338ca8db3740d94e1a559d26103035fb7dd29ef667cf6d543e436 \
                        size    45036

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