PortSystem 1.0

name            zeroc-ice35-java
version         3.5.1
set branch      [join [lrange [split ${version} .] 0 1] .]
categories      java devel
maintainers     nomaintainer
conflicts       zeroc-ice33-java zeroc-ice34-java
license         GPL-2
description     Fast, object-oriented RPC for C++, Java, Python, Ruby, PHP

long_description \
    The Internet Communications Engine (Ice) is a modern alternative to \
    object middleware such as CORBA or COM/DCOM/COM+, with support for \
    C++, C#, Java, PHP, Python, Ruby and Visual Basic. \
    Ice consists of the following packages. \
    Slice: The Specification Language for Ice.  Slice establishes a \
    contract between clients and servers, and is also used to describe \
    persistent data. \
    Slice Compilers: Slice specifications are compiled into various \
    programming languages. Ice supports C++, Java, C#, Visual Basic, PHP, \
    Python and Ruby.  Ice clients and servers work together, regardless \
    of the programming language. \
    Ice: The Ice core library manages all the communication tasks using a \
    highly efficient protocol (including protocol compression and support \
    for both TCP and UDP), provides a flexible thread pool for \
    multi-threaded servers. \
    This Port provides the Java runtime and bindings.

homepage        http://www.zeroc.com/
master_sites    ${homepage}download/Ice/${branch}/
dist_subdir     zeroc-ice35
distname        Ice-${version}
checksums       sha1   63599ea22a1e9638a49356682c9e516b7c2c454f \
                sha256 989e51194c6adadbd156da3288e37bad847b93b3b876502e83033b70493af392

platforms       darwin

depends_lib     port:db46-java \
                port:zeroc-ice35
depends_build   port:apache-ant \
                port:jgoodies-common \
                port:jgoodies-forms \
                port:jgoodies-looks \
                port:proguard

post-patch {
    # Prevent core dumps from mixing Mac OS X's libstdc++.6.dylib
    # on older operating systems, e.g. 10.5.8, with MacPorts'
    # libstdc++.6.dylib from newer libgcc's, e.g. 4.8.1, through
    # the use of DYLD_LIBRARY_PATH being set to ${prefix}, use
    # DYLD_FALLBACK_LIBRARY_PATH instead.  This also have the ant
    # slice task set DYLD_FALLBACK_LIBRARY_PATH instead of DYLD_LIBRARY_PATH.
    system "find ${worksrcpath} -type f -print0 | xargs -0 grep -Z -l DYLD_LIBRARY_PATH | xargs -0 perl -w -p -i -e 's/DYLD_LIBRARY_PATH/DYLD_FALLBACK_LIBRARY_PATH/g'"
}

use_configure   no

set classpath ${prefix}/lib/db46/db.jar:${prefix}/share/java/jgoodies-common.jar:${prefix}/share/java/jgoodies-forms.jar:${prefix}/share/java/jgoodies-looks.jar:${prefix}/share/java/proguard.jar

build.dir       ${worksrcpath}/java
build.env       JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home CLASSPATH=${classpath} "ANT_OPTS=-Djava.awt.headless=true -Xmx512m" ICE_HOME=${prefix}
build.cmd       ant
build.target    clean all

test.run        yes
test.env        JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home CLASSPATH=${classpath} "ANT_OPTS=-Xmx512m -Djava.awt.headless=true" ICE_HOME=${prefix} DYLD_LIBRARY_PATH=${prefix}/lib/db46 USE_BIN_DIST=yes
test.cmd        python
test.target     allTests.py --debug --env

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

    xinstall -d -m 755 ${javadir}
    xinstall -d -m 755 ${docdir}

    foreach f [glob ${build.dir}/lib/*.jar] {
        file copy ${f} ${javadir}/
    }

    foreach f {CHANGES ICE_LICENSE LICENSE RELEASE_NOTES} {
        file copy ${worksrcpath}/${f} ${docdir}
    }

    if {[variant_isset demo_source_code]} {
        file copy ${build.dir}/demo ${docdir}/
    }
}

variant demo_source_code description {Install demonstration Java code} {
}
