Newer
Older

David Emschermann
committed
#!/bin/bash
#
## semi-automated script installing FairSoft, FairRoot and CbmRoot
#
# 31.08.2018 - re-introduce old version
# 24.05.2018 - switch to oct17p1 as dev version

David Emschermann
committed
# 17.12.2015 - split fairsoft directory into src and install
# 01.12.2015 - add selection of root version
# 17.07.2015 - introduce option to compile dev settings

David Emschermann
committed
# 02.06.2015 - introduce parameters for individual package selection
# 13.03.2015 - initial version

David Emschermann
committed
# by David Emschermann

David Emschermann
committed
#-------------------------------------
# usage:
# svn co https://subversion.gsi.de/cbmsoft/cbmroot/trunk $CBMSRCDIR
# cd $CBMSRCDIR
# ./autoinstall_framework.sh dev 0 0 1
# or
# ./autoinstall_framework.sh 0 0 1

David Emschermann
committed
# or
# ./autoinstall_framework.sh 1 1 1

David Emschermann
committed
#-------------------------------------
# choose your root verion

David Emschermann
committed
# put your desired variants here:
export FSOFTDEV=jun19p2
export FROOTDEV=v18.2.1
export FSOFTPRO=jun19p1
export FROOTPRO=v18.2.0
export FSOFTOLD=may18p1
export FROOTOLD=v18.0.7
#-------------------------------------
export NUMOFCPU=`cat /proc/cpuinfo | grep processor | wc -l`

David Emschermann
committed
export CBMSRCDIR=`pwd`
#-------------------------------------
# set default version to pro
export FSOFTVER=$FSOFTPRO
export FROOTVER=$FROOTPRO

David Emschermann
committed
# check if we want to run with GSI compiler
if [ $# -ge 1 ]; then
if [ "$1" == "gsi" ]; then
# use a different compiler from GSI
module use /cvmfs/it.gsi.de/modulefiles/
module load compiler/gcc/4.9.2
export CXX=g++
shift
fi
fi
# check if we want to run with dev
if [ $# -ge 1 ]; then
if [ "$1" == "dev" ]; then
export FSOFTVER=$FSOFTDEV
export FROOTVER=$FROOTDEV
shift
elif [ "$1" == "old" ]; then
export FSOFTVER=$FSOFTOLD
export FROOTVER=$FROOTOLD
shift
fi
fi
echo FSOFTVER: $FSOFTVER
echo FROOTVER: $FROOTVER

David Emschermann
committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# install everything by default
SETUP_FAIRSOFT=1
SETUP_FAIRROOT=1
SETUP_CBMROOT=1
echo number of parameters: $#
# handle parameters, if supplied
if [ $# -eq 1 ]; then
SETUP_FAIRSOFT=$1
SETUP_FAIRROOT=0
SETUP_CBMROOT=0
fi
# handle parameters, if supplied
if [ $# -eq 2 ]; then
SETUP_FAIRSOFT=$1
SETUP_FAIRROOT=$2
SETUP_CBMROOT=0
fi
# handle parameters, if supplied
if [ $# -eq 3 ]; then
SETUP_FAIRSOFT=$1
SETUP_FAIRROOT=$2
SETUP_CBMROOT=$3
fi
echo "Install Fairsoft:" $SETUP_FAIRSOFT
echo "Install Fairroot:" $SETUP_FAIRROOT
echo "Install Cbmroot :" $SETUP_CBMROOT
echo
# exit

David Emschermann
committed
#
## FairSoft
#

David Emschermann
committed
if [ $SETUP_FAIRSOFT -ge 1 ]; then
echo "Setting up Fairsoft ..."

David Emschermann
committed
# check if sqlite3 is available
if [ -f /usr/include/sqlite3.h ] ; then
echo
echo "Sqlite3 is available"
echo
else
echo
echo "Sqlite3 is not available"
echo
echo "On Debian, please install as follows:"
echo "sudo apt install libsqlite3-dev"
echo
echo "On OpenSuSE, please install as follows:"
echo "zypper install libsqlite3-0 sqlite3-devel"
echo
echo "afterwards, restart autoinstall_framework.sh"
echo
fi

David Emschermann
committed
cd ..

David Emschermann
committed
git clone https://github.com/FairRootGroup/FairSoft fairsoft_src_${FSOFTVER}_root${ROOTVER}
cd fairsoft_src_${FSOFTVER}_root${ROOTVER}

David Emschermann
committed
git tag -l
git checkout -b $FSOFTVER $FSOFTVER

David Emschermann
committed
#emacs -nw automatic.conf
#./configure.sh automatic.conf
if [ $ROOTVER -eq 6 ]; then

David Emschermann
committed
sed s/build_root6=no/build_root6=yes/ automatic.conf > automatic1_root.conf

David Emschermann
committed
cp automatic.conf automatic1_root.conf

David Emschermann
committed
FSOFTINSTALLPATH=`pwd | sed s/fairsoft_src_/fairsoft_/`
sed /SIMPATH_INSTALL/d automatic1_root.conf > automatic2_path.conf
echo " SIMPATH_INSTALL=$FSOFTINSTALLPATH/installation" >> automatic2_path.conf
sed s/compiler=/compiler=gcc/ automatic2_path.conf > automatic3_gcc.conf
./configure.sh automatic3_gcc.conf

David Emschermann
committed
cd $CBMSRCDIR
echo done installing FairSoft
fi

David Emschermann
committed
#
## FairRoot
#

David Emschermann
committed
if [ $SETUP_FAIRROOT -ge 1 ]; then
echo "Setting up Fairroot ..."
# set SIMPATH
cd ..
echo "SIMPATH before: $SIMPATH"
cd fairsoft_${FSOFTVER}_root${ROOTVER}/installation/

David Emschermann
committed
export SIMPATH=`pwd`
echo "SIMPATH now : $SIMPATH"
cd $CBMSRCDIR
echo PATH=$SIMPATH/bin:$PATH
export PATH=$SIMPATH/bin:$PATH

David Emschermann
committed
cd ..
git clone https://github.com/FairRootGroup/FairRoot.git fairroot_src_$FROOTVER-fairsoft_${FSOFTVER}_root${ROOTVER}
cd fairroot_src_$FROOTVER-fairsoft_${FSOFTVER}_root${ROOTVER}

David Emschermann
committed
git tag -l
git checkout -b $FROOTVER $FROOTVER
mkdir build
cd build
cmake \
-DCMAKE_CXX_COMPILER=$($SIMPATH/bin/fairsoft-config --cxx) \
-DCMAKE_C_COMPILER=$($SIMPATH/bin/fairsoft-config --cc) \
-DCMAKE_INSTALL_PREFIX=../../fairroot_$FROOTVER-fairsoft_${FSOFTVER}_root${ROOTVER} \
..

David Emschermann
committed
nice make install -j$NUMOFCPU
cd $CBMSRCDIR
echo done installing FairRoot
fi

David Emschermann
committed
#
## CbmRoot
#

David Emschermann
committed
if [ $SETUP_CBMROOT -ge 1 ]; then
echo "Setting up Cbmroot ..."
# set SIMPATH
cd ..
echo "SIMPATH before: $SIMPATH"
cd fairsoft_${FSOFTVER}_root${ROOTVER}/installation/

David Emschermann
committed
export SIMPATH=`pwd`
echo "SIMPATH now : $SIMPATH"
cd $CBMSRCDIR
# set FAIRROOTPATH
cd ..
cd fairroot_$FROOTVER-fairsoft_${FSOFTVER}_root${ROOTVER}

David Emschermann
committed
export FAIRROOTPATH=`pwd`
echo "FAIRROOTPATH: $FAIRROOTPATH"
cd $CBMSRCDIR
echo PATH=$SIMPATH/bin:$PATH
export PATH=$SIMPATH/bin:$PATH

David Emschermann
committed
cd ..
if [ -d fieldmaps ]; then
svn up fieldmaps
else
svn co https://subversion.gsi.de/cbmsoft/cbmroot/fieldmaps fieldmaps
fi

David Emschermann
committed
#svn co https://subversion.gsi.de/cbmsoft/cbmroot/trunk cbm_$CBMSRCDIR
cd $CBMSRCDIR
mkdir build
cd build
cmake \
-DCMAKE_CXX_COMPILER=$($SIMPATH/bin/fairsoft-config --cxx) \
-DCMAKE_C_COMPILER=$($SIMPATH/bin/fairsoft-config --cc) \
..

David Emschermann
committed
nice make -j$NUMOFCPU
cd ..
cd input
ln -s ../../fieldmaps/* .
cd ..

David Emschermann
committed

David Emschermann
committed
echo done installing CbmRoot

David Emschermann
committed
echo
echo ". build/config.sh"
echo "export SIMPATH=$SIMPATH"
echo "export FAIRROOTPATH=$FAIRROOTPATH"

David Emschermann
committed
#####################################################################################
#####################################################################################