# -*- 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
PortGroup           openssl 1.0

# Commit-based until next release due to:
# https://github.com/stephenberry/glaze/issues/1675
# https://github.com/stephenberry/glaze/issues/2155
# https://github.com/stephenberry/glaze/issues/2164
github.setup        stephenberry glaze 63ebd02666d0536fa87f0fae66b8b09bd1b730e4
version             6.2.0
revision            0
categories          devel
license             MIT
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
description         One of the fastest JSON libraries in the world
long_description    {*}${description}
checksums           rmd160  eb474d3d0e9a46610a46255774a65454a72dade8 \
                    sha256  1b079a802b2bbf83bae108ec9874f0c367d6deed4579af74854c43456bbdb257 \
                    size    1089612
github.tarball_from archive

patchfiles          patch-fix-no-asan.diff

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

depends_lib-append  path:share/pkgconfig/asio.pc:asio \
                    path:share/pkgconfig/eigen3.pc:eigen3 \
                    port:erlang

compiler.cxx_standard   2023

configure.args-append \
                    -Dglaze_BUILD_EXAMPLES=OFF \
                    -Dglaze_DISABLE_SIMD_WHEN_SUPPORTED=OFF \
                    -Dglaze_EETF_FORMAT=ON \
                    -Dglaze_ENABLE_SSL=ON \
                    -Dglaze_USE_BUNDLED_ASIO=OFF \
                    -DFETCHCONTENT_UPDATES_DISCONNECTED_EIGEN3=ON

# ___atomic_fetch_add_8, ___atomic_load_8
if {[string match *gcc* ${configure.compiler}] && ${configure.build_arch} in [list arm i386 ppc]} {
    configure.ldflags-append \
                    -latomic
}

# FIXME: 3 tests fail: https://github.com/stephenberry/glaze/issues/2167
test.run            yes
