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

name                py-blosc2
version             4.1.2
revision            0

categories-append   archivers devel
maintainers         nomaintainer
license             BSD

description         Python wrapper for Blosc2
long_description    A Python wrapper for the extremely fast Blosc2 \
                    compression library

homepage            https://pypi.python.org/pypi/blosc2/

checksums           rmd160 733c89366fd4e4d780d1648c704b1e818383897a \
                    sha256 c127342d976de44fee242137e83660097e0b072779f4164a34e149ac9f693c8a \
                    size 4341120

python.versions     310 311 312 313 314

python.pep517_backend scikit

if {$subport ne $name} {
    depends_build-append \
                        port:py${python.version}-cython \
                        port:py${python.version}-oldest-supported-numpy \
                        path:bin/pkg-config:pkgconfig

    # during the build a git repository is cloned, on older systems this
    # fails with an "SSL certificate problem: Invalid certificate chain"
    if {${os.platform} eq "darwin" && ${os.major} < 15} {
        depends_build-append \
                        path:bin/git:git
    }

    depends_lib-append  port:blosc2 \
                        port:py${python.version}-msgpack \
                        port:py${python.version}-ndindex \
                        port:py${python.version}-numexpr \
                        port:py${python.version}-numpy \
                        port:py${python.version}-requests

    build.args-append   -Cbuild.verbose=true
    build.env-append    USE_SYSTEM_BLOSC2=1

    pre-build {
        build.env-append    ARCHFLAGS=[get_canonical_archflags cc]
    }

    post-destroot {
        set docdir ${prefix}/share/doc/${subport}
        xinstall -m 755 -d ${destroot}${docdir}
        xinstall -m 644 -W ${worksrcpath} LICENSE.txt README.rst \
            RELEASE_NOTES.md \
            ${destroot}${docdir}
    }
}
