# $Id: Portfile,v 1.1 2005/10/19 21:17:23 mww Exp $

PortSystem 1.0
name            ntl
version         5.4
categories      math
maintainers     ralf@fimaluka.org
description     NTL: A Library for doing Number Theory
long_description NTL is a high-performance, portable C++ library providing\
                 data structures and algorithms for arbitrary length\
                 integers\; for vectors, matrices, and polynomials over the\
                 integers and over finite fields\; and for arbitrary\
                 precision floating point arithmetic.

homepage		http://shoup.net/ntl/
master_sites    ${homepage}
checksums       md5 1d2a683ecbc12cdf03bf92dbc97c0dd4

depends_build   bin:perl:perl5.8

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

test.run        no

configure.pre_args      "PREFIX=${prefix} DOCDIR=${prefix}/share/doc"
configure.args          "NTL_STD_CXX=on"

worksrcdir      ${name}-${version}/src

destroot.destdir "PREFIX=${destroot}${prefix} DOCDIR=${destroot}${prefix}/share/doc"

platform darwin 8 {
        build.args-append CC=/usr/bin/gcc-3.3 CPP=/usr/bin/cpp-3.3 CXX=/usr/bin/g++-3.3
}

variant gmp {
        depends_lib-append      port:gmp
        configure.args-append   "NTL_GMP_LIP=on GMP_PREFIX=${prefix}"
}

post-destroot {
        system "cd ${destroot}${prefix}/share/doc && mv NTL tmp && mv tmp ntl"
        xinstall -m 0644 ${worksrcpath}/../README \
                         ${destroot}${prefix}/share/doc/${name}
        xinstall -m 0644 ${worksrcpath}/../doc/copying.txt \
                         ${destroot}${prefix}/share/doc/${name}/LICENSE
}
