# -*- 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.65.1
revision            0
categories-append   devel
license             BSD

python.versions     310 311 312 313 314

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  4dd2a6ff8bcbf98c35760923402a96e93d80a8e3 \
                    sha256  19357146c32fe9ed25059ab915e8465fb13951cf6b0aace3826b76886373ab23 \
                    size    2765600


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}
}

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

    test.run            yes
    test.env-append     PYTHONPATH=${destroot}${python.pkgd}
    python.test_framework unittest
}
