# -*- 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.64.0
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  ae5d4e306d6e42c92e986b56e3674c2fd576a609 \
                    sha256  95e7300af648baa3308127b1955b52ce6d11889d16e8cfe637b4f85d2fca52b1 \
                    size    2765679


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

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