# -*- 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
PortGroup           legacysupport 1.1

go.setup            github.com/yitsushi/totp-cli 1.9.2 v
go.offline_build    no
github.tarball_from archive
revision            0

categories          security
maintainers         {gmail.com:smanojkarthick @manojkarthick} \
                    {gmail.com:herby.gillot @herbygillot} \
                    {hotmail.com:amtor @RobK88} \
                    openmaintainer

license             MIT

description         Authy/Google Authenticator like TOTP CLI tool written in Go.

long_description    A simple TOTP (Time-based One-time Password) CLI tool. \
                    TOTP is the most common mechanism for 2FA (Two-Factor-Authentication). \
                    You can manage and organize your accounts with namespaces and protect your data with a password.

checksums           rmd160  da8acc2f10ab3565e6741fe4ff42daa5579144ab \
                    sha256  c8b87c7854f373423dba2f8c6167c2836b6ae1f66b29b1becb505c277a00c54f \
                    size    61880

build.args-append   \
    -ldflags \" \
        -X ${go.package}/internal/info.Version=${github.tag_prefix}${version} \
    \"

pre-build {
#   Sierra and earlier
    if { ${os.platform} eq "darwin" && ${os.major} < 17 } {
        build.env-append    GO_EXTLINK_ENABLED="1" \
                            GO_LDFLAGS="\"-extldflags=${configure.ldflags}\"" \
                            CGO_LDFLAGS="-g -O2 ${configure.ldflags}"
    }
}

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/

    xinstall -d ${destroot}${prefix}/share/bash-completion/completions
    file copy ${worksrcpath}/autocomplete/bash_autocomplete \
        ${destroot}${prefix}/share/bash-completion/completions/${name}

    xinstall -d ${destroot}${prefix}/share/zsh/site-functions
    file copy ${worksrcpath}/autocomplete/zsh_autocomplete \
        ${destroot}${prefix}/share/zsh/site-functions/_${name}
}