# -*- 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

name            groovy
version         6.0.0
revision        0

categories      lang java
maintainers     {breun @breun} openmaintainer
platforms       {darwin any}
license         Apache-2
supported_archs noarch

description     Groovy -- a Java-based scripting language

long_description Apache Groovy is a powerful, optionally typed and dynamic \
                 language, with static-typing and static compilation \
                 capabilities, for the Java platform aimed at improving \
                 developer productivity thanks to a concise, familiar and easy \
                 to learn syntax. It integrates smoothly with any Java \
                 program, and immediately delivers to your application \
                 powerful features, including scripting capabilities, \
                 Domain-Specific Language authoring, runtime and compile-time \
                 meta-programming and functional programming.

homepage        https://groovy.apache.org
master_sites    https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/
distname        apache-${name}-binary-${version}
use_zip         yes

checksums       rmd160  049a8447192cb193e0e7c5b35c9e9cd9b1e13a9b \
                sha256  54ab1a877f01da2ed16ed43c1ed7a8d6c36b122714c6959712700e89e6efde7c \
                size    49076665

worksrcdir      ${name}-${version}

use_configure   no

# Prerequisites: https://groovy-lang.org/install.html#_prerequisites
java.version    17+
java.fallback   openjdk25

build {}

destroot {
    set target ${destroot}${prefix}/share/java/${name}

    # Create the target java directory
    xinstall -m 755 -d ${target}

    # Copy over the needed elements of our directory tree
    foreach d { bin conf grooid lib } {
        copy ${worksrcpath}/${d} ${target}
    }

    # Remove extraneous bat files
    foreach f [glob -directory ${target}/bin *.bat] {
        delete ${f}
    }

    # Add symlinks to the scripts
    foreach f { grape grape_completion groovy groovy_completion groovyc groovyc_completion groovyConsole groovyConsole_completion groovydoc groovydoc_completion groovysh groovysh_completion java2groovy startGroovy } {
        ln -s ../share/java/${name}/bin/${f} ${destroot}${prefix}/bin
    }
}

livecheck.regex ${name}-binary-(\[\\d\.\]+)${extract.suffix}
