Portfile

# $Id: Portfile 23024 2007-03-22 11:03:21Z takanori@macports.org $

PortSystem 1.0
name octave
version 2.9.9
revision 5
categories math science
maintainers andre@splunk.com
platforms darwin
description a Matlab-like environment for numerical analysis
long_description \
Octave provides a convenient command line interface \
for solving linear and nonlinear problems numerically, \
using a language that is mostly compatible with Matlab. \
It is easily extensible and customizable via \
user-defined functions or using dynamically loaded \
modules written in e.g. C++, C or Fortran.

homepage http://www.octave.org
master_sites ftp://ftp.octave.org/pub/octave/bleeding-edge/

use_bzip2 yes
checksums md5 a76a6d88f414285472896a63e4282b7f

patch.args -p1
patchfiles patch-configure patch-configure-2 patch-configure-3 \
patch-dynamic-ld-cc patch-glpk patch-glpk.m

depends_build bin:texinfo:texinfo \
bin:tex:teTeX

depends_lib port:readline \
port:hdf5 \
port:fftw-3 \
port:metis \
port:SuiteSparse \
port:pcre \
port:glpk \
port:gnuplot

configure.env CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-L${prefix}/lib" \
CPPFLAGS="-I${prefix}/include"

configure.args --enable-shared \
--enable-dl \
--disable-static \
--with-hdf5 \
--with-fftw \
--without-mpi \
--with-blas="-framework Accelerate"

post-patch {
# Avoid using heimdal's broken fnmatch.h
reinplace "s|<\\(fnmatch\.h\\)>|\"/usr/include/\\1\"|" ${worksrcpath}/liboctave/glob-match.cc
}

pre-destroot {
file copy ${worksrcpath}/src/defaults.h ${worksrcpath}/src/defaults.h.tmp
file copy ${worksrcpath}/src/oct-conf.h ${worksrcpath}/src/oct-conf.h.tmp
}
destroot.destdir prefix=${destroot}${prefix}
post-destroot {
file rename -force ${worksrcpath}/src/defaults.h.tmp ${destroot}${prefix}/include/${name}-${version}/${name}/defaults.h
file rename -force ${worksrcpath}/src/oct-conf.h.tmp ${destroot}${prefix}/include/${name}-${version}/${name}/oct-conf.h
}

platform powerpc {
if {![variant_isset g95]} {
depends_lib-append port:gcc40
configure.env-append F77="gfortran-dp-4.0"
}
}

platform i386 {
if {![variant_isset g95]} {
depends_lib-append port:gcc42
configure.env-append F77="gfortran-dp-4.2"
configure.env-append CC="gcc-dp-4.2"
configure.env-append CXX="g++-dp-4.2"
}
}

default_variants +test
variant test { depends_build-append bin:runtest:dejagnu
test.run yes
test.target check
}

variant ptex {
depends_build-delete bin:tex:teTeX
depends_build-append bin:tex:pTeX
}

variant g95 {
depends_lib-append port:g95
configure.env-append F77="${prefix}/bin/g95" FFLAGS=-O2 MACOSX_DEPLOYMENT_TARGET=10.4
}

files