# $Id: Portfile,v 1.11 2006/05/08 07:17:34 gwright Exp $

PortSystem	1.0
name 		gsl
version		1.8
categories	science
platforms	darwin
maintainers	michaelm@opendarwin.org
description	A numerical library for C and C++ programmers
long_description	\
		The GNU Scientific Library (GSL) is a numerical		\
		library for C and C++ programmers.  It is free software	\
		under the GNU General Public License.			\
									\
		The library provides a wide range of mathematical	\
		routines such as random number generators, special	\
		functions and least-squares fitting. There are over	\
		1000 functions in total.  

master_sites	gnu
checksums	md5 c60a5d193cc6b472496ff191744fc306

# Lower optimization level (-O1) is required to avoid code generation
# bugs in Apple's gcc 3.3 and earlier.
platform darwin 6 7 {
		configure.env	CFLAGS="-O1"
		}

platform darwin 8 {
		configure.env-append    CC=/usr/bin/gcc-4.0	\
					CPP=/usr/bin/cpp-4.0	\
					CXX=/usr/bin/g++-4.0
}

configure.args	--mandir=${prefix}/share/man \
		--infodir=${prefix}/share/info

test.run	yes
test.target	check

variant doc	{ depends_build	port:ghostscript	\
				port:teTeX

		  post-destroot	{ cd ${worksrcpath}
				  system "make dvi"
		  		  cd ${worksrcpath}/doc
				  system "dvipdf gsl-ref.dvi gsl-ref.pdf"
				  xinstall -d -m 755 ${destroot}${prefix}/share/${name}
				  xinstall -c -m 644 ${worksrcpath}/doc/gsl-ref.pdf \
						     ${destroot}${prefix}/share/${name}

				  cd ${worksrcpath}/doc
				  system "latex fftalgorithms && bibtex fftalgorithms"
				  system "latex fftalgorithms && latex fftalgorithms"
				  system "dvipdf fftalgorithms.dvi fftalgorithms.pdf"
				  xinstall -c -m 644 ${worksrcpath}/doc/fftalgorithms.pdf \
						     ${destroot}${prefix}/share/${name}
				  cd ${worksrcpath}
				  system "make html"
				  xinstall -d -m 755 ${destroot}${prefix}/share/${name}/html
				  eval xinstall -c -m 644 [glob ${worksrcpath}/doc/gsl-ref.html/*] \
						     ${destroot}${prefix}/share/${name}/html
		}
}

