# -*- 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-numba
version             0.62.1
revision            0
categories-append   devel
license             BSD

python.versions     310 311 312 313

maintainers         {stromnov @stromnov} openmaintainer

description         Numba is a NumPy aware dynamic compiler for Python.

long_description    Numba is an Open Source NumPy-aware optimizing compiler \
                    for Python. It uses the remarkable LLVM compiler \
                    infrastructure to compile Python syntax to machine code.

homepage            https://numba.pydata.org/

checksums           rmd160  8b82c4c322b94a63e25253a40f683ac8f23f4732 \
                    sha256  7b774242aa890e34c21200a1fc62e5b5757d5286267e71103257f4e2af0d5161 \
                    size    2749817


variant openmp description "Add OpenMP support" {
    compiler.openmp_version 2.5

    build.env-delete    NUMBA_DISABLE_OPENMP=1

    if {[string match *clang* ${configure.compiler}]} {
        depends_lib-append  port:libomp

        patchfiles-append   patch-setup.py.diff

        post-patch {
            reinplace "s|__OPENMP_INC__|${prefix}/include/libomp|" setup.py
            reinplace "s|__OPENMP_LIB__|${prefix}/lib/libomp|" setup.py
        }
    }
}

variant tbb description "Add TBB support" {
    build.env-delete    NUMBA_DISABLE_TBB=1

    depends_lib-append  port:onetbb

    build.env-append    TBBROOT=${prefix}/libexec/onetbb
}

if {${name} ne ${subport}} {
    depends_lib-append  port:py${python.version}-llvmlite \
                        port:py${python.version}-numpy

    build.env-append    NUMBA_DISABLE_TBB=1 \
                        NUMBA_DISABLE_OPENMP=1

    livecheck.type      none
}
