#!/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-lib $SIMPATH/transport/geant4/lib/${geant4_system}/liblist); then untar geant4 $GEANT4VERSION.tar.gz ln -s $GEANT4VERSION geant4 G4WORKDIR=$SIMPATH/transport/geant4/ cd $G4WORKDIR if [ "$build_for_grid" = "yes" ] then cp ../g4env_grid.sh env.sh echo "Copied g4env_grid.sh ......................" | tee -a $logfile else cp ../g4env.sh env.sh echo "Copied g4env.sh ......................" | tee -a $logfile fi if [ "$debug" = "yes" ]; then echo "*** Patching env.sh to compile with debug information" | tee -a $logfile if [ "$platform" = "linux" ]; then sed -e '1,200 s/X != X/Xy = Xy/g' -i'' env.sh elif [ "$platform" = "macosx" ]; then sed -e '1,200 s/X != X/Xy = Xy/g' -i '' env.sh fi mysed 'G4DEBUG=""' 'G4DEBUG=1' env.sh fi if [ "$FC" = "gfortran" ]; then echo "***Setting gfortran for G3TOG4 in config/sys/Linux-g++.gmk ***" mysed 'g77' 'gfortran' config/sys/Linux-g++.gmk mysed '-lg2c' '-lgfortran' config/sys/Linux-g++.gmk fi if [ "$FC" = "g77" ]; then echo "***Setting g77 for G3TOG4 in config/sys/Linux-g++.gmk ***" mysed 'gfortran' 'g77' config/sys/Linux-g++.gmk mysed '-lgfortran' '-lg2c' config/sys/Linux-g++.gmk fi if [ "$compiler" = "intel" ]; then echo "*** Patching env.sh to compile with icc" | tee -a $logfile mysed 'G4SYSTEM="Linux-g++"' 'G4SYSTEM="Linux-icc"' env.sh if [ "$icc_version" = "10" ]; then echo "*** Patching config/sys/Linux-icc.gmk to compile with icc version 10" | tee -a $logfile cp config/sys/Linux-icc.gmk config/sys/Linux-icc.gmk_save mysed 'g77' 'ifort' config/sys/Linux-icc.gmk mysed '-fno-automatic -fno-backslash -fno-second-underscore' '' config/sys/Linux-icc.gmk mysed '-no-gcc' '' config/sys/Linux-icc.gmk fi fi if [ "$platform" = "macosx" ]; then sed -e 's/G4SYSTEM="Linux-g++"/G4SYSTEM="Darwin-g++"/g' -i '' env.sh if [ "$FC" = "gfortran" ]; then mysed 'g77' 'gfortran' config/sys/Darwin-g++.gmk mysed 'lg2c' ' ' config/sys/Darwin-g++.gmk fi if [ "$system" = "64bit" ]; then # Changes to create 64bit libraries on Mac OS X 10.5 (Leopard) mysed 'CXXFLAGS :=' 'CXXFLAGS := -m64' config/sys/Darwin-g++.gmk mysed 'FCFLAGS +=' 'FCFLAGS += -m64' config/sys/Darwin-g++.gmk mysed 'LDFLAGS +=' 'LDFLAGS += -m64' config/sys/Darwin-g++.gmk mysed '$(CXX) -dynamiclib' '$(CXX) -m64 -dynamiclib' config/sys/Darwin-g++.gmk # Changes to find the openmotif libraries if the are not # installed using fink. The fink openmotif libraries are 32bit # which conflicts with the rest of the setup. Get the libraries from # http://www.ist-inc.com/DOWNLOADS/motif_download.html # This is tested only on Leopard mysed '-I/sw/include' '-I/sw/include -I/usr/OpenMotif/include' config/sys/Darwin-g++.gmk has_slash_in_string mysed '-L/sw/lib' '-L/sw/lib -L/usr/OpenMotif/lib' config/sys/Darwin-g++.gmk has_slash_in_string # Change to overcome a problem with linking with OpenGL libraries # The problem is explained at # http://wiki.finkproject.org/index.php/Fink:Packaging:Preparing_for_10.5#OpenGL_Bug mysed 'OGLLIBS :=' 'OGLLIBS :=' config/sys/Darwin-g++.gmk fi fi if [ "$arch" = "solarisCC5" ]; then mysed 'G4SYSTEM="Linux-g++"' 'G4SYSTEM="SUN-CC"' env.sh mysed 'g++' 'CC' config/common.gmk # needed for correct mysed '-M' '-xM1' config/common.gmk # dependency generation gpatch -p0 < ../geant4_solarisCC5.patch if [ "$system" = "64bit" ]; then mysed 'CXX := CC' 'CXX := CC -m64' config/sys/SUN-CC.gmk mysed 'FC := f77' 'FC := f77 -m64' config/sys/SUN-CC.gmk fi fi if [ "$arch" = "solarisgcc" ]; then cp ../SUN-g++.gmk config/sys mysed 'G4SYSTEM="Linux-g++"' 'G4SYSTEM="SUN-g++"' env.sh gpatch -p0 < ../geant4_solaris_gcc.patch cd source/processes/hadronic/models/chiral_inv_phase_space/interface/src find . -name "*.cc" -exec gsed -e "s/=CS;/=C1S;/g" -i'' "{}" ";" find . -name "*.cc" -exec gsed -e "s/G4bool CS/G4bool C1S/g" -i'' "{}" ";" cd - cd source/processes/hadronic/models/chiral_inv_phase_space/interface/include find . -name "*.hh" -exec gsed -e "s/G4bool CS/G4bool C1S/g" -i'' "{}" ";" cd - fi . ./env.sh cd source $MAKE_command -j$number_of_processes check_all_libraries $SIMPATH/transport/geant4/lib/${geant4_system} check_success Geant4-lib $SIMPATH/transport/geant4/lib/${geant4_system}/liblist check=$? if [ -e config/sys/Linux-icc.gmk ]; then mv config/sys/Linux-icc.gmk_save config/sys/Linux-icc.gmk fi # create links in lib directory to all libraries in system dependent # subdirectory if [ "$check" = "1" ]; then cd $SIMPATH/transport/geant4/lib for file in $(ls ${geant4_system}); do ln -s ${geant4_system}/$file done if [ "$platform" = "macosx" ]; then create_links dylib so fi fi else cd $SIMPATH/transport/geant4 . ./env.sh fi cd $SIMPATH