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

go.setup            github.com/tektoncd/cli 0.33.0 v
name                tektoncd-cli
revision            0

description         A CLI for interacting with Tekton

long_description    \
    The Tekton Pipelines cli project provides a CLI for interacting with \
    Tekton. Tekton is a powerful yet flexible framework for building CI/CD \
    systems on Kubernetes. It lets you build, test, and deploy across \
    multiple cloud providers or on-premises systems by abstracting away the \
    underlying implementation details.

categories          devel
installs_libs       no
license             Apache-2
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  4774d8d669f48413ded75b865b2873aa7f570047 \
                    sha256  18888780d58e1cd88fc943a6b15c9940599383466d33e11fa96f61f83bd755bc \
                    size    21335463

patch {
    # Comment out build commands for Linux and Windows
    reinplace -E "s/(GOOS=(linux|windows) GOARCH=(amd64|386).*)/# \\1/g" \
        ${worksrcpath}/Makefile

    # Convert the arm64 target from Linux to Darwin
    reinplace -E "/GOOS=linux GOARCH=arm64/ s/linux/darwin/g" \
        ${worksrcpath}/Makefile
}

build.env-delete    GO111MODULE=off

build.cmd           make
build.pre_args      RELEASE_VERSION=${version}
build.args          ${goarch}

destroot {
    xinstall -m 0755 \
        ${worksrcpath}/bin/tkn-darwin-${goarch} ${destroot}${prefix}/bin/tkn

    copy \
        {*}[glob ${worksrcpath}/docs/man/man1/*] \
        ${destroot}${prefix}/share/man/man1/
}
