# -*- 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/stern/stern 1.33.0 v
maintainers         {breun.nl:nils @breun} openmaintainer
# macOS 11 is the oldest version that provides a Go version that is recent enough to build Stern
platforms           {darwin >= 20}
revision            1
categories          sysutils
license             Apache-2

description         Multi pod and container log tailing for Kubernetes

long_description    Stern allows you to tail multiple pods on Kubernetes and \
                    multiple containers within the pod. Each result is color \
                    coded for quicker debugging.

checksums           rmd160  0ed4cf9024d10c2fe7485576e487883c18f3d913 \
                    sha256  ab907adb5941ce1ffd1effaa63e5ec590203b6e8dee072e4143591fb2650fa95 \
                    size    67268

set go_ldflags      "-s -w -X ${go.package}/cmd.version=${version}"
build.args          -ldflags \"${go_ldflags}\" -o bin/${name}

# FIXME: This port currently can't be built without allowing go mod to fetch
# dependencies during the build phase. See
# https://trac.macports.org/ticket/61192
go.offline_build no
post-patch {
    if {${os.major} == 20} {
        reinplace "s|go 1.25|go 1.24|g" ${worksrcpath}/go.mod
    }
}
test.run    yes
test.cmd    bin/stern
test.target
test.args   --version

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

