PortSystem          1.0
PortGroup           java 1.0

name                jmol
version             14.31.44
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          science
platforms           any
maintainers         {@p-bro web.de:p.bro} openmaintainer
supported_archs     noarch

description         An open-source Java viewer for chemical structures in 3D
long_description    Jmol is a free, open source molecule viewer for \
                    students, educators, and researchers in chemistry and \
                    biochemistry. \
                    \
                    This port only installs the Jmol application, not the \
                    applet or developer version. If you want to use it, \
                    please download it from the Jmol homepage.

license             LGPL-2.1+
homepage            http://jmol.sourceforge.net/
master_sites        sourceforge:project/jmol/Jmol/Version%20${branch}/Jmol%20${version}

distname            Jmol-${version}-binary

checksums           rmd160  592df22677e2403b9e6d1fb721c99880c61fe098 \
                    sha256  3077eaa10cd410bee78deed8fe16da03c8a4b717cdef8eb84c95ee9b907a3827 \
                    size    58119083

worksrcdir          ${name}-${version}

java.version        1.4+
java.fallback       openjdk8

use_configure       no

post-patch {
    reinplace "s|/usr/share/jmol/|${prefix}/share/java/jmol/|g" \
        ${worksrcpath}/jmol
}

build {}

destroot {
    # install the jmol script:
    xinstall ${worksrcpath}/jmol ${destroot}${prefix}/bin
    # install the jmol java files:
    xinstall -d ${destroot}${prefix}/share/java/jmol
    foreach jar [glob ${worksrcpath}/*.jar] {
        xinstall $jar ${destroot}${prefix}/share/java/jmol
    }
    # install doc files:
    xinstall -d ${destroot}${prefix}/share/doc/jmol-${version}
    foreach doc {CHANGES.txt COPYRIGHT.txt LEAME.txt LICENSE.txt README.txt} {
        xinstall ${worksrcpath}/$doc \
                 ${destroot}${prefix}/share/doc/jmol-${version}
    }
}

livecheck.type      sourceforge
livecheck.url       http://sourceforge.net/projects/jmol/files/
livecheck.regex     {Jmol-(\d+[0-9a-zA-Z._]+)}
