mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: more tuning parameters for user environment
- FOAM_CONFIG_NOUSER Suppress use of user/group configuration files. This is useful when packaging for a central installation. - allow additional user tuning of compiler settings. Per-compiler overrides in "compiler-$WM_COMPILER" files
This commit is contained in:
25
etc/bashrc
25
etc/bashrc
@ -27,7 +27,15 @@
|
||||
# - $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION/prefs.sh
|
||||
# - $WM_PROJECT_SITE/site/prefs.sh
|
||||
#
|
||||
# Note: Changes made to this bashrc file may be lost with the next upgrade.
|
||||
# Environment
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
#
|
||||
# Note
|
||||
# Changes made to this bashrc file may be lost with the next upgrade.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
export WM_PROJECT=OpenFOAM
|
||||
@ -130,13 +138,22 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
|
||||
. $WM_PROJECT_DIR/etc/config.sh/functions
|
||||
|
||||
# Overrides via <prefs.sh>
|
||||
_foamEtc -mode=o prefs.sh # 1) other (system) values
|
||||
_foamEtc -mode=ug prefs.sh # 2) user or group values
|
||||
# 1. other (system) values
|
||||
_foamEtc -mode=o prefs.sh
|
||||
|
||||
# 2. user or group values (unless disabled)
|
||||
[ -z "$FOAM_CONFIG_NOUSER" ] && _foamEtc -mode=ug prefs.sh
|
||||
|
||||
# Evaluate command-line parameters and record settings for later.
|
||||
# These can be used to set/unset values, specify additional files etc.
|
||||
export FOAM_SETTINGS="$@"
|
||||
FOAM_SETTINGS="$@"
|
||||
if [ -z "$FOAM_SETTINGS" ]
|
||||
then
|
||||
unset FOAM_SETTINGS
|
||||
else
|
||||
export FOAM_SETTINGS
|
||||
_foamEval $@
|
||||
fi
|
||||
|
||||
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -15,12 +15,14 @@
|
||||
#
|
||||
# Description
|
||||
# Setup for custom compiler versions for OpenFOAM
|
||||
# Per-compiler overrides in "compiler-$WM_COMPILER" files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
switch ("$WM_COMPILER_TYPE")
|
||||
case ThirdParty:
|
||||
# Default versions of GMP, MPFR, MPC - override as necessary
|
||||
|
||||
set gmp_version=gmp-system
|
||||
set mpfr_version=mpfr-system
|
||||
set mpc_version=mpc-system
|
||||
@ -102,6 +104,9 @@ Please check your settings
|
||||
UNKNOWN_COMPILER
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
# Per-compiler overrides in "compiler-$WM_COMPILER" files
|
||||
_foamEtc -config "compiler-$WM_COMPILER"
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
|
||||
@ -35,10 +35,18 @@ alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`'
|
||||
|
||||
# Source an etc file, possibly with some verbosity
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
if ($?FOAM_CONFIG_NOUSER) then
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose -mode=o \!*`'
|
||||
else
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
|
||||
endif
|
||||
else
|
||||
if ($?FOAM_CONFIG_NOUSER) then
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh -mode=o \!*`'
|
||||
else
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#
|
||||
# Description
|
||||
# Setup for custom compiler versions for OpenFOAM
|
||||
# Per-compiler overrides in "compiler-$WM_COMPILER" files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -100,6 +101,9 @@ Please check your settings
|
||||
UNKNOWN_COMPILER
|
||||
;;
|
||||
esac
|
||||
|
||||
# Per-compiler overrides in "compiler-$WM_COMPILER" files
|
||||
_foamEtc -config "compiler-$WM_COMPILER"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
# Description
|
||||
# Shell functions and variables used when sourcing the OpenFOAM environment
|
||||
#
|
||||
# Some functionality is shadowed in bin/tools/lib-dir
|
||||
# Some functionality mirrored by bin/tools/lib-dir
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -33,11 +33,27 @@ then
|
||||
# Cleaning environment variables
|
||||
_foamClean()
|
||||
{
|
||||
local var=$1
|
||||
foamVar_name=$1
|
||||
shift
|
||||
eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=$var "$@")
|
||||
eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=$foamVar_name "$@")
|
||||
unset foamVar_name
|
||||
}
|
||||
|
||||
# Source an etc file, possibly with some verbosity
|
||||
# - use eval to avoid intermediate variables (ksh doesn't have 'local')
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
_foamEtc()
|
||||
{
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh-verbose ${FOAM_CONFIG_NOUSER:+-mode=o} $@)";
|
||||
}
|
||||
else
|
||||
_foamEtc()
|
||||
{
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} $@)";
|
||||
}
|
||||
fi
|
||||
|
||||
# Prepend PATH
|
||||
_foamAddPath()
|
||||
{
|
||||
@ -133,15 +149,6 @@ then
|
||||
fi
|
||||
|
||||
|
||||
# Source an etc file, possibly with some verbosity
|
||||
# - use eval to avoid intermediate variables (ksh doesn't have 'local')
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
_foamEtc(){ eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh-verbose $@)"; }
|
||||
else
|
||||
_foamEtc(){ eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh $@)"; }
|
||||
fi
|
||||
|
||||
# Evaluate command-line parameters
|
||||
_foamEval()
|
||||
{
|
||||
|
||||
20
etc/cshrc
20
etc/cshrc
@ -27,7 +27,15 @@
|
||||
# - $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION/prefs.csh
|
||||
# - $WM_PROJECT_SITE/site/prefs.csh
|
||||
#
|
||||
# Note: Changes made to this cshrc file may be lost with the next upgrade.
|
||||
# Environment
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
#
|
||||
# Note
|
||||
# Changes made to this cshrc file may be lost with the next upgrade.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
setenv WM_PROJECT OpenFOAM
|
||||
@ -141,8 +149,13 @@ setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
|
||||
source $WM_PROJECT_DIR/etc/config.csh/functions
|
||||
|
||||
# Overrides via <prefs.csh>
|
||||
_foamEtc -mode=o prefs.csh # 1) other (system) systems
|
||||
_foamEtc -mode=ug prefs.csh # 2) user or group settings
|
||||
# 1. other (system) values
|
||||
_foamEtc -mode=o prefs.csh
|
||||
|
||||
# 2. user or group values (unless disabled)
|
||||
if (! $?FOAM_CONFIG_NOUSER ) then
|
||||
_foamEtc -mode=ug prefs.csh
|
||||
endif
|
||||
|
||||
# Evaluate command-line parameters and record settings for later.
|
||||
# These can be used to set/unset values, specify additional files etc.
|
||||
@ -188,7 +201,6 @@ _foamClean PATH "$foamOldDirs"
|
||||
_foamClean MANPATH "$foamOldDirs"
|
||||
_foamClean LD_LIBRARY_PATH "$foamOldDirs"
|
||||
|
||||
|
||||
# Setup for OpenFOAM compilation etc
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
_foamEtc -config settings
|
||||
|
||||
Reference in New Issue
Block a user