build.sh 1.8 KB
Newer Older
Daniel Brown's avatar
Daniel Brown committed
1 2 3 4 5
#!/bin/bash

platform='unknown'
unamestr=`uname`
unamem=`uname -m`
Daniel Brown's avatar
Daniel Brown committed
6 7 8 9 10 11
branch=`git rev-parse --abbrev-ref HEAD`

if [[ "$branch" != 'master' ]]; then
    echo !! Trying to push non-master branch to Conda !!
    exit 1
fi
Daniel Brown's avatar
Daniel Brown committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

if [[ "$unamestr" == 'Linux' ]]; then
    if [[ "${ARCH}" == '32' ]]; then
        ./finesse.sh --build-linux32
    else
        ./finesse.sh --build-linux
    fi
    
    cp ./kat ${PREFIX}/bin
    cp ./kat.ini ${PREFIX}/bin
    
elif [[ "$unamestr" == 'Darwin' ]]; then
    if [[ "${ARCH}" == '32' ]]; then
       ./finesse.sh --build-mac32
    else
       ./finesse.sh --build-mac
    fi
    
    cp ./kat ${PREFIX}/bin
    cp ./kat.ini ${PREFIX}/bin
    
elif [[ "$unamestr" == *CYGWIN* ]]; then
    if [[ "$unamem" == 'i686' ]]; then
        ./finesse.sh --build-win32
    else
        ./finesse.sh --build-win64
    fi
    
    cp ./kat.exe ${PREFIX}/bin
    cp ./kat.ini ${PREFIX}/bin
    
elif [[ "$unamestr" == *MINGW32* ]]; then
    echo "Platform not supported" | tee -a $LOGFILE
    failure
else
   echo "Platform could not be determined" | tee -a $LOGFILE
   failure
fi

# Setup saved env vars https://conda.io/docs/using/envs.html
mkdir -p ${PREFIX}/etc/conda/activate.d
mkdir -p ${PREFIX}/etc/conda/deactivate.d

touch ${PREFIX}/etc/conda/activate.d/finesse_vars.sh
touch ${PREFIX}/etc/conda/deactivate.d/finesse_vars.sh

echo "#!/bin/bash" >> ${PREFIX}/etc/conda/activate.d/finesse_vars.sh
echo "export KATINI=\${CONDA_PREFIX}/bin/kat.ini" >> ${PREFIX}/etc/conda/activate.d/finesse_vars.sh
echo "export FINESSE_DIR=\${CONDA_PREFIX}/bin/" >> ${PREFIX}/etc/conda/activate.d/finesse_vars.sh

echo "#!/bin/bash" >> ${PREFIX}/etc/conda/deactivate.d/finesse_vars.sh
echo "unset KATINI" >> ${PREFIX}/etc/conda/deactivate.d/finesse_vars.sh
echo "unset FINESSE_DIR" >> ${PREFIX}/etc/conda/deactivate.d/finesse_vars.sh