# -*- 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
PortGroup           legacysupport   1.1

go.setup            github.com/gravitational/teleport 18.11.10 v
go.toolchain_min    1.26.10
revision            0

homepage            https://goteleport.com

description         Teleport SSH server and Certificate Authority

long_description    \
    Teleport is a modern SSH server and CA for managing clusters that \
    provides secure login with certificate-based access, 2-factor \
    authentication, session logging and replay, integration with Google Apps \
    and other OAuth identity providers, and a Web UI.  Built on the Golang \
    SSH library, and compatible with OpenSSH

categories          net
installs_libs       no
license             AGPL-3 Apache-2
maintainers         {gmail.com:graemelawes @gclawes} \
                    {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

# Build process requires a git checkout
fetch.type          git

# Allow Go to fetch dependencies during build
go.offline_build no

depends_build-append \
                    port:cargo \
                    port:cbindgen \
                    port:rust

# Go 1.27's cgo rejects the Rust RDP client library: it walks the -L
# directory into Cargo's build dir and refuses LLVM bitcode, including the
# __LLVM,__bitcode sections MacPorts' Rust std objects carry. Upstream
# builds with Go 1.26 (go.mod says 1.26.10), and the Makefile calls go from
# PATH, so pin the series there.
depends_build-append \
                    port:go-1.26
build.env-append    PATH=${prefix}/lib/go-1.26/bin:$env(PATH)

depends_lib-append  port:libiconv \
                    port:zip

build.cmd           make
# The web UI needs pnpm through Corepack, Node 24 and a wasm toolchain;
# build the binaries without it
build.target        all
build.args-append   WEBASSETS_SKIP_BUILD=1
# The Makefile links arm64 with -ld_classic, a workaround for older Go that
# Xcode before 15 doesn't know
build.args-append   EXTLDFLAGS=
use_parallel_build  no

destroot {
    foreach i [glob ${worksrcpath}/build/*] {
        xinstall ${i} ${destroot}${prefix}/bin/
    }
}

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