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

name                    sheepit-client
gitlab.setup            sheepitrenderfarm client 7.23353.0 v
revision                0

categories              graphics java
license                 GPL-2
platforms               {darwin any}
supported_archs         noarch
maintainers             {judaew @judaew} openmaintainer

description             SheepIt Render Farm Client is an Open Source client for \
                        the distributed render farm SheepIt.
long_description        {*}${description}
homepage                https://www.sheepit-renderfarm.com

checksums               rmd160  7e19d96e910d2f18dcb41e4ab1758729d3416f21 \
                        sha256  427609ac18ca04b104518a80b3b0412f4f7b6e96e6649bc1e0dfd8dcd516aba5 \
                        size    123779265

java.version            11+
java.fallback           openjdk17
use_configure           no

set target_dir          ${prefix}/share/java/sheepitrenderfarm

build.env-append        GRADLE_USER_HOME=${worksrcpath}
build.cmd               ${worksrcpath}/gradlew
build.target            shadowJar

post-build {
    copy ${filespath}/${name}.sh ${worksrcpath}
    reinplace "s|@@JAVA_VERSION@@|${java.version}|g" ${worksrcpath}/${name}.sh
    reinplace "s|@@ICON@@|${applications_dir}/SheepIt.app/Contents/Resources/SheepIt.icns|g" ${worksrcpath}/${name}.sh
    reinplace "s|@@JAR@@|${target_dir}/${name}.jar|g" ${worksrcpath}/${name}.sh
}

app.name                SheepIt
app.executable          ${worksrcpath}/${name}.sh
app.icon                ${worksrcpath}/dmg-wrapper/SheepIt.png

destroot {
    xinstall -d ${destroot}${target_dir}
    xinstall -m 0644 ${worksrcpath}/build/libs/sheepit-client-all.jar \
        ${destroot}${target_dir}/sheepit-client.jar
}
