Commit db34c43a authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use 'setenv PATH' instead of 'set path=' for c-shell scripts

- the path is accesible either way, but use setenv for consistency with
  other environment variables. It also simplifies foamCleanPath again.
parent 3ee85951
......@@ -43,7 +43,6 @@ usage() {
cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN]
options:
-space treat 'path' as space-delimited (eg, from C-Shell)
-strip remove inaccessible directories
-help print the usage
......@@ -57,7 +56,7 @@ USAGE
}
unset space strip
unset strip
# parse options
while [ "$#" -gt 0 ]
do
......@@ -65,10 +64,6 @@ do
-h | -help)
usage
;;
-space)
space=true
shift
;;
-strip)
strip=true
shift
......@@ -82,12 +77,7 @@ done
[ "$#" -ge 1 ] || usage
if [ "$space" = true ]
then
dirList=$(echo "$1" | sed -e 's/ /:/g')
else
dirList="$1"
fi
dirList="$1"
shift
##DEBUG echo "input>$dirList<" 1>&2
......@@ -140,11 +130,8 @@ done
IFS=' '
set -- $dirList
# join on ':', unless -space option was specified
if [ "$space" != true ]
then
IFS=':'
fi
# rejoin on ':'
IFS=':'
dirList="$*"
# restore IFS
......
......@@ -40,11 +40,11 @@ if ( -r $CEI_HOME ) then
# special treatment for 32bit OpenFOAM and 64bit Ensight
if ($WM_ARCH == linux && `uname -m` == x86_64) then
setenv CEI_ARCH linux_2.6_32
setenv CEI_ARCH linux_2.6_32
endif
# add to path
set path=($CEI_HOME/bin $path)
setenv PATH ${CEI_HOME}/bin:${PATH}
setenv ENSIGHT9_INPUT dummy
setenv ENSIGHT9_READER $FOAM_LIBBIN
......
......@@ -35,8 +35,8 @@
#------------------------------------------------------------------------------
# clean the PATH
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath -space "$path" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`
if ( $status == 0 ) set path=($cleaned)
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`
if ( $status == 0 ) setenv PATH $cleaned
# determine the cmake to be used
unsetenv CMAKE_HOME
......@@ -44,7 +44,7 @@ foreach cmake ( cmake-2.8.1 cmake-2.8.0 cmake-2.6.4 )
set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake
if ( -r $cmake ) then
setenv CMAKE_HOME $cmake
set path=($CMAKE_HOME/bin $path)
setenv PATH ${CMAKE_HOME}/bin:${PATH}
break
endif
end
......@@ -73,7 +73,7 @@ setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-
# set paths if binaries or source are present
if ( -r $ParaView_DIR || -r $paraviewInstDir ) then
set path=($ParaView_DIR/bin $path)
setenv PATH ${ParaView_DIR}/bin:${PATH}
setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-${ParaView_MAJOR}
# add in python libraries if required
......
......@@ -209,16 +209,16 @@ default:
endsw
# Clean standard environment variables (path/PATH, LD_LIBRARY_PATH, MANPATH)
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH ''
if (! $?MANPATH) setenv MANPATH ''
#- Clean path/PATH
set cleaned=`$foamClean -space "$path" "$foamOldDirs"`
if ( $status == 0 ) set path=($cleaned)
#- Clean PATH (path)
set cleaned=`$foamClean "$PATH" "$foamOldDirs"`
if ( $status == 0 ) setenv PATH $cleaned
#- Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`
......@@ -242,9 +242,9 @@ _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
# Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Clean path/PATH
set cleaned=`$foamClean -space "$path"`
if ( $status == 0 ) set path=($cleaned)
#- Clean PATH (path)
set cleaned=`$foamClean "$PATH"`
if ( $status == 0 ) setenv PATH $cleaned
#- Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH"`
......
......@@ -22,7 +22,7 @@
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# File
# etc/prefs.csh
#
# Description
......
......@@ -22,7 +22,7 @@
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# File
# etc/prefs.sh
#
# Description
......
......@@ -32,7 +32,7 @@
#------------------------------------------------------------------------------
# prefix to PATH
alias _foamAddPath 'set path=(\!* $path)'
alias _foamAddPath 'setenv PATH \!*\:${PATH}'
# prefix to LD_LIBRARY_PATH
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
# prefix to MANPATH
......@@ -68,14 +68,10 @@ setenv FOAM_SOLVERS $FOAM_APP/solvers
setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
# add OpenFOAM scripts and wmake to the path
set path=($WM_DIR $WM_PROJECT_DIR/bin $path)
setenv PATH ${WM_DIR}:${WM_PROJECT_DIR}/bin:${PATH}
_foamAddPath $FOAM_APPBIN
_foamAddPath $FOAM_SITE_APPBIN
_foamAddPath $FOAM_USER_APPBIN
_foamAddLib $FOAM_LIBBIN
_foamAddLib $FOAM_SITE_LIBBIN
_foamAddLib $FOAM_USER_LIBBIN
_foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}
# Select compiler installation
......@@ -117,8 +113,7 @@ case OpenFOAM:
endif
_foamAddPath ${WM_COMPILER_DIR}/bin
_foamAddLib ${WM_COMPILER_DIR}/lib
_foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}
_foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}:${WM_COMPILER_DIR}/lib
_foamAddMan ${WM_COMPILER_DIR}/man
breaksw
......@@ -163,7 +158,7 @@ case SYSTEMOPENMPI:
echo " libmpi dir : $libDir"
endif
_foamAddLib $libDir
_foamAddLib $libDir
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version libDir
......@@ -187,9 +182,9 @@ case MPICH-GM:
setenv MPICH_PATH $MPI_ARCH_PATH
setenv GM_LIB_PATH /opt/gm/lib64
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-gm
breaksw
......@@ -231,18 +226,18 @@ case MPI:
case FJMPI:
setenv MPI_ARCH_PATH /opt/FJSVmpi2
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpi
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib/sparcv9
_foamAddLib /opt/FSUNf90/lib/sparcv9
_foamAddLib /opt/FJSVpnidt/lib
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib/sparcv9
_foamAddLib /opt/FSUNf90/lib/sparcv9
_foamAddLib /opt/FJSVpnidt/lib
breaksw
case QSMPI:
setenv MPI_ARCH_PATH /usr/lib/mpi
setenv FOAM_MPI_LIBBIN FOAM_LIBBIN/qsmpi
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
breaksw
......@@ -274,8 +269,8 @@ if ( $?CGAL_LIB_DIR ) then
endif
# Switch on the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if ( -f $FOAM_LIBBIN/libhoard.so ) then
# setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:${LD_PRELOAD}
#endif
......
......@@ -94,8 +94,8 @@ export FOAM_RUN=$WM_PROJECT_USER_DIR/run
# add OpenFOAM scripts and wmake to the path
export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH
_foamAddPath $FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN
_foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
_foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN
# Compiler settings
......@@ -200,7 +200,7 @@ SYSTEMOPENMPI)
echo " libmpi dir : $libDir"
fi
_foamAddLib $libDir
_foamAddLib $libDir
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version libDir
......@@ -224,9 +224,9 @@ MPICH-GM)
export MPICH_PATH=$MPI_ARCH_PATH
export GM_LIB_PATH=/opt/gm/lib64
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-gm
;;
......@@ -270,18 +270,18 @@ FJMPI)
export MPI_ARCH_PATH=/opt/FJSVmpi2
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpi
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib/sparcv9
_foamAddLib /opt/FSUNf90/lib/sparcv9
_foamAddLib /opt/FJSVpnidt/lib
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib/sparcv9
_foamAddLib /opt/FSUNf90/lib/sparcv9
_foamAddLib /opt/FJSVpnidt/lib
;;
QSMPI)
export MPI_ARCH_PATH=/usr/lib/mpi
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/qsmpi
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
;;
......@@ -309,8 +309,8 @@ export MPI_BUFFER_SIZE
[ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR
# Switch on the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if [ -f $FOAM_LIBBIN/libhoard.so ]
#then
# export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment