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

github.setup        potassco clasp 3.3.10 v
categories          math
maintainers         nomaintainer
license             MIT
description         A conflict-driven nogood learning answer set solver
long_description \
    clasp is an answer set solver for (extended) normal logic programs. \
    It combines the high-level modeling capacities of answer set programming \
    with state-of-the-art techniques from the area of Boolean constraint solving. \
    The primary clasp algorithm relies on conflict-driven nogood learning, \
    a technique that proved very successful for satisfiability checking (SAT).
homepage            https://potassco.org/clasp/
github.tarball_from releases
distname            ${name}-${version}-source

# clingo installs its own clasp.
conflicts           clingo

worksrcdir          ${name}-${version}

checksums           rmd160  57e56740e6757767556c7684eca26142211fb806 \
                    sha256  6decd6821e1c17929c51c525cf170a7daf4a118b4f16786b9f110ab67d4e4ec7 \
                    size    939089

compiler.cxx_standard   2011

# https://github.com/potassco/clasp/issues/95
if {[string match *gcc* ${configure.compiler}] && (${configure.build_arch} in [list i386 ppc])} {
    configure.ldflags-append \
                        -latomic
}

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

variant tests description "Enable testing" {
    configure.args-append \
                    -DCLASP_BUILD_TESTS=ON
    test.run        yes
}
