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

# Ironically, not blosc2 at all now...
name                blosc2
github.setup        Blosc c-${name} 3.3.4 v
revision            0
categories          archivers devel
license             BSD

maintainers         {stromnov @stromnov} openmaintainer

description         fast, compressed, persistent binary data store library
long_description    A {*}${description}.

homepage            https://www.blosc.org

checksums           rmd160  b9ca884a403918fa8474aad188473df0cc91b9ba \
                    sha256  db6ba3ee4f863a3c15794fbba99a4e5704d6a01017799628546152c8f4b06818 \
                    size    1969023
github.tarball_from archive

depends_lib-append  port:lz4 \
                    port:zlib \
                    port:zstd

configure.args-append \
                    -DBUILD_BENCHMARKS:BOOL=OFF \
                    -DBUILD_EXAMPLES:BOOL=OFF \
                    -DBUILD_PLUGINS:BOOL=ON \
                    -DPREFER_EXTERNAL_LZ4:BOOL=ON \
                    -DPREFER_EXTERNAL_ZLIB:BOOL=ON \
                    -DPREFER_EXTERNAL_ZSTD:BOOL=ON

# b2nd.h:585: error: wrong number of arguments specified for ‘deprecated’ attribute
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2 {clang < 900}

# https://trac.macports.org/ticket/67478
platform darwin {
    if {${os.major} < 11 && [string match *gcc* ${configure.compiler}]} {
        configure.args-append \
                    -DDEACTIVATE_AVX2:BOOL=ON \
                    -DDEACTIVATE_AVX512:BOOL=ON
    }
}

if {${build_arch} in [list ppc ppc64]} {
    configure.args-append \
                    -DDEACTIVATE_AVX2:BOOL=ON \
                    -DDEACTIVATE_AVX512:BOOL=ON
}

test.run            yes
