# -*- 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           github 1.0
PortGroup           cmake 1.1
PortGroup           muniversal 1.0
PortGroup           legacysupport 1.1

# posix_memalign
legacysupport.newest_darwin_requires_legacy 9

github.setup        potassco clingo 5.7.1 v
categories          math
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             MIT
description         An Answer Set Programming system to ground and solve logic programs.
long_description \
    Clingo is part of the Potassco project for Answer Set Programming (ASP). \
    ASP offers a simple and powerful modeling language to describe combinatorial \
    problems as logic programs. The clingo system then takes such a logic program \
    and computes answer sets representing solutions to the given problem.

homepage            https://potassco.org/clingo/
github.tarball_from archive

checksums           rmd160  cb3624ab5c5d18a396413ab3430b84fbb4fab1e2 \
                    sha256  544b76779676075bb4f557f05a015cbdbfbd0df4b2cc925ad976e86870154d81 \
                    size    5339983

# clingo installs its own version of clasp.
# As of now, it's just the latest release version of clasp, but I guess in theory
# a release version of clingo might require a modified non-release clasp version?
# A fancier setup probably isn't warranted for now because clasp has no dependents.
conflicts           clasp

compiler.cxx_standard   2014
# https://github.com/potassco/clingo/issues/404
compiler.blacklist-append \
                        {clang < 1200}

# TODO: Variants for enabling the python & lua libs.
configure.args-append \
                    -DCLINGO_BUILD_WITH_PYTHON=OFF \
                    -DCLINGO_BUILD_WITH_LUA=OFF

if {${build_arch} in [list i386 ppc] && [string match *gcc* ${configure.compiler}]} {
    configure.ldflags-append -latomic
}

post-destroot {
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} CHANGES.md LICENSE.md README.md \
        ${destroot}${prefix}/share/doc/${name}

    # Install clasp readmes
    xinstall -d -m 0755 ${destroot}${prefix}/share/doc/clasp
    xinstall -m 644 -W ${worksrcpath}/clasp CHANGES LICENSE README.md \
        ${destroot}${prefix}/share/doc/clasp
}
