# -*- 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

name                istioctl

go.setup            github.com/istio/istio 1.30.0
github.tarball_from archive
revision            0
categories          sysutils
supported_archs     x86_64 arm64
license             Apache-2

homepage            https://istio.io

maintainers         nomaintainer

description         Istio command line configuration utility
long_description    Istio is an open, platform-independent service mesh designed \
                    to manage communications between microservices and applications. \
                    Without requiring changes to the underlying services, Istio \
                    provides automated baseline traffic resilience, service metrics \
                    collection, distributed tracing, traffic encryption, protocol \
                    upgrades, and advanced routing functionality for all \
                    service-to-service communication. \
                    The port deploys the istioctl command line utility, \
                    used to create, list, modify, and delete configuration \
                    resources in a deployed Istio system.

github.livecheck.regex \
                    {([0-9.]+)}

go.package          istio.io/istio

checksums           rmd160  d3ea25cb424185c5b8f697510d1fc9868d85395f \
                    sha256  5407b940fb5004c5194f9daf36f505667df9b73f785c82e9f33fc0f54c2f5969 \
                    size    6811958

build.cmd           make
build.target        ${name}

# Allow deps to fetched at build time
go.offline_build no
build.env-append    TAG=${version} \
                    VERSION=${version} \
                    BUILD_WITH_CONTAINER=0 \
                    IGNORE_DIRTY_TREE=1 \
                    TARGET_OUT=${workpath}/out

destroot {
    set bin_path ${destroot}${prefix}/bin/${name}
    xinstall ${workpath}/out/${name} ${bin_path}

    set bash_completion ${destroot}${prefix}/share/bash-completion/completions
    xinstall -d ${bash_completion}
    system "${bin_path} completion bash > ${bash_completion}/${name}"

    set zsh_completion ${destroot}${prefix}/share/zsh/site-functions
    xinstall -d ${zsh_completion}
    system "${bin_path} completion zsh > ${zsh_completion}/_${name}"

    set fish_completion ${destroot}${prefix}/share/fish/vendor_completions.d
    xinstall -d ${fish_completion}
    system "${bin_path} completion fish > ${fish_completion}/${name}.fish"
}
