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

github.setup        coq coq 8.13.2 V
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          lang math
license             LGPL-2.1
maintainers         {pmetzger @pmetzger} openmaintainer

description         Proof assistant for higher-order logic
long_description    Coq is a proof assistant for higher-order logic, \
                    which allows the development of computer programs \
                    consistent with their formal specification. It is \
                    developed using OCaml and Camlp4.
homepage            https://coq.inria.fr/

depends_lib         port:ocaml \
                    port:ocaml-zarith

depends_build       port:ocaml-findlib

checksums           rmd160  72217233c8861e0d4a0219e1108c6c94c38d9ebb \
                    sha256  3ab7414ea22f31845371a5c92225ac09f74fc931b88e15106d9de3094eff535c \
                    size    6952237

configure.pre_args  -prefix ${prefix}
configure.args      -mandir ${prefix}/share/man \
                    -coqdocdir ${prefix}/share/coq/latex \
                    -browser "'open %s'" \
                    -coqide no \
                    -with-doc no
build.target        world

destroot.target     install
destroot.destdir    COQINSTALLPREFIX=${destroot}

test.run            yes
test.target         test-suite

# ocaml is not universal
universal_variant   no

notes "
The style file for LaTeX documentation,\
coqdoc.sty, is in ${prefix}/share/coq/latex.\
Add this to your TEXINPUTS if you wish to\
use it.
"

variant doc description {Build documentation} {
    set pyversion           3.8
    set _pyversion          [string map {. ""} $pyversion]
    depends_build-append    port:hevea \
                            port:netpbm \
                            port:texlive \
                            port:texlive-latex-extra \
                            port:py${_pyversion}-sphinx \
                            port:py${_pyversion}-sphinx_rtd_theme \
                            port:py${_pyversion}-antlr4-python3-runtime \
                            port:py${_pyversion}-beautifulsoup4 \
                            port:py${_pyversion}-sphinxcontrib-bibtex \
                            port:py${_pyversion}-pexpect
    configure.args-delete   -with-doc no
    configure.args-append   -with-doc yes
    configure.env           PATH=${frameworks_dir}/Python.framework/Versions/${pyversion}/bin:$env(PATH)
    build.env               {*}${configure.env}
    #use_parallel_build      no
}

variant coqide description {Install CoqIDE} {
    depends_lib-append      port:lablgtk2
    configure.args-delete   -coqide none
    configure.args-append   -coqide opt
}

github.livecheck.regex  {([0-9.]+)}
