Portfile

# $Id: Portfile 22848 2007-03-16 18:00:48Z takanori@macports.org $

PortSystem 1.0
name gsl
version 1.9
categories science
platforms darwin
maintainers nomaintainer@macports.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 81dca4362ae8d2aa1547b7d010881e43 \
sha1 7541504ed9864b1a278f9392830ecac9e0146258 \
rmd160 faca66d02876135c31c2f3585baa1931488e1593

# 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
}
}