# -*- 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/operator-framework/operator-sdk 1.41.1 v
revision            0
categories          devel
license             Apache-2
maintainers         {emcrisostomo @emcrisostomo} \
                    openmaintainer

description         The Operator Framework is an open source toolkit to \
                    manage Kubernetes native applications, called \
                    Operators, in an effective, automated, and scalable \
                    way.
long_description    The goal of an Operator is to put operational knowledge \
                    into software. Previously this knowledge only resided in \
                    the minds of administrators, various combinations of \
                    shell scripts or automation software like Ansible. It was \
                    outside of your Kubernetes cluster and hard to integrate. \
                    With Operators, CoreOS changed that.

checksums           rmd160  99aabc4ab55dbc9aa6b6fc162bd47e375eeda273 \
                    sha256  5c69ad9845d14113bdff44d4fb351fa2230e76a942b0c60f8db03c57ee83e89e \
                    size    2535711

# Allow deps to fetched at build time
go.offline_build no
build.target        ${go.package}/cmd/operator-sdk ${go.package}/cmd/helm-operator
depends_build-append \
                    port:pkgconfig \
                    port:gpgme

pre-build {
    set worksrcpath_parent [exec dirname [exec dirname ${worksrcpath}]]
    set simple_version v${version}
    set git_version v${version}
    set git_commit 4aeffa75d95d482d0af9cc44398f1389f406ddbf
    set k8s_version v1.33.1
    set image_version ${version}
    build.cmd ${go.bin} \
        build -o ${worksrcpath} \
        -gcflags "all=-trimpath=${worksrcpath_parent}" \
        -asmflags "all=-trimpath=${worksrcpath_parent}" \
        -ldflags \
        "\"-X '${go.package}/internal/version.Version=${simple_version}' \
        -X '${go.package}/internal/version.GitVersion=${git_version}' \
        -X '${go.package}/internal/version.GitCommit=${git_commit}' \
        -X '${go.package}/internal/version.KubernetesVersion=${k8s_version}' \
        -X '${go.package}/internal/version.ImageVersion=${image_version}'\""
}

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

github.livecheck.regex  {([^"r]+)}
