Portfile

# $Id: Portfile 22237 2007-02-23 06:38:46Z pguyot@kallisys.net $

PortSystem 1.0

name aquaterm
version 1.0.1
revision 0
categories aqua math science
maintainers davidm@astro.berkeley.edu
description AquaTerm is a viewer that displays vector graphics on Mac OS X
long_description AquaTerm is a viewer app that displays vector \
graphics. Other apps connect to AquaTerm using a \
simple remote object messaging protocol. By adding \
"adapters" to legacy code very little coding is \
needed to bring it to OS X.
platforms darwin
homepage http://aquaterm.sourceforge.net/
master_sites sourceforge
distname ${name}_src.${version}
checksums md5 aquaterm_src.1.0.1.tar.gz e9d3ecdfe770d6f09a748add9886d1a9 \
sha1 aquaterm_src.1.0.1.tar.gz d5770bb3a95cfae21c5c39c96171a52d9af8ae24 \
rmd160 aquaterm_src.1.0.1.tar.gz 24410589dd8c3071b6e0d5e652b7d92933d86b5f
worksrcdir .

patch {
# Change default location of AquaTerm.app to avoid requiring the
# use of AQUATERM_PATH.
reinplace "s|AquaTerm.app|MacPorts/AquaTerm.app|g" \
${workpath}/aquaterm/AQTClientManager.m
}

configure {
cd ${workpath}/${name}
reinplace "s|/Users/per/Documents/Source/aquaterm/||" \
AquaTerm.pbproj/project.pbxproj
reinplace "s|/tmp/AquaTerm.dst||" \
AquaTerm.pbproj/project.pbxproj
reinplace "s|/usr/local/lib|${prefix}/lib|" \
AquaTerm.pbproj/project.pbxproj
file mkdir build/include
system "ln -s ../.. build/include/aquaterm"

cd ${workpath}/adapters
reinplace "s|/usr/local|${prefix}|g" \
pgplot/ChangeLog pgplot/g77_gcc_AQT.conf pgplot/xlf_gcc_AQT.conf
reinplace "s|\$(HOME)|${prefix}|g" \
c/Makefile fortran/Makefile
reinplace "s|/*|${prefix}|g" \
pgplot/g77_cc_AQT.conf pgplot/g77_gcc_AQT.conf pgplot/xlf_gcc_AQT.conf
reinplace "s|/sw|${prefix}|g" \
pgplot/ReadMe
}

set xcodebuilddir build

platform darwin 7 {
post-extract {
cd ${workpath}/${name}
file link -symbolic AquaTermFwk-Info.plist AquaTerm.framework-Info.plist
}
}

platform darwin 8 {
if {$xcodeversion == "2.1"} {
set xcodebuilddir build/Deployment
}
}

build.type pbx
build.dir ${workpath}/${name}
build.target -buildstyle Deployment -target AquaTerm
post-build {
system "install_name_tool -id ${prefix}/lib/libaquaterm.1.dylib \
${workpath}/${name}/${xcodebuilddir}/AquaTerm.framework/Versions/Current/AquaTerm"
system "install_name_tool -change /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm ${prefix}/lib/libaquaterm.1.dylib \
${workpath}/${name}/${xcodebuilddir}/AquaTerm.app/Contents/MacOS/AquaTerm"
}

destroot {
cd ${workpath}/${name}
xinstall -d -m 0755 ${destroot}${prefix}/include/${name}
xinstall -m 0644 AQTAdapter.h aquaterm.h \
${destroot}${prefix}/include/${name}

cd ${workpath}/${name}/${xcodebuilddir}
system "ln AquaTerm.framework/Versions/Current/AquaTerm libaquaterm.${version}.dylib"
xinstall -m 0755 libaquaterm.${version}.dylib ${destroot}${prefix}/lib
system "ln -s libaquaterm.${version}.dylib \
${destroot}${prefix}/lib/libaquaterm.dylib"
system "ln -s libaquaterm.${version}.dylib \
${destroot}${prefix}/lib/libaquaterm.1.dylib"
xinstall -d -m 0755 ${destroot}/Applications/MacPorts
system "cp -R AquaTerm.app ${destroot}/Applications/MacPorts"
xinstall -d -m 0755 ${destroot}/Library/Frameworks
system "cp -R AquaTerm.framework ${destroot}/Library/Frameworks"

cd ${workpath}/adapters
xinstall -d -m 0755 ${destroot}${prefix}/share/${name}
system "cp -R c fortran gnuplot pgplot plplot \
${destroot}${prefix}/share/${name}"
}