# -*- 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               java 1.0
PortGroup               github 1.0

github.setup            apple pkl 0.30.0
github.tarball_from     archive
revision                0

java.version            21
java.fallback           openjdk21

categories              lang
maintainers             {sub-pop.net:link @subpop} openmaintainer

license                 Apache-2

description             A configuration as code language with rich validation and tooling
long_description        Pkl (pronounced Pickle) is an embeddable configuration \
                        language which provides rich support for data templating \
                        and validation. It can be used from the command line, \
                        integrated in a build pipeline, or embedded in a program. \
                        Pkl scales from small to large, simple to complex, ad-hoc \
                        to repetitive configuration tasks.

checksums               rmd160  1781b5a8a54d45ccb3ba5f55b60b9eb32fbfbe47 \
                        sha256  f3788e253ca26a5d74ac2f933c0646fa3012af130be084079cc9dee9e283cc40 \
                        size    4328751

use_configure           no

supported_archs         arm64 x86_64

build.cmd               ./gradlew --info --stacktrace
if {${configure.build_arch} eq "arm64"} {
    build.target            pkl-cli:macExecutableAarch64
    set arch_name           aarch64
} else {
    build.target            pkl-cli:macExecutableAmd64
    set arch_name           amd64
}
build.post_args         -DreleaseBuild=true \
                        --no-daemon \
                        -Dpkl.native-Dpolyglot.engine.userResourceCache=${workpath}/polyglot-cache
build.env-append        GRADLE_USER_HOME=${workpath}/gradle \
                        GRAALVM_HOME=${workpath}/graalvm

destroot {
    xinstall -m 0755 ${worksrcpath}/pkl-cli/build/executable/pkl-macos-${arch_name} ${destroot}${prefix}/bin/pkl
}
