# -*- 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                cloog
epoch               1
version             0.18.4
revision            5
categories          devel math
platforms           darwin
license             LGPL-2.1+
maintainers         {larryv @larryv}

description         CLooG, the Chunky Loop Generator
long_description    CLooG is a free software and library to generate \
                    code for scanning Z-polyhedra. That is, it finds \
                    a code (e.g. in C, FORTRAN...) that reaches each \
                    integral point of one or more parameterized \
                    polyhedra. CLooG has been originally written to \
                    solve the code generation problem for optimizing \
                    compilers based on the polytope model. \
                    Nevertheless it is used now in various area e.g. \
                    to build control automata for high-level synthesis \
                    or to find the best polynomial approximation of \
                    a function. CLooG may help in any situation where \
                    scanning polyhedra matters. While the user has \
                    full control on generated code quality, CLooG is \
                    designed to avoid control overhead and to produce \
                    a very effective code.
homepage            http://www.cloog.org

depends_lib         port:gmp \
                    port:isl18

master_sites        http://www.bastoul.net/cloog/pages/download/count.php3?url=./
checksums           rmd160  12d7a27442fc95f01f7c6445b5559579f8f614cc \
                    sha256  325adf3710ce2229b7eeb9e84d3b539556d093ae860027185e7af8a8b00a750e \
                    size    4796456

# prevent -L/lib from being added to LDFLAGS
# see https://groups.google.com/group/isl-development/t/37ad876557e50f2c
patchfiles          patch-configure.diff

# Don't link using "-flat_namespace -undefined suppress" on Yosemite and
# later (#45706).
patchfiles-append   yosemite-libtool.patch

configure.args-append   --disable-silent-rules \
                        --with-gmp=system \
                        --with-isl=system \
                        --with-isl_prefix=${prefix}/libexec/isl18 \
                        --with-osl=no

# ensure ${prefix}/bin/cloog does *not* use ${prefix}/lib/libisl.xy.dylib
# if isl port is installed
configure.ldflags-prepend   -L${prefix}/libexec/isl18/lib

variant osl description {Build with OpenScop support (causes tests to fail)} {
    pre-test {
        ui_warn "osl variant causes tests to fail"
    }
    depends_lib-append      port:openscop
    configure.args-replace  --with-osl=no --with-osl=system
}

test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
