3 # Setup the edep-sim directory for development (or simply running the
4 # simulation). This makes sure that the ROOT and GEANT4 environment
5 # variables are set (using thisroot.sh and geant4.sh), and then
6 # defines a couple of conveniences commands:
8 # edep-build == Source ./build/edep-build.sh which will conveniently
9 # run cmake/make/make install from any place so that it's
10 # really easy to recompile.
12 # edep-setup == Source this file. You probably never have to use
15 # This setup script is not needed. You can also do it by hand. It's
16 # a usual cmake build, but you need to make sure root and geant are
21 # cd the-build-directory
22 # cmake -DCMAKE_INSTALL_PREFIX=the-install-directory the-edep-sim-directory
27 # Try to setup root. ROOT installs thisroot.sh in the bin directory
28 # to setup the environment. The first "thisroot.sh" in the path will
29 # define the root that is used.
30 . thisroot.sh >& /dev/null
32 echo ROOT not available.
35 # Try to setup geant4. GEANT4 installs geant4.sh in the bin directory
36 # to setup the environment. The first "geant4.sh" in the path will
37 # define the geant that is used.
38 . geant4.sh >& /dev/null
40 echo GEANT not available.
43 # Find the root of the building area.
47 if [ -e ./build -a -d ./build -a -e ./build/edep-build.sh ]; then
51 COUNT=$(expr ${COUNT} - 1)
52 if [ ${COUNT} -lt 1 ]; then
53 echo invalid-directory
61 EDEP_ROOT=$(___edep_root)
64 if [ ${EDEP_ROOT} = "invalid-directory" ]; then
65 echo EDEP-SIM setup.sh must be sourced in edep-sim directory.
72 target="${target}-${compiler}-$(cc -dumpversion)-$(cc -dumpmachine)"
77 EDEP_TARGET=$(___edep_target)
78 unset -f ___edep_target
82 eval export $1="$2:\$$1"
85 export $1=$(eval echo -n \$$1 | \
86 awk -v RS=: -v ORS=: '$0 != "'$2'"' | \
90 ___path_prepend PATH ${EDEP_ROOT}/${EDEP_TARGET}/bin
91 ___path_prepend LD_LIBRARY_PATH ${EDEP_ROOT}/${EDEP_TARGET}/lib
93 unset -f ___path_prepend
94 unset -f ___path_remove
97 alias edep-setup=". ${EDEP_ROOT}/setup.sh"
99 alias edep-build="${EDEP_ROOT}/build/edep-build.sh"
101 echo Defined edep-setup to re-setup the edep-sim package.
102 echo Defined edep-build to build the the edep-sim package.