# $Id

PortSystem 1.0
name		octave-forge
version		20080507
revision	1
categories	math science
maintainers     nomaintainer
platforms	darwin
description     Additional script and function files for Octave.
long_description	\
		The GNU Octave Repository is a central location for the   \
		the collaborative development of packages for GNU Octave. \
		The The octave-forge package contains the source for all  \
		the the functions plus build and install scripts.

homepage	http://octave.sourceforge.net/
master_sites	sourceforge:octave
distfiles		${name}-bundle-${version}${extract.suffix}
worksrcdir		${name}-bundle-${version}

checksums	\
			octave-forge-bundle-20080507.tar.gz \
				md5  ef7cb19e8b18281f09ad2501f6861f03 \
				sha1  4aabe85fd96364f99f8e6b56d5c798550edddbbb \
				rmd160  ff627c67ab33be53c10228907219396a03cb69f3

depends_lib	port:ginac	\
		port:gsl	\
		port:jpeg	\
		port:libpng	\
		port:octave

patch	{
	# touch extra/mex/NOINSTALL because it's already in octave 2.9.9
#	close [open "${worksrcpath}/extra/mex/NOINSTALL" w]

	# touch extra/Windows/NOINSTALL for hopefully obvious reasons :-)
#gepp	close [open "${worksrcpath}/extra/Windows/NOINSTALL" w]
}

configure.args	--enable-shared	\
		--enable-dl	\
		--disable-static \
		--infodir=${prefix}/share/info \
		--mandir=${prefix}/share/man \
                --with-mpath=${prefix}/share/octave-forge/m \
                --with-opath=${prefix}/share/octave-forge/oct

platform powerpc {
	if {![variant_isset g95]} {
		depends_lib-append	port:gcc40
		configure.f77	"${prefix}/bin/gfortran-mp-4.0"
	}
}
platform i386 {
	if {![variant_isset g95]} {
		depends_lib-append	port:gcc42
		configure.compiler	macports-gcc-4.2

		post-patch {
			reinplace "s|-ObjC|-x objective-c|" \
				"${worksrcpath}/extra/MacOSX/Makefile"
		}
	}
}

default_variants +test
variant test	{ test.run	yes
		  test.target	check
		}

variant g95 {
	depends_lib-append port:g95
	configure.f77	"${prefix}/bin/g95"
	configure.cc	"/usr/bin/cc"
	configure.cxx	"/usr/bin/c++"
}