Skip to content

Instantly share code, notes, and snippets.

@janmayer
Last active March 10, 2017 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janmayer/746246e9c7cce4816830 to your computer and use it in GitHub Desktop.
Save janmayer/746246e9c7cce4816830 to your computer and use it in GitHub Desktop.
Script to (re-) build FairRoot
#!/bin/bash
# requires FairSoft installation in ${BASEPATH}/FairSoft
# requires FairRoot source code in ${BASEPATH}/FairRoot-src
export BASEPATH=$(pwd)
# Set FairSoft environment variables
export SIMPATH=${BASEPATH}/FairSoft
. ${SIMPATH}/share/Geant4/geant4make/geant4make.sh
. ${SIMPATH}/bin/thisroot.sh
FAIRROOTSOURCEPATH=${BASEPATH}/FairRoot-src
FAIRROOTBUILDPATH=${BASEPATH}/FairRoot-build
export FAIRROOTPATH=${BASEPATH}/FairRoot
# Check if install directory already exists
if [ -d "${FAIRROOTPATH}" ]; then
# and prompt to remove (can help with errors)
echo rm -Ir ${FAIRROOTPATH}
rm -Ir ${FAIRROOTPATH}
fi
mkdir -p ${FAIRROOTPATH}
# Check if build directory already exists
if [ -d "${FAIRROOTBUILDPATH}" ]; then
# and prompt to remove (can help with errors)
echo rm -Ir ${FAIRROOTBUILDPATH}
rm -Ir ${FAIRROOTBUILDPATH}
fi
mkdir -p ${FAIRROOTBUILDPATH}
# cmake + make + make install
cd ${FAIRROOTBUILDPATH}
${SIMPATH}/bin/cmake ${FAIRROOTSOURCEPATH} -DCMAKE_INSTALL_PREFIX=${FAIRROOTPATH} -DUSE_DIFFERENT_COMPILER=TRUE -DROOT_DIR=${SIMPATH} -DGEANT4_DIR=${SIMPATH}
make -j30
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment