# -*- 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
PortGroup           cmake 1.1
PortGroup           github 1.0

boost.version       1.81

# 0.8.1 release assumes an old version of catch2
github.setup        arximboldi immer 8eb082e26d19ba6a8622daef7d350825b695f6af
version             2026.01.14
revision            0
categories          devel
platforms           any
license             Boost-1
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         ${name} is a library of persistent and immutable data structures
long_description    {*}${description}, written in C++.
homepage            https://sinusoid.es/${name}
checksums           rmd160  b453d81138b11252046ea33a60554ff00112f196 \
                    sha256  5ad8d5a1fc25bae9995bc7e2ec12f6c5ba82ded733217111de0f22ca94ff4b6a \
                    size    747990
github.tarball_from archive
supported_archs     noarch

set libfmt_v        11
cmake.prefix_path-append \
                    ${prefix}/lib/libfmt${libfmt_v}/cmake

# Library itself is header-only.
depends_build-append \
                    port:boehmgc \
                    port:catch2 \
                    port:libfmt${libfmt_v} \
                    path:bin/pkg-config:pkgconfig

configure.args-append \
                    -DDISABLE_FREE_LIST=off \
                    -DDISABLE_THREAD_SAFETY=off \
                    -DDISABLE_WERROR=off \
                    -DENABLE_BOOST_COROUTINE=on \
                    -DENABLE_COVERAGE=off \
                    -DENABLE_GUILE=off \
                    -DENABLE_PYTHON=off \
                    -Dimmer_BUILD_DOCS=off \
                    -Dimmer_BUILD_EXAMPLES=off \
                    -Dimmer_BUILD_EXTRAS=off \
                    -Dimmer_BUILD_PERSIST_TESTS=off \
                    -Dimmer_BUILD_TESTS=on \
                    -Dimmer_INSTALL_FUZZERS=off

# At the moment fiber/coroutine libs are broken on powerpc64-apple-darwin9.
if {${configure.build_arch} eq "ppc64"} {
    configure.args-replace \
                    -DENABLE_BOOST_COROUTINE=on -DENABLE_BOOST_COROUTINE=off
}

# https://github.com/arximboldi/immer/issues/308
configure.cppflags-append \
                    -I${prefix}/include/libfmt${libfmt_v}
configure.ldflags-append \
                    -L${prefix}/lib/libfmt${libfmt_v} -lfmt

compiler.cxx_standard  2014

# Some tests fail: https://github.com/arximboldi/immer/issues/309
# 97% tests passed, 3 tests failed out of 86
test.run            yes
test.target         check
