#!/bin/bash cd $SIMPATH/transport/ # Full output during compilation and linking to check for the # compile and link commands export CPPVERBOSE=1 if (not_there Geant4-Source $SIMPATH/transport/geant4/source/CMakeLists.txt); then untar geant4 $GEANT4VERSION.tar.gz ln -s $GEANT4VERSION geant4 fi G4WORKDIR=$SIMPATH/transport/geant4/ if (not_there Geant4-lib $SIMPATH/transport/geant4/lib/libG4physicslists.so); then cd $G4WORKDIR if (not_there Geant4-env $SIMPATH/transport/geant4/source/geometry/env.sh); then if [ "$build_for_grid" = "yes" ] then cp $SIMPATH/transport/g4env_grid.sh env.sh echo "Copied g4env_grid.sh ......................" | tee -a $logfile else cp $SIMPATH/transport/g4env.sh env.sh echo "Copied g4env.sh ......................" | tee -a $logfile fi else . ./env.sh fi ## Add missing directory: bug in G4.9.4!!!! ## correct the CMakeLists.txt of source/geometry dir patch -p0 < ../geant4_cmake.patch if (not_there Geant4-build $SIMPATH/transport/geant4/build); then mkdir build fi cd build cmake -DCMAKE_INSTALL_PREFIX=$G4WORKDIR -DCLHEP_CONFIG_EXECUTABLE=$SIMPATH/cern/clhep/clhep-config -DGEANT4_USE_GEANT3TOGEANT4=TRUE ../ $MAKE_command -j$number_of_processes install if [ "$platform" = "macosx" ]; then cd $SIMPATH/transport/geant4/lib ext1=dylib ext2=so for file in $(ls *.$ext1); do ln -s $file ${file%.*}.$ext2 done fi . $G4WORKDIR/share/$GEANT4VERSIONp/config/$GEANT4VERSIONp.sh else . $G4WORKDIR/share/$GEANT4VERSIONp/config/$GEANT4VERSIONp.sh fi cd $SIMPATH return 1