#!/bin/bash # # axel@cern.ch, 2014-02-07 # # arguments: # [cores] number of cores to use, optional # default: all detected cores # which is not ideal, see http://stackoverflow.com/a/677212/1392758 python=`which python` if type python2 > /dev/null 2>&1; then python=`which python2` fi if type python3 > /dev/null 2>&1; then python=`which python3` fi allcores=`$python <(cat <> Cloning '$1'...' git clone http://root.cern.ch/git/${1}.git $where > /dev/null || exit 1 ( cd $where && git checkout $2 ) } function initial { if [ -d inst ]; then echo '!! Directory inst/ exists; refusing to build / install!' exit 1 fi clone llvm cling-patches src cd src/tools || exit 1 clone clang cling-patches clone cling master cd ../.. } function configure { mkdir -p obj || exit 1 INSTDIR=`pwd`/inst cd obj || exit 1 echo '>> Configuring...' cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_TOOLS=Off -DCMAKE_INSTALL_PREFIX=$INSTDIR -DPYTHON_EXECUTABLE=$python ../src > /dev/null || exit 1 cd .. } function build { cd obj echo ':: Building...' make -j$cores || exit 1 rm -rf ../inst echo ':: Installing...' make -j$cores install || exit 1 echo ':: SUCCESS.' cd .. } if [ -d src ]; then # update mode update else initial fi if ! [ -e obj/Makefile ]; then configure fi build echo 'Run ./inst/bin/cling'