#!/bin/bash
export TBBROOT=$PREFIX

# Numba is incompatible with TBB 2021.6 API
export NUMBA_DISABLE_TBB=1

# MacOS build
if [ `uname` == Darwin ]; then
    WHEELS_BUILD_ARGS=""
    export MACOSX_DEPLOYMENT_TARGET=10.9
    $PYTHON setup.py build install --single-version-externally-managed --record=record.txt
else
# Linux build
    $PYTHON setup.py build install --single-version-externally-managed --record=record.txt

    if [ "$CONDA_PY" == "36" ]; then
        WHEELS_BUILD_ARGS="-p manylinux1_x86_64"
    else
        WHEELS_BUILD_ARGS="-p manylinux2014_x86_64"
    fi
fi

# Build wheel package
if [ -n "${WHEELS_OUTPUT_FOLDER}" ]; then
    $PYTHON setup.py bdist_wheel ${WHEELS_BUILD_ARGS}
    cp dist/numba*.whl ${WHEELS_OUTPUT_FOLDER}
fi
