# -*- 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.34.0 v
maintainers         {breun @breun} openmaintainer
# macOS 11 is the oldest version that provides a Go version that is recent enough to build Stern
platforms           {darwin >= 20}
revision            0
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  579426037561cadd55a2835117f46f6214c466a9 \
                    sha256  1cfec22cef9705e68fc46060ba85164af12bd07ede9264bafb67d11400996e71 \
                    size    67279

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

