# -*- 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            jupyter-xeus xeus-sqlite 0.9.0
github.tarball_from     archive
revision                0
categories              databases
license                 BSD
maintainers             {mps @Schamschula} openmaintainer
description             xeus-sqlite is a Jupyter kernel for SQL based on the native \
                        implementation of the Jupyter protocol xeus.
long_description        {*}${description}

checksums               rmd160  5246643d2f3423b2bec58802a5f1cea4b3d27a5d \
                        sha256  2efe6f02dd6276778baa433f7045184f177916a3edb0b75beba76c0f3db6477d \
                        size    374991

compiler.cxx_standard   2017

depends_build-append    path:bin/pkg-config:pkgconfig

variant python310 conflicts python311 python312 python313 python314 description {Use Python 3.10} {}
variant python311 conflicts python310 python312 python313 python314 description {Use Python 3.11} {}
variant python312 conflicts python310 python311 python313 python314 description {Use Python 3.12} {}
variant python313 conflicts python310 python311 python312 python314 description {Use Python 3.13} {}
variant python314 conflicts python310 python311 python312 python313 description {Use Python 3.14} {}

if {![variant_isset python310] && ![variant_isset python311] && ![variant_isset python312] && ![variant_isset python314]} {
    default_variants +python313
}

foreach pv {314 313 312 311 310} {
    if {[variant_isset python${pv}]} {
        set python.version ${pv}
        break
    }
}

depends_lib-append      port:nlohmann-json \
                        path:lib/libssl.dylib:openssl \
                        port:sqlite3 \
                        port:sqlitecpp \
                        port:tabulate \
                        port:xeus-zmq \
                        port:xvega \
                        port:xvega-bindings

if {${configure.build_arch} ni [list ppc ppc64]} {
    # It pulls in Rust via one of dependencies, no Rust on PowerPC at the moment.
    # This is not a required dependency for the build.
    depends_lib-append  port:py${python.version}-jupyterlab
}

configure.args-append   -DCMAKE_PREFIX_PATH:PATH=${prefix}/lib/pkgconfig \
                        -Dcppzmq_DIR=${prefix}/share/cmake/cppzmq \
                        -Dnlohmann_json_DIR=${prefix}/share/cmake/nlohmann_json \
                        -DOPENSSL_INCLUDE_DIR=${prefix}/include/openssl \
                        -DOPENSSL_CRYPTO_LIBRARY=${prefix}/lib/libssl.dylib \
                        -DSQLite3_INCLUDE_DIR=${prefix}/include \
                        -DSQLite3_LIBRARY=${prefix}/lib/libsqlite3.dylib \
                        -DSQLiteCpp_DIR=${prefix}/lib/cmake/SQLiteCpp \
                        -Dtabulate_DIR=${prefix}/lib/cmake/tabulate \
                        -Dxeus_DIR=${prefix}/lib/cmake/xeus \
                        -Dxeus-zmq_DIR=${prefix}/lib/cmake/xeus-zmq \
                        -Dxproperty_DIR=${prefix}/lib/cmake/xproperty \
                        -Dxtl_DIR=${prefix}/share/cmake/xtl \
                        -Dxvega_DIR=${prefix}/lib/cmake/xvega \
                        -Dxvega-bindings_DIR=${prefix}/lib/cmake/xvega-bindings \
                        -DZeroMQ_DIR=${prefix}/lib/cmake/ZeroMQ \
                        -DXSQL_DISABLE_ARCH_NATIVE:BOOL=ON

