Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:24

0001 #!/bin/bash
0002 # Source this script to set up the DD4Hep installation that this script is part of.
0003 # This version of the script has been modified to set up environment variables for
0004 # only DD4hep.
0005 #
0006 # This script if for the csh like shells, see thisdd4hep.csh for csh like shells.
0007 #
0008 # Author: Pere Mato. F. Gaede, M.Frank
0009 #-------------------------------------------------------------------------------
0010 #
0011 #echo " ### thisdd4hep_only.sh:   initialize the environment for DD4hep ! " 
0012 #
0013 #-----------------------------------------------------------------------------
0014 dd4hep_parse_this()   {
0015     local SOURCE=${1}
0016     local package=${2};
0017     if [ "x${SOURCE}" = "x" ]; then
0018         if [ -f bin/this${package}_only.sh ]; then
0019             THIS="$PWD"; export THIS
0020         elif [ -f ./this${package}_only.sh ]; then
0021             THIS=$(cd ..  > /dev/null; pwd); export THIS
0022         else
0023             echo ERROR: must "cd where/${package}/is" before calling ". bin/this${package}_only.sh" for this version of bash!
0024             THIS=; export THIS
0025             return 1
0026         fi
0027     else
0028         # get param to "."
0029         local thisroot=$(dirname ${SOURCE})
0030         THIS=$(cd ${thisroot}/.. > /dev/null;pwd); export THIS
0031     fi
0032 }
0033 #-----------------------------------------------------------------------------
0034 dd4hep_add_path()   {
0035     local path_name=${1}
0036     local path_prefix=${2}
0037     eval path_value=\$$path_name
0038     # Prevent duplicates
0039     path_value=`echo ${path_value} | tr : '\n' | grep -v "^${path_prefix}$" | tr '\n' : | sed 's|:$||'`
0040     path_value="${path_prefix}${path_value:+:${path_value}}"
0041     eval export ${path_name}='${path_value}'
0042     unset path_value
0043 }
0044 #-----------------------------------------------------------------------------
0045 dd4hep_add_library_path()    {
0046     local p=${1};
0047     if [ @APPLE@ ]; then
0048         # Do not prepend system library locations on macOS. Stuff will break.
0049         [[ "$p" = "/usr/lib" || "$p" = "/usr/local/lib" ]] && return
0050         dd4hep_add_path DYLD_LIBRARY_PATH     "$p"
0051         dd4hep_add_path DD4HEP_LIBRARY_PATH   "$p"
0052     else
0053         dd4hep_add_path LD_LIBRARY_PATH       "$p"
0054     fi
0055 }
0056 #-----------------------------------------------------------------------------
0057 #
0058 SOURCE=${BASH_ARGV[0]}
0059 if [ "x$SOURCE" = "x" ]; then
0060     SOURCE=${(%):-%N} # for zsh
0061 fi
0062 
0063 dd4hep_parse_this $SOURCE dd4hep;
0064 #
0065 #----DD4hep installation directory--------------------------------------------
0066 export DD4hepINSTALL=${THIS};
0067 export DD4hep_DIR=${THIS};
0068 export DD4hep_ROOT=${THIS};
0069 #
0070 #----PATH---------------------------------------------------------------------
0071 dd4hep_add_path PATH       ${THIS}/bin;
0072 #----LIBRARY_PATH-------------------------------------------------------------
0073 dd4hep_add_library_path    ${THIS}/lib;
0074 #----PYTHONPATH---------------------------------------------------------------
0075 dd4hep_add_path PYTHONPATH ${THIS}/@DD4HEP_PYTHON_INSTALL_DIR@;
0076 #----ROOT_INCLUDE_PATH--------------------------------------------------------
0077 dd4hep_add_path ROOT_INCLUDE_PATH ${THIS}/include;
0078 #-----------------------------------------------------------------------------
0079 if [ @APPLE@ ];
0080 then
0081     export DD4HEP_LIBRARY_PATH=${DYLD_LIBRARY_PATH};
0082 else
0083     export DD4HEP_LIBRARY_PATH=${LD_LIBRARY_PATH};
0084 fi;
0085 #-----------------------------------------------------------------------------
0086 #
0087 unset THIS;
0088 unset SOURCE;
0089 #-----------------------------------------------------------------------------