# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           muniversal 1.0

name                ppl
version             1.2
categories          devel math
platforms           darwin
license             GPL-3+
maintainers         nomaintainer

description         Parma Polyhedra Library
long_description    The Parma Polyhedra Library (PPL) provides numerical \
                    abstractions especially targeted at applications in \
                    the field of analysis and verification of complex \
                    systems. These abstractions include convex polyhedra, \
                    some special classes of polyhedra shapes that offer \
                    interesting complexity/precision tradeoffs, and grids \
                    which represent regularly spaced points that satisfy \
                    a set of linear congruence relations. The library \
                    also supports finite powersets and products of \
                    polyhedra and grids, a mixed integer linear \
                    programming problem solver using an exact-arithmetic \
                    version of the simplex algorithm, a parametric integer \
                    programming solver, and primitives for termination \
                    analysis via the automatic synthesis of linear ranking \
                    functions.

homepage            http://www.bugseng.com/parma-polyhedra-library
master_sites        http://www.bugseng.com/products/ppl/download/ftp/releases/${version} \
                    ftp://ftp.cs.unipr.it/pub/ppl/releases/${version} \
                    http://www.bugseng.com/products/ppl/download/ftp/snapshots
use_xz              yes
checksums           rmd160  14ebefdd9cf3cfc179252462aafbcf29405ae558 \
                    sha256  691f0d5a4fb0e206f4e132fc9132c71d6e33cdda168470d40ac3cf62340e9a60

depends_build       port:m4
depends_skip_archcheck-append m4

depends_lib         port:glpk port:gmp

patchfiles-append   clang5.patch

# Generate a newer libtool that passes -stdlib when linking dylibs.
use_autoreconf          yes
autoreconf.post_args    --force

compiler.blacklist-append   gcc-3.3 gcc-4.0 apple-gcc-4.0
compiler.fallback-append    apple-gcc-4.2

# TODO: Enable other interfaces via subports.
configure.args      --enable-interfaces='cxx c' \
                    ac_cv_prog_AWK=/usr/bin/awk

if {[regexp clang|llvm ${configure.compiler}]} {
    # As of 'ppl-0.12.1', we need to be careful about use of the
    # '--enable-fpmath' flag! Newer versions of 'clang' will error about
    # '-frounding-math' being unsupported due to '-Werror'. Older
    # versions of 'clang' will just warn about '-frounding-math' despite
    # '-Werror'. And 'llvm-gcc' does not '-frounding-math' and silently
    # ignores it.
    configure.args-append   --enable-fpmath=no
    configure.ccache        no
    configure.distcc        no
}

test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       http://www.bugseng.com/products/ppl/download/ftp/releases/
livecheck.regex     {([\d.]+)/}
