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

name                cvc4
version             1.4
revision            3
categories          math devel
platforms           darwin
maintainers         nomaintainer
description         An automated theorem prover for SMT problems
long_description    CVC4 is a tool for determining the satisfiability of a first order formula \
                    modulo a first order theory (or a combination of such theories). It is the \
                    fourth in the Cooperating Validity Checker family of tools (CVC, CVC Lite, \
                    CVC3) but does not directly incorporate code from any previous version. \
                    \
                    CVC4 is intended to be an open and extensible SMT engine. It can be used \
                    as a stand-alone tool or as a library. It has been designed to increase \
                    the performance and reduce the memory overhead of its predecessors.
license             BSD

homepage            http://cvc4.cs.nyu.edu/
master_sites        http://cvc4.cs.nyu.edu/builds/src/

checksums           rmd160 726f673afe0417bccdde9a2f038da5f642958d15 \
                    sha256 76fe4ff9eb9ad7d65589efb47d41aae95f3191bd0d0c3940698a7cb2df3f7024

depends_lib         port:gmp

boost.depends_type  build
depends_build       path:bin/doxygen:doxygen \
                    bin:curl:curl \
                    bin:bash:bash \
                    bin:awk:gawk

configure.args      --enable-static --enable-shared --with-build=production \
                    --bsd --with-gmp --with-compat \
                    --disable-doxygen-pdf --enable-doxygen-dot \
                    --with-antlr-dir="${worksrcpath}/antlr-3.4" \
                    ANTLR="${worksrcpath}/antlr-3.4/bin/antlr3"

# --enable-language-bindings=c,java
# --with-portfolio
test.run            yes

variant debug description {Build a "debug" copy} {
    configure.args-replace --with-build=production --with-build=debug
}

variant java description {Build Java language bindings} {
    configure.args-append --enable-language-bindings=java \
        JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
    depends_build-append port:swig-java port:swig-tcl
}

pre-configure {
    system "MACHINE_TYPE=`${worksrcpath}/config/config.guess | cut -f1 -d-` ANTLR_CONFIGURE_ARGS=--disable-abiflags ${worksrcpath}/contrib/get-antlr-3.4"
}

post-build {
    system "make -C \"${worksrcpath}\" doc"
}

destroot {
    # strip binaries and libraries
    system "make -C \"${worksrcpath}\" install-strip DESTDIR=\"${destroot}\""
}

post-destroot {
    file mkdir "${destroot}${prefix}/share/doc/${name}/doxygen"
    file copy "${worksrcpath}/doc/doxygen/html" \
          "${destroot}${prefix}/share/doc/${name}/doxygen/html"
    system "make -C \"${worksrcpath}\" install-examples DESTDIR=\"${destroot}\""
}

livecheck.type          regex
livecheck.url           ${master_sites}
livecheck.regex         cvc4-(\[0-9.\]+)\\.tar\\.gz
