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

name                swi-prolog-devel
conflicts           swi-prolog
epoch               20051223
version             9.3.7
revision            0

categories          lang
universal_variant   no
license             BSD
maintainers         {swi-prolog.org:jan @JanWielemaker} openmaintainer

description         SWI-Prolog compiler plus extra packages (development version)
long_description    ISO/Edinburgh-style Prolog compiler including modules, \
                    autoload, libraries, Garbage-collector, stack-expandor, \
                    C/C++-interface, Multiple threads, GNU-readline interface, \
                    coroutining, constraint programming, global variables, \
                    very fast compiler. Including packages clib (Unix process \
                    control, sockets, MIME), cpp (C++ interface), sgml (reading \
                    XML/SGML), sgml/RDF (reading RDF into triples), ODBC \
                    interface and XPCE (Graphics UI toolkit, integrated editor \
                    (Emacs-clone) and graphical debugger).

homepage            https://www.swi-prolog.org/
master_sites        https://www.swi-prolog.org/download/devel/src/

distname            swipl-${version}
dist_subdir         swi-prolog

checksums           rmd160  57510638c53a333132033df69cc3ae125c13ff1f \
                    sha256  ee557317543ac5934a703f2c9d79d60a9a1e6fcbd0fe8bf6034a5afccd9754e1 \
                    size    12282836

depends_build-append \
                    port:pkgconfig

depends_lib-append  port:db62 \
                    port:gmp \
                    port:gperftools \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:libarchive \
                    port:libmcrypt \
                    port:ncurses \
                    port:ossp-uuid \
                    port:pcre2 \
                    port:readline \
                    port:Xft2 \
                    port:xorg-libXinerama \
                    port:xorg-libXt \
                    port:xpm \
                    port:libyaml \
                    port:zlib \
                    port:python312

compiler.c_standard 2011
compiler.cxx_standard 2017
compiler.thread_local_storage yes

configure.cmd       cmake
cmake.generator     Ninja
configure.pre_args  -DCMAKE_INSTALL_PREFIX=${prefix} \
                    -DCMAKE_BUILD_TYPE=Release \
                    -DCMAKE_INCLUDE_PATH=${prefix}/include \
                    -DCMAKE_LIBRARY_PATH=/usr/lib:${prefix}/lib \
                    -DSWIPL_PACKAGES_QT=OFF \
                    -DCPYTHON_VERSION="3.12\;EXACT"

variant qt5 description {Add Qt5 GUI} {
    depends_lib-append          port:qt5-qtbase
    configure.pre_args-delete   -DSWIPL_PACKAGES_QT=OFF
}

post-destroot {
    if {[variant_isset qt5]} {
        move ${destroot}/${prefix}/swipl-win.app ${destroot}${applications_dir}
    }
}

test.run            yes
test.cmd            ctest --output-on-failure

livecheck.type      regex
livecheck.url       ${homepage}download/devel/src
livecheck.regex     "swipl-(\\d+\\.\\d+\\.\\d+).tar.gz"
