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

name                py-blis
epoch               1
# Don't upgrade past py-spaCy's highest supported version.
github.setup        explosion cython-blis 0.9.1 v
revision            0

checksums           rmd160  94337b4032e0fb0d7ab49d622a9b42f5c53c7335 \
                    sha256  6b13374cd4fd6493d583db2a5139c973c90818c9b59bbb572eb207325c3e5542 \
                    size    3914839

supported_archs     x86_64

license             MIT

maintainers         {jonesc @cjones051073} openmaintainer

description         Fast matrix-multiplication as a self-contained Python library
long_description    {*}${description}

# overload the github livecheck regex to look for versions that
# are just numbers and '.', no letters (e.g., "0.4.0.dev1").
github.livecheck.regex  {([0-9.]+)}

# Supported python versions
python.versions        37 38 39 310

# Compiler selection
compiler.c_standard    1999
compiler.cxx_standard  2011
compiler.blacklist-append *gcc* {clang < 999} macports-clang-3.* {macports-clang-[4-6].0}

# Pass selected compiler to BLIS
build.env-append    BLIS_COMPILER=${configure.cc}
destroot.env-append BLIS_COMPILER=${configure.cc}

if {${name} ne ${subport}} {

    variant native description {Build from source for best native platform support} {
        # Prevent precompiled binaries to let compilation optimise the library for the user processor
        archive_sites
    }
    # Currently no easy way to prevent build from detecting machine capabilities for Darwin builds.
    # So for now force all users to build from source to ensure they get what they support
    default_variants-append +native

    depends_build-append \
        port:cctools \
        port:py${python.version}-setuptools

    depends_lib-append \
        port:py${python.version}-cython \
        port:py${python.version}-numpy

    depends_test-append \
        port:py${python.version}-pytest \
        port:py${python.version}-hypothesis
}
