# -*- 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.1

name                isl
conflicts           isl-devel

# for library name changes, cross-compilers do *not* show up in traditional dependency searches
# (e.g. port file all | sort -u | xargs grep -E ':isl( |$)' | cut -d / -f 13 | sort -u)
# see https://lists.macports.org/pipermail/macports-dev/2019-May/040678.html
epoch               4
version             0.24
revision            1

categories          devel math
license             MIT
maintainers         {mcalhoun @MarcusCalhoun-Lopez} openmaintainer

description         Integer Set Library
long_description    isl is a library for manipulating sets and \
                    relations of integer points bounded by linear \
                    constraints. Supported operations on sets include \
                    intersection, union, set difference, emptiness \
                    check, convex hull, (integer) affine hull, integer \
                    projection, computing the lexicographic minimum \
                    using parametric integer programming, coalescing \
                    and parametric vertex enumeration. It also \
                    includes an ILP solver based on generalized basis \
                    reduction, transitive closures on maps (which may \
                    encode infinite graphs), dependence analysis and \
                    bounds on piecewise step-polynomials.
homepage            https://libisl.sourceforge.io

depends_lib         port:gmp

master_sites        sourceforge:libisl
use_bzip2           yes

checksums           rmd160  b3bf8e1ad50207d4eebecc47cb4cffdac6581a57 \
                    sha256  fcf78dd9656c10eb8cf9fbd5f59a0b6b01386205fe1934b3b287a0a1898145c0 \
                    size    2261594

configure.args      --disable-silent-rules

triplet.add_build   cross

test.run            yes
test.target         check

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

if {${subport} eq ${name}} {
    # be more strict about detecting C++11 for older compilers
    patchfiles-append   patch-configure_c++11.diff

    # ./include/isl/typed_cpp.h:2132:12: error: no matching conversion for functional-style cast from 'const isl::basic_set' to 'isl::typed::basic_set<>'
    compiler.blacklist {clang < 500}
}

subport isl14 {
    epoch           0
    version         0.14.1
    revision        0

    checksums       rmd160  e4e45a8b777f89108303c165b149404ef84fd190 \
                    sha256  1f20561843eb9f6ae2076800bc45f3680ff7696520257cd5734ccfb843464cae \
                    size    1402630

    distname       isl-${version}

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

    configure.pre_args  --prefix=${prefix}/libexec/${subport}

    livecheck.regex     isl-([join [lrange [split ${version} .] 0 2] .]\[0-9.\]*)${extract.suffix}
}

subport isl18 {
    epoch           0
    version         0.18
    revision        0

    checksums           rmd160  e876f1049893de5be4a82a63f272f62547d455ca \
                        sha256  6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b \
                        size    1658291

    distname            isl-${version}

    # Add a missing include to the isl_int headers. Upstream doesn't want to
    # bother fixing deprecated APIs
    # (https://groups.google.com/d/msg/isl-development/N6UWJDbKXNA/2CY6WHDvOYoJ),
    # so this should be applied until they remove the headers outright.
    patchfiles          fix-deprecated-headers.patch

    configure.pre_args  --prefix=${prefix}/libexec/${subport}

    livecheck.regex     isl-([join [lrange [split ${version} .] 0 2] .]\[0-9.\]*)${extract.suffix}
}
