# $Id: Portfile 86768 2011-11-03 11:32:02Z ryandesign@macports.org $

PortSystem 1.0

name		opendx
version		4.4.4
revision	3
categories	science
maintainers	gwright
platforms	darwin

description	IBM's Open Visualization Data Explorer
long_description	\
		OpenDX is a uniquely powerful, full-featured software	\
		package for the visualization of scientific,		\
		engineering and analytical data: Its open system design	\
		is built on familiar standard interface environments.	\
		And its sophisticated data model provides users with	\
		great flexibility in creating visualizations.

homepage	http://opendx.org/
master_sites	http://opendx.npaci.edu/source/

checksums	md5 6da0c4cd21d3c08f97b7662e3aee5b7b

distname	dx-${version}

depends_lib	port:netcdf		\
		port:cdf		\
		port:cosmoplayer	\
		port:opendx-java40	\
		port:ImageMagick	\
		path:lib/libXm.dylib:openmotif \
		port:mesa

# cdf is not universal
universal_variant no

patchfiles	configure.ac.diff \
		patch-src-exec-dpexec-packet.c.diff \
		patch-src-exec-dxmods-local.mk.in.diff

use_autoreconf yes
autoreconf.args -fv

if {${os.platform} == "darwin" && ${os.major} >= 9} {
    configure.cppflags-append -D_UINT64 -D_UINT32 -D_UINT16 -D_UINT8
}

variant no_java description "disable java support"	{
		  depends_lib-delete	port:cosmoplayer
		  depends_lib-delete	port:opendx-java40
		  configure.args-delete --with-jni-path=/System/Library/Frameworks/JavaVM.frameworks/Headers
		  configure.args-delete --with-java40jar-path=${prefix}/share/java/java40.jar
		  configure.args-delete --with-cosmojar-path=${prefix}/share/java/npcosmop211.jar
		  configure.args-append	--without-javadx
		}

#
# The configure.env variables are to make sure we use Apple's preinstalled
# java; the kaffe port will not work to build JavaDX.
#
configure.javac         /usr/bin/javac
configure.env-append	JAVA_HOME=/Library/Java/Home	\
		JAVA=/usr/bin/java		\
		JAVAH=/usr/bin/javah		\
		JAVAP=/usr/bin/javap

configure.args	--with-jni-path=/System/Library/Frameworks/JavaVM.framework/Headers	\
		--with-java40jar-path=${prefix}/share/java/java40.jar	\
		--with-cosmojar-path=${prefix}/share/java/npcosmop211.jar

post-destroot	{
		  set fixers [ exec find ${destroot}${prefix} -type f | xargs grep -l /usr/lpp ]
		  foreach fil ${fixers} {
			reinplace "s|/usr/lpp|${prefix}|g" ${fil}
		  }
		}

