# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                rhino
version             1.7R2
revision            1
license             MPL-1.1 GPL-2
categories          lang java devel
platforms           darwin freebsd openbsd
homepage            http://www.mozilla.org/rhino/
supported_archs     noarch
platforms           any

maintainers         nomaintainer
description         Mozilla JavaScript engine for Java

long_description    Rhino is an open-source implementation of JavaScript \
                    written entirely in Java. It is typically embedded into \
                    Java applications to provide scripting to end users.

master_sites        http://ftp.mozilla.org/pub/mozilla.org/js/ \
                    http://ftp.mozilla.org/pub/mozilla.org/js/older-packages/

distname            ${name}[string map {. _} $version]
use_zip             yes

depends_lib         bin:java:kaffe

use_configure       no

build               {}

checksums           md5     40d0a9abec8169e42920214b37fa8e0e \
                    sha1    3bb380cfb7f6febb87a64b2dee7fa308042f37e4 \
                    rmd160  58ae321829ac701e442bfbfed3d6f87b2bb6ba4c

livecheck.type      regex
livecheck.url       http://www.mozilla.org/rhino/download.html
livecheck.regex     {Rhino (\d+\.\d+(:?\D+\d))}

test.run            yes
test.cmd            java
test.target         -jar js.jar

destroot {
    set javadir ${destroot}${prefix}/share/java/${name}
    set docdir ${destroot}${prefix}/share/doc/${name}
    set examplesdir ${destroot}${prefix}/share/examples/${name}

    xinstall -m 755 -d ${javadir} ${docdir} ${examplesdir}
    xinstall -m 644 -W ${worksrcpath} js.jar js-14.jar ${javadir}

    xinstall -m 755 ${filespath}/${name} ${destroot}${prefix}/bin/${name}
    reinplace "s|__PREFIX__|${prefix}|" ${destroot}${prefix}/bin/${name}

    copy ${worksrcpath}/javadoc ${docdir}
    copy ${worksrcpath}/examples ${examplesdir}
}
