# -*- 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            java-decompiler jd-gui 1.6.6 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball

categories              java devel
supported_archs         x86_64
license                 GPL-3
maintainers             nomaintainer

description             JD-GUI, a standalone graphical utility that displays Java sources from CLASS files
long_description        JD-GUI is a standalone graphical utility that displays Java source codes of ".class" \
                        files. You can browse the reconstructed source code with the JD-GUI for instant access \
                        to methods and fields.

homepage                http://java-decompiler.github.io/

checksums               rmd160  dd396d140545793cb1c166f7206252b7085499d3 \
                        sha256  606fd8e2c339faaa0cec72c855a550fd2131445c9a884fc9f2fed96071b5aa97 \
                        size    365626
                        
java.version            1.8+
java.fallback           openjdk11

use_configure           no
universal_variant       no

patchfiles              macos-only.diff \
                        jdk13-compat.diff

variant nativedialogs description {Enable experimental support for macOS native dialogs} {
    pre-patch {
        file mkdir ${worksrcpath}/app/src/main/java/org/jd/gui/util/io/
        file mkdir ${worksrcpath}/app/src/main/java/org/jd/gui/util/sys/
        file copy ${filespath}/FileUtils.java   ${worksrcpath}/app/src/main/java/org/jd/gui/util/io/
        file copy ${filespath}/SystemUtils.java ${worksrcpath}/app/src/main/java/org/jd/gui/util/sys/
        file copy ${filespath}/FileChooser.java ${worksrcpath}/app/src/main/java/org/jd/gui/view/component/  
    }
    patchfiles-append   native-dialogs.diff
}

depends_build-append    port:gradle \
                        port:proguard

build.env-append        GRADLE_USER_HOME=${worksrcpath}
build.cmd               ${prefix}/bin/gradle
build.args              --no-daemon --console=plain --stacktrace -p ${worksrcpath}
build.target            clean installOsxDist

destroot {
    copy ${worksrcpath}/build/install/${name}-osx/JD-GUI.app ${destroot}${applications_dir}
}
