# -*- 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        LLNL zfp 4baa4c7eeae8e0b6a7ace4dde242ac165bcd59d9
version             2025.07.10
revision            0
categories          science devel
license             BSD
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         ${name} is a compressed format for representing \
                    multi-dimensional floating-point and integer arrays
long_description    {*}${description}
homepage            https://zfp.llnl.gov

checksums           rmd160  55fd74e369ba7d1f25bc8ed250b04389aeceb58f \
                    sha256  400c016732537f773d9f1462d8f9c244590fdd2a544c890de0c37d0186663a83 \
                    size    562203
github.tarball_from archive

# index.hpp: error: integer constant is too large for ‘unsigned long’ type
compiler.blacklist-append \
                    {clang < 400} *gcc-4.*
compiler.c_standard 1999

configure.args-append \
                    -DBUILD_EXAMPLES=OFF \
                    -DBUILD_TESTING=ON \
                    -DBUILD_UTILITIES=ON \
                    -DZFP_WITH_ALIGNED_ALLOC=OFF \
                    -DZFP_WITH_OPENMP=OFF

variant openmp description {use OpenMP} {
    compiler.openmp_version 3.0

    configure.args-replace \
                    -DZFP_WITH_OPENMP=OFF \
                    -DZFP_WITH_OPENMP=ON

    if {[string match *clang* ${configure.compiler}]} {
        configure.ldflags-append \
                    -L${prefix}/lib/libomp \
                    -lomp
    }
}

# See: https://github.com/LLNL/zfp/issues/205
if {${configure.build_arch} in [list i386 ppc]} {
    configure.args-append \
                    -DZFP_INT64='long long' \
                    -DZFP_INT64_SUFFIX=ll \
                    -DZFP_UINT64='unsigned long long' \
                    -DZFP_UINT64_SUFFIX=ull
}

test.run            yes
# Drop once someone finally removes this from cmake PG:
configure.pre_args-replace \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
                    -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

github.livecheck.branch develop
