# -*- 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/goplus/xgo 1.7.5 v
go.toolchain_min    1.24.0
go.offline_build    no
revision            0

homepage            https://xgo.dev

description         XGo (formerly Go+): designed for data science

long_description    XGo, formerly Go+, is a statically-typed language \
                    designed for data science. It is fully compatible with \
                    the Go language, but has a more script-like style, \
                    being more readable code for data science than Go.

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

checksums           rmd160  7659a682a46a5339a730f0d20012a19dace2802b \
                    sha256  aceb20c547645016b4feb33b7e32de79267f4796a0f26832d5b89e7329724afb \
                    size    769704

# The tools find their XGo root, which holds the packages XGo programs
# build against, as the directory above their bin; install the tree.
set xgo_root        ${prefix}/libexec/${name}

post-extract {
    # make.go reads the version from git or a VERSION file, which the
    # release tarball no longer has
    set fd [open ${worksrcpath}/VERSION w]
    puts ${fd} v${version}
    close ${fd}
}

build.cmd           ${go.bin} run cmd/make.go --build
build.pre_args      {}
build.args          {}
build.env-append    GOPROOT_FINAL=${xgo_root}

destroot {
    xinstall -d ${destroot}${xgo_root}
    foreach f [glob -directory ${worksrcpath} *] {
        copy ${f} ${destroot}${xgo_root}/
    }
    foreach tool {xgo hdq} {
        ln -s ${xgo_root}/bin/${tool} ${destroot}${prefix}/bin/${tool}
    }
    # gop is the command's former name
    ln -s ${xgo_root}/bin/xgo ${destroot}${prefix}/bin/gop
}

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