#!/bin/bash

export LLVM_CONFIG=${PREFIX}/bin/llvm-config

# If available, enable newer toolset on old RH / CentOS machines
toolset=/opt/rh/devtoolset-2

if [ -d $toolset ]; then
    . /opt/rh/devtoolset-2/enable
    export CC=gcc
    export CXX=g++
fi

if [ -n "$MACOSX_DEPLOYMENT_TARGET" ]; then
    # OSX needs 10.7 or above with libc++ enabled
    export MACOSX_DEPLOYMENT_TARGET=10.10
fi

if [[ ${MACOSX_DEPLOYMENT_TARGET} == 10.10 ]]; then
    DARWIN_TARGET=x86_64-apple-darwin13.4.0
fi

export PYTHONNOUSERSITE=1
# Enables static linking of stdlibc++
export LLVMLITE_CXX_STATIC_LINK=1

$PYTHON setup.py build --force
$PYTHON setup.py install
