Commit 0f76df8b authored by Mark Olesen's avatar Mark Olesen
Browse files

etc/ shell settings cleanup

  * prefix internal functions with _foam to prevent collisions
  * cleanup functions after use
  * centralized FOAM_VERBOSE info to etc/{bashrc,cshrc}
parent 02ffb9d8
......@@ -2,9 +2,9 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
......
......@@ -23,7 +23,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# bashrc
# cint/bashrc
#
# Description
# Setup file for cint
......
......@@ -23,7 +23,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# cshrc
# cint/cshrc
#
# Description
# Startup File for cint
......
......@@ -23,7 +23,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# bashrc
# ensightFoam/bashrc
#
# Description
# Setup file for Ensight 8.?
......@@ -31,12 +31,6 @@
#
#------------------------------------------------------------------------------
if [ "$PS1" -a "$foamDotFile" ]; then
if [ "$FOAM_VERBOSE" ]; then
echo "Executing: $foamDotFile"
fi
fi
# fallback value
if [ ! -d "$CEI_HOME" ]; then
export CEI_HOME=/usr/local/ensight/CEI
......
......@@ -23,7 +23,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# cshrc
# ensightFoam/cshrc
#
# Description
# Startup File for Ensight 8.?.
......@@ -31,12 +31,6 @@
#
#------------------------------------------------------------------------------
if ($?prompt && $?foamDotFile) then
if ($?FOAM_VERBOSE) then
echo "Executing: $foamDotFile"
endif
endif
# fallback value
if (! $?CEI_HOME) then
setenv CEI_HOME /usr/local/ensight/CEI
......@@ -44,6 +38,7 @@ endif
if ( -r $CEI_HOME ) then
# special treatment for 32bit FOAM and 64bit Ensight
if ($WM_ARCH == linux) then
setenv CEI_ARCH linux_linux_2.6_32
endif
......@@ -53,7 +48,7 @@ if ( -r $CEI_HOME ) then
setenv ENSIGHT8_INPUT dummy
setenv ENSIGHT8_READER $FOAM_LIBBIN
else
unset CEI_HOME
unsetenv CEI_HOME
endif
# -----------------------------------------------------------------------------
......@@ -23,7 +23,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# bashrc
# paraview/bashrc
#
# Description
# Setup file for Paraview.
......@@ -31,12 +31,6 @@
#
#------------------------------------------------------------------------------
if [ "$PS1" -a "$foamDotFile" ]; then
if [ "$FOAM_VERBOSE" ]; then
echo "Executing: $foamDotFile"
fi
fi
export CMAKE_HOME=$WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
if [ -r $CMAKE_HOME ]; then
......
......@@ -23,7 +23,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# cshrc
# paraview/cshrc
#
# Description
# Startup File for Paraview.
......@@ -31,12 +31,6 @@
#
#------------------------------------------------------------------------------
if ($?prompt && $?foamDotFile) then
if ($?FOAM_VERBOSE) then
echo "Executing: $foamDotFile"
endif
endif
setenv CMAKE_HOME $WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
if ( -r $CMAKE_HOME ) then
......
......@@ -23,7 +23,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# bashrc
# paraview3/bashrc
#
# Description
# Setup file for ParaView3.
......@@ -31,12 +31,6 @@
#
#------------------------------------------------------------------------------
if [ "$PS1" -a "$foamDotFile" ]; then
if [ "$FOAM_VERBOSE" ]; then
echo "Executing: $foamDotFile"
fi
fi
export CMAKE_HOME=$WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
if [ -r $CMAKE_HOME ]; then
......
......@@ -23,7 +23,7 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# cshrc
# paraview3/cshrc
#
# Description
# Startup File for Paraview3
......@@ -31,18 +31,12 @@
#
#------------------------------------------------------------------------------
if ($?prompt && $?foamDotFile) then
if ($?FOAM_VERBOSE) then
echo "Executing: $foamDotFile"
endif
endif
setenv CMAKE_HOME $WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
if ( -r $CMAKE_HOME ) then
set path=($CMAKE_HOME/bin $path)
else
unset CMAKE_HOME
unsetenv CMAKE_HOME
endif
setenv ParaView_VERSION 3.3-cvs
......
......@@ -178,23 +178,29 @@ export PATH LD_LIBRARY_PATH MANPATH
# Source project setup files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
SOURCE(){
foamDotFile=$1
. $1
foamDotFile=
_foamSource()
{
while [ $# -ge 1 ]
do
if [ "$FOAM_VERBOSE" -a "$PS1" ]; then
echo "Sourcing: $1"
fi
. $1
shift
done
}
SOURCE $WM_PROJECT_DIR/etc/settings.sh
SOURCE $WM_PROJECT_DIR/etc/aliases.sh
_foamSource $WM_PROJECT_DIR/etc/settings.sh
_foamSource $WM_PROJECT_DIR/etc/aliases.sh
# Source user setup files for optional packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#SOURCE $WM_PROJECT_DIR/etc/apps/paraview/bashrc
SOURCE $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
#SOURCE $WM_PROJECT_DIR/etc/apps/ensightFoam/bashrc
SOURCE $WM_PROJECT_DIR/etc/apps/cint/bashrc
# _foamSource $WM_PROJECT_DIR/etc/apps/paraview/bashrc
_foamSource $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
# _foamSource $WM_PROJECT_DIR/etc/apps/ensightFoam/bashrc
_foamSource $WM_PROJECT_DIR/etc/apps/cint/bashrc
# Again clean environment (path, PATH, MANPATH, LD_LIBRARY_PATH)
......@@ -217,8 +223,9 @@ if [ "$LD_PRELOAD" != "" ]; then
fi
# cleanup environment
unset cleanPath cleanProg foamDotFile foamInstall
# cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~
unset cleanPath cleanProg foamInstall
unset _foamSource
# -----------------------------------------------------------------------------
......@@ -4,7 +4,7 @@
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
......@@ -33,6 +33,7 @@
setenv WM_PROJECT OpenFOAM
#setenv WM_PROJECT_VERSION dev
if ( ! $?WM_PROJECT_VERSION ) setenv WM_PROJECT_VERSION dev
#!!User:
# either setenv FOAM_INST_DIR before sourcing this file or set
......@@ -60,6 +61,12 @@ setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty
# Operating System/Platform from Unix or MSWindows
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# WM_OS = Unix | MSWindows
if ( ! $?WM_OS ) setenv WM_OS Unix
# Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc
......@@ -68,12 +75,6 @@ setenv WM_COMPILER_ARCH
setenv WM_COMPILER_LIB_ARCH
# Operating System/Platform from Unix or MSWindows
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# WM_OS = Unix | MSWindows
if ( ! $?WM_OS ) setenv WM_OS Unix
# Compilation options (architecture, precision, optimised, debug or profiling)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# WM_ARCH_OPTION = 32 | 64
......@@ -184,16 +185,16 @@ setenv MANPATH `$cleanProg "$MANPATH" "$wildCards"`
# Source project setup files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
alias SOURCE 'set foamDotFile=\!*; source \!*; unset foamDotFile'
SOURCE $WM_PROJECT_DIR/etc/settings.csh
SOURCE $WM_PROJECT_DIR/etc/aliases.csh
alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Executing: \!*"; source \!*'
_foamSource $WM_PROJECT_DIR/etc/settings.csh
_foamSource $WM_PROJECT_DIR/etc/aliases.csh
# Source user setup files for optional packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#SOURCE $WM_PROJECT_DIR/etc/apps/paraview/cshrc
SOURCE $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
#SOURCE $WM_PROJECT_DIR/etc/apps/ensightFoam/cshrc
# _foamSource $WM_PROJECT_DIR/etc/apps/paraview/cshrc
_foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
# _foamSource $WM_PROJECT_DIR/etc/apps/ensightFoam/cshrc
# Again clean environment (path, PATH, MANPATH, LD_LIBRARY_PATH)
......@@ -216,5 +217,7 @@ if ( $?LD_PRELOAD ) then
setenv LD_PRELOAD `$cleanProg "$LD_PRELOAD"`
endif
# cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~
unalias _foamSource
# -----------------------------------------------------------------------------
......@@ -4,7 +4,7 @@
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
......@@ -30,14 +30,9 @@
# Sourced from OpenFOAM-??/etc/cshrc
#
#------------------------------------------------------------------------------
if ($?prompt && $?foamDotFile) then
if ($?FOAM_VERBOSE) then
echo "Executing: $foamDotFile"
endif
endif
alias AddPath 'set path=(\!* $path) ; if ( ! -d \!* ) mkdir -p \!*'
alias AddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH} ; if ( ! -d \!* ) mkdir -p \!*'
alias _foamAddPath 'set path=(\!* $path) ; if ( ! -d \!* ) mkdir -p \!*'
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH} ; if ( ! -d \!* ) mkdir -p \!*'
#- Add the system-specific executables path to the path
......@@ -49,27 +44,26 @@ setenv FOAM_JOB_DIR $FOAM_INST_DIR/jobControl
setenv WM_DIR $WM_PROJECT_DIR/wmake
setenv WM_LINK_LANGUAGE c++
setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
set path=($WM_DIR $path)
setenv FOAM_SRC $WM_PROJECT_DIR/src
setenv FOAM_LIB $WM_PROJECT_DIR/lib
setenv FOAM_LIBBIN $FOAM_LIB/$WM_OPTIONS
AddLib $FOAM_LIBBIN
_foamAddLib $FOAM_LIBBIN
setenv FOAM_APP $WM_PROJECT_DIR/applications
setenv FOAM_APPBIN $WM_PROJECT_DIR/applications/bin/$WM_OPTIONS
AddPath $FOAM_APPBIN
_foamAddPath $FOAM_APPBIN
setenv FOAM_TUTORIALS $WM_PROJECT_DIR/tutorials
setenv FOAM_UTILITIES $FOAM_APP/utilities
setenv FOAM_SOLVERS $FOAM_APP/solvers
setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
AddLib $FOAM_USER_LIBBIN
_foamAddLib $FOAM_USER_LIBBIN
setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
AddPath $FOAM_USER_APPBIN
_foamAddPath $FOAM_USER_APPBIN
setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
......@@ -84,7 +78,6 @@ set WM_COMPILER_LIB=
# WM_COMPILER_INST = OpenFOAM | System
set WM_COMPILER_INST=OpenFOAM
switch ("$WM_COMPILER_INST")
case OpenFOAM:
switch ("$WM_COMPILER")
......@@ -121,6 +114,9 @@ if ($?WM_COMPILER_BIN) then
endif
endif
unset WM_COMPILER_BIN
unset WM_COMPILER_LIB
# Communications library
# ~~~~~~~~~~~~~~~~~~~~~~
......@@ -136,8 +132,8 @@ case OPENMPI:
# Tell OpenMPI where to find its install directory
setenv OPAL_PREFIX $MPI_ARCH_PATH
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddPath $MPI_ARCH_PATH/bin
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version
......@@ -150,8 +146,8 @@ case LAM:
setenv LAMHOME $WM_THIRD_PARTY_DIR/$mpi_version
# note: LAMHOME is deprecated, should probably point to MPI_ARCH_PATH too
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddPath $MPI_ARCH_PATH/bin
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version
......@@ -163,8 +159,8 @@ case MPICH:
setenv MPI_ARCH_PATH $MPI_HOME/platforms/$WM_OPTIONS
setenv MPICH_ROOT $MPI_ARCH_PATH
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddPath $MPI_ARCH_PATH/bin
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version
......@@ -176,9 +172,9 @@ case MPICH-GM:
setenv MPICH_ROOT $MPI_ARCH_PATH
setenv GM_LIB_PATH /opt/gm/lib64
AddLib $MPI_ARCH_PATH/lib
AddLib $GM_LIB_PATH
AddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH
_foamAddPath $MPI_ARCH_PATH/bin
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-gm
breaksw
......@@ -198,7 +194,7 @@ default:
breaksw
endsw
AddLib $FOAM_MPI_LIBBIN
_foamAddLib $FOAM_MPI_LIBBIN
# Set the MPI buffer size (used by all platforms except SGI MPI)
......@@ -209,7 +205,7 @@ setenv MPI_BUFFER_SIZE 20000000
# CGAL library if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~
if ( $?CGAL_LIB_DIR ) then
AddLib $CGAL_LIB_DIR
_foamAddLib $CGAL_LIB_DIR
endif
......@@ -219,4 +215,11 @@ endif
# setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:${LD_PRELOAD}
#endif
# cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~
unalias _foamAddLib
unalias _foamAddPath
# -----------------------------------------------------------------------------
......@@ -31,13 +31,7 @@
#
#------------------------------------------------------------------------------
if [ "$PS1" -a "$foamDotFile" ]; then
if [ "$FOAM_VERBOSE" ]; then
echo "Executing: $foamDotFile"
fi
fi
AddPath()
_foamAddPath()
{
while [ $# -ge 1 ]
do
......@@ -47,7 +41,7 @@ AddPath()
done
}
AddLib()
_foamAddLib()
{
while [ $# -ge 1 ]
do
......@@ -58,7 +52,7 @@ AddLib()
}
#- Add the system-specifc executables path to the path
#- Add the system-specific executables path to the path
export PATH=$WM_PROJECT_DIR/bin:$FOAM_INST_DIR/$WM_ARCH/bin:$PATH
#- Location of the jobControl directory
......@@ -72,21 +66,21 @@ export PATH=$WM_DIR:$PATH
export FOAM_SRC=$WM_PROJECT_DIR/src
export FOAM_LIB=$WM_PROJECT_DIR/lib
export FOAM_LIBBIN=$FOAM_LIB/$WM_OPTIONS
AddLib $FOAM_LIBBIN
_foamAddLib $FOAM_LIBBIN
export FOAM_APP=$WM_PROJECT_DIR/applications
export FOAM_APPBIN=$WM_PROJECT_DIR/applications/bin/$WM_OPTIONS
AddPath $FOAM_APPBIN
_foamAddPath $FOAM_APPBIN
export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
export FOAM_UTILITIES=$FOAM_APP/utilities
export FOAM_SOLVERS=$FOAM_APP/solvers
export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
AddLib $FOAM_USER_LIBBIN
_foamAddLib $FOAM_USER_LIBBIN
export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
AddPath $FOAM_USER_APPBIN
_foamAddPath $FOAM_USER_APPBIN
export FOAM_RUN=$WM_PROJECT_USER_DIR/run
......@@ -128,11 +122,12 @@ OpenFOAM)
;;
esac
if [ "$WM_COMPILER_BIN" != "" ]; then
if [ -d "$WM_COMPILER_BIN" ]; then
export PATH=$WM_COMPILER_BIN:$PATH
export LD_LIBRARY_PATH=$WM_COMPILER_LIB:$LD_LIBRARY_PATH
fi
unset WM_COMPILER_BIN WM_COMPILER_LIB
# Communications library
# ~~~~~~~~~~~~~~~~~~~~~~
......@@ -148,8 +143,8 @@ OPENMPI)
# Tell OpenMPI where to find its install directory
export OPAL_PREFIX=$MPI_ARCH_PATH
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddPath $MPI_ARCH_PATH/bin
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
......@@ -162,8 +157,8 @@ LAM)
export LAMHOME=$WM_THIRD_PARTY_DIR/$mpi_version
# note: LAMHOME is deprecated, should probably point to MPI_ARCH_PATH too
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddPath $MPI_ARCH_PATH/bin
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
......@@ -175,8 +170,8 @@ MPICH)
export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS
export MPICH_ROOT=$MPI_ARCH_PATH
AddLib $MPI_ARCH_PATH/lib
AddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddPath $MPI_ARCH_PATH/bin
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
......@@ -188,9 +183,9 @@ MPICH-GM)
export MPICH_ROOT=$MPI_ARCH_PATH
export GM_LIB_PATH=/opt/gm/lib64
AddLib $MPI_ARCH_PATH/lib
AddLib $GM_LIB_PATH
AddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH
_foamAddPath $MPI_ARCH_PATH/bin
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-gm
;;
......@@ -210,7 +205,7 @@ MPI)
;;
esac
AddLib $FOAM_MPI_LIBBIN
_foamAddLib $FOAM_MPI_LIBBIN
# Set the MPI buffer size (used by all platforms except SGI MPI)
......@@ -220,7 +215,7 @@ export MPI_BUFFER_SIZE=20000000
# CGAL library if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~
[ -d "$CGAL_LIB_DIR" ] && AddLib $CGAL_LIB_DIR
[ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR
# Switch on the hoard memory allocator if available
......@@ -229,4 +224,9 @@ export MPI_BUFFER_SIZE=20000000
# export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
#fi
# cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~
unset _foamAddLib _foamAddPath
# -----------------------------------------------------------------------------
Supports Markdown
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