# $Id: Portfile 80103 2011-07-04 10:04:14Z jeremyhu@macports.org $
PortSystem        1.0
PortGroup         muniversal 1.0

name              ppl
version           0.11.2

categories        devel math
maintainers       adfernandes openmaintainer
platforms         darwin

description       A modern C++ library providing numerical abstractions

long_description  The Parma Polyhedra Library (PPL) is a modern C++ library \
                  providing numerical abstractions especially targeted at \
                  applications in the field of analysis and verification of \
                  complex systems. The PPL can handle all the convex \
                  polyhedra that can be defined as the intersection of a \
                  finite number of (open or closed) hyperspaces, each \
                  described by an equality or inequality (strict or \
                  non-strict) with rational coefficients. The PPL also \
                  handles restricted classes of polyhedra that offer \
                  interesting complexity/precision tradeoffs. The library \
                  also supports finite powersets of (any kind of) polyhedra \
                  and linear programming problems solved with an \
                  exact-arithmetic version of the simplex algorithm.

homepage          http://www.cs.unipr.it/ppl/
master_sites      ftp://ftp.cs.unipr.it/pub/ppl/releases/${version}/
use_bzip2         yes

license           GPLv3

checksums         md5     c24429e6c3bc97d45976a63f40f489a1 \
                  sha1    915f1d8a7def10e540bf2806babf94dccd15852a \
                  rmd160  68dd335f6e94df09ac4e19ccf08f1c1b280efe86

depends_lib       port:gmp port:glpk

variant gcc43 conflicts gcc44 gcc45 description "Use GCC 4.3 for compilation of PPL" {
    depends_build-append        port:gcc43
    configure.compiler          macports-gcc-4.3
    configure.cflags-append     "-ftree-vectorize -O3 -march=native"
}

variant gcc44 conflicts gcc43 gcc45 description "Use GCC 4.4 for compilation of PPL" {
    depends_build-append        port:gcc44
    configure.compiler          macports-gcc-4.4
    configure.cflags-append     "-ftree-vectorize -O3 -march=native"
}

variant gcc45 conflicts gcc43 gcc44 description "Use GCC 4.5 for compilation of PPL" {
    depends_build-append        port:gcc45
    configure.compiler          macports-gcc-4.5
    configure.cflags-append     "-ftree-vectorize -O3 -march=native"
}

if { ${os.arch} == "i386" } {
    set native_target {i386 x86_64}
} else {
    set native_target {ppc ppc64}
}

if { [variant_isset universal] } {
    configure.cflags-delete -march=native
    configure.args-append   --build=${build_arch}-apple-${os.platform}${os.version}

    foreach arch ${universal_archs_supported} {
        lappend merger_configure_args($arch)    --host=${arch}-apple-${os.platform}${os.version}
    }
    foreach arch ${native_target} {
        lappend merger_configure_cflags($arch)  -march=native
    }
}

platform i386 {
    if { [variant_isset gcc44] || [variant_isset gcc45] } {
        configure.cflags-append    -mno-avx
        configure.cxxflags-append  -mno-avx
    }
}

test.run          yes
test.target       check

livecheck.type    regex
livecheck.url     ${homepage}Download/
livecheck.regex   ${name}-(\[0-9.\]+)\\.tar
