File indexing completed on 2025-01-18 09:13:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 dd4hep_parse_this() {
0013 local SOURCE=${1}
0014 local package=${2};
0015 if [ "x${SOURCE}" = "x" ]; then
0016 if [ -f bin/this${package}.sh ]; then
0017 THIS="$PWD"; export THIS
0018 elif [ -f ./this${package}.sh ]; then
0019 THIS=$(cd .. > /dev/null; pwd); export THIS
0020 else
0021 echo ERROR: must "cd where/${package}/is" before calling ". bin/this${package}.sh" for this version of bash!
0022 THIS=; export THIS
0023 return 1
0024 fi
0025 else
0026
0027 local thisroot=$(dirname ${SOURCE})
0028 THIS=$(cd ${thisroot}/.. > /dev/null;pwd); export THIS
0029 fi
0030 }
0031
0032 dd4hep_add_path() {
0033 local path_name=${1}
0034 local path_prefix=${2}
0035 eval path_value=\$$path_name
0036
0037 path_value=`echo ${path_value} | tr : '\n' | grep -v "^${path_prefix}$" | tr '\n' : | sed 's|:$||'`
0038 path_value="${path_prefix}${path_value:+:${path_value}}"
0039 eval export ${path_name}='${path_value}'
0040 unset path_value
0041 }
0042
0043 dd4hep_add_library_path() {
0044 local p=${1};
0045 if [ @APPLE@ ]; then
0046
0047 [[ "$p" = "/usr/lib" || "$p" = "/usr/local/lib" ]] && return
0048 dd4hep_add_path DYLD_LIBRARY_PATH "$p"
0049 dd4hep_add_path DD4HEP_LIBRARY_PATH "$p"
0050 else
0051 dd4hep_add_path LD_LIBRARY_PATH "$p"
0052 fi
0053 }
0054
0055
0056 SOURCE=${BASH_ARGV[0]}
0057 if [ "x$SOURCE" = "x" ]; then
0058 SOURCE=${(%):-%N}
0059 fi
0060
0061 dd4hep_parse_this $SOURCE dd4hep;
0062
0063
0064
0065
0066 if [ -z $ROOTSYS ]; then
0067 export ROOTSYS=`dirname @ROOT_DIR@`
0068 fi;
0069 export Geant4_DIR=@Geant4_DIR@;
0070 export XERCESCINSTALL=@XERCESC_ROOT_DIR@;
0071
0072
0073 export DD4hepINSTALL=${THIS};
0074 export DD4hep_DIR=${THIS};
0075 export DD4hep_ROOT=${THIS};
0076
0077
0078 ROOTENV_INIT=${ROOTSYS}/bin/thisroot.sh;
0079 test -r ${ROOTENV_INIT} && { cd $(dirname ${ROOTENV_INIT}); . ./$(basename ${ROOTENV_INIT}) ; cd $OLDPWD ; }
0080
0081
0082 if [ ${Geant4_DIR} ]; then
0083 G4LIB_DIR=`dirname ${Geant4_DIR} | sed 's@/cmake\$@@'`;
0084 export G4INSTALL=`dirname ${G4LIB_DIR}`;
0085 export G4ENV_INIT=${G4INSTALL}/bin/geant4.sh
0086
0087 test -r ${G4ENV_INIT} && { cd $(dirname ${G4ENV_INIT}) ; . ./$(basename ${G4ENV_INIT}) ; cd $OLDPWD ; }
0088
0089 if [ @GEANT4_USE_CLHEP@ ] ; then
0090 dd4hep_add_library_path @CLHEP_LIBRARY_PATH@;
0091 fi;
0092 export CLHEP_DIR=@CLHEP_INCLUDE_DIR@/../;
0093 export CLHEP_ROOT_DIR=@CLHEP_INCLUDE_DIR@/../;
0094 export CLHEP_INCLUDE_DIR=@CLHEP_INCLUDE_DIR@;
0095 unset G4ENV_INIT;
0096 unset G4LIB_DIR;
0097 fi;
0098
0099
0100 if [ ${XERCESCINSTALL} ]; then
0101 dd4hep_add_library_path ${XERCESCINSTALL}/lib;
0102 fi;
0103
0104
0105 dd4hep_add_path PATH ${THIS}/bin;
0106
0107 dd4hep_add_library_path ${THIS}/lib;
0108
0109 dd4hep_add_path PYTHONPATH ${THIS}/@DD4HEP_PYTHON_INSTALL_DIR@;
0110
0111 dd4hep_add_path ROOT_INCLUDE_PATH ${THIS}/include;
0112
0113 if [ @APPLE@ ];
0114 then
0115 export DD4HEP_LIBRARY_PATH=${DYLD_LIBRARY_PATH};
0116 else
0117 export DD4HEP_LIBRARY_PATH=${LD_LIBRARY_PATH};
0118 fi;
0119
0120
0121 unset ROOTENV_INIT;
0122 unset THIS;
0123 unset SOURCE;
0124