# -*- 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               boost 1.0

# Match soplex
boost.version           1.81

name                    TOPCOM
version                 1.1.2
revision                1

categories              math
license                 GPL-2+

maintainers             nomaintainer

homepage                https://www.wm.uni-bayreuth.de/de/team/rambau_joerg/TOPCOM/
description             Triangulations Of Point Configurations and Oriented Matroids
long_description        {*}${description}

master_sites            https://www.wm.uni-bayreuth.de/de/team/rambau_joerg/TOPCOM-Downloads/
extract.suffix          .tgz
distfiles               ${name}-[string map {. _} ${version}]${extract.suffix}

checksums               rmd160  145443b533690b34529475661b58703d5be0011e \
                        sha256  4fb10754ee5b76056441fea98f2c8dee5db6f2984d8c14283b49239ad4378ab6 \
                        size    7924000

worksrcdir              topcom-${version}

patchfiles              system-cddlib-qso.diff

compiler.cxx_standard   2017
configure.cxxflags-append -std=c++17

# error: 'shared_mutex' is unavailable: introduced in macOS 10.12
if {${os.platform} eq "darwin" && ${os.major} < 16} {
    # lucky me I may simple replaces std::shared_mutex to boost::shared_mutex
    # anyway, it requires to link against boost_thread-mt
    patchfiles-append   boost-shared-mutex.diff
    configure.ldflags-append \
                        -lboost_thread-mt
}

use_autoreconf          yes
autoreconf.args         -fvi

depends_lib-append      port:bzip2 \
                        port:cddlib \
                        port:gmp \
                        port:libpapilo \
                        port:QSopt_ex \
                        port:soplex

configure.args          --enable-soplex \
                        --enable-qsoptex

# /opt/local/include/papilo/misc/tbb.hpp: fatal error:
# tbb/blocked_range.h: No such file or directory
depends_build-append    port:onetbb
configure.cppflags-append \
                        -I${prefix}/libexec/onetbb/include

livecheck.type          regex
livecheck.regex         "Download ${name}-(\[\\d.\]+)"
livecheck.url           https://www.wm.uni-bayreuth.de/de/team/rambau_joerg/TOPCOM-Downloads/index.html
