diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index f0536bd694a462f1b2fa35f69b7862fdbbc92823..acaa5455aad742257aa35132712b63a27ddddfbf 100644 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -50,15 +50,30 @@ USAGE # inlineSed <file> <sedCommand> <description> _inlineSed() { - backup=`tempfile` + [ -f "$1" ] || { + echo "Missing file: $1" + exit 1 + } + + backup="temp.$$" cp $1 $backup sed -i -e "$2" $1 - cmp --quiet $1 $backup && usage "Failed : $3" + + if cmp $1 $backup > /dev/null 2>&1 + then + echo "Failed: $3 in $1" + rm $backup 2>/dev/null + exit 1 + else + echo "Okay: $3 in $1" + rm $backup 2>/dev/null + fi + return 0 } -[ -f etc/bashrc -a -f etc/settings.sh ] || usage "Please run from top-level directory of installation" +[ -f etc/bashrc ] || usage "Please run from top-level directory of installation" unset foamInstall projectName archOption paraviewInstall @@ -66,39 +81,43 @@ unset foamInstall projectName archOption paraviewInstall while [ "$#" -gt 0 ] do case "$1" in - -h | --help) + -h | -help | --help) usage ;; - --foamInstall) + -foamInstall | --foamInstall) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" foamInstall="$2" + # replace foamInstall=... _inlineSed \ etc/bashrc \ '/^[^#]/s@foamInstall=.*@foamInstall='"$foamInstall@" \ "Replacing foamInstall setting by '$foamInstall'" shift 2 ;; - --projectName) + -projectName | --projectName) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" projectName="$2" + # replace WM_PROJECT_DIR=... _inlineSed \ etc/bashrc \ '/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" \ "Replacing WM_PROJECT_DIR setting by '$projectName'" shift 2 ;; - --archOption) + -archOption | --archOption) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" archOption="$2" + # replace WM_ARCH_OPTION=... _inlineSed \ etc/bashrc \ - '/^[^#]/s@: ${WM_ARCH_OPTION:=64}@WM_ARCH_OPTION='"$archOption@" \ + '/^[^#]/s@WM_ARCH_OPTION=.*@WM_ARCH_OPTION='"$archOption@" \ "Replacing WM_ARCH_OPTION setting by '$archOption'" shift 2 ;; - --paraviewInstall) + -paraviewInstall | --paraviewInstall) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" paraviewInstall="$2" + # replace ParaView_DIR=... _inlineSed \ etc/apps/paraview3/bashrc \ '/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='"$paraviewInstall@" \ @@ -116,15 +135,16 @@ done #echo "Replacing WM_PROJECT setting by '$projectName'" #sed -i -e 's@WM_PROJECT=.*@WM_PROJECT='"$projectName@" etc/bashrc -# Replace the WM_MPLIB always +# Set WM_MPLIB=SYSTEMOPENMPI always _inlineSed \ etc/bashrc \ - '/^[^#]/s@: ${WM_MPLIB:=.*}@WM_MPLIB=SYSTEMOPENMPI@' \ + '/^[^#]/s@export WM_MPLIB=.*@export WM_MPLIB=SYSTEMOPENMPI@' \ "Replacing WM_MPLIB setting by 'SYSTEMOPENMPI'" -# Replace the foamCompiler always + +# set foamCompiler=system always _inlineSed \ - etc/settings.sh \ - '/^[^#]/s@: ${foamCompiler:=.*}@foamCompiler=system@' \ + etc/bashrc \ + '/^[^#]/s@foamCompiler=.*@foamCompiler=system@' \ "Replacing foamCompiler setting by 'system'" #------------------------------------------------------------------------------ diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc index 5487d2e8db113fc891775931d428be6c07824daf..0be7e237196778ca07e577bc4c9d824360119f56 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/apps/paraview3/bashrc @@ -26,7 +26,7 @@ # # Description # Setup file for paraview-3.x -# Sourced from OpenFOAM-*/etc/bashrc or from foamPV alias +# Sourced from OpenFOAM-<VERSION>/etc/bashrc or from foamPV alias # # Note # The env. variables 'ParaView_DIR' and 'ParaView_MAJOR' @@ -51,8 +51,14 @@ done # set VERSION and MAJOR (version) variables -ParaView_VERSION=3.8.0 -ParaView_MAJOR=unknown +if [ -z "$ParaView_VERSION" ] +then + ParaView_VERSION=3.8.0 + ParaView_MAJOR=unknown + echo "Warning in app/paraview3/bashrc:" 1>&2 + echo " ParaView_VERSION not set, using '$ParaView_VERSION'" 1>&2 +fi +[ -n "$ParaView_MAJOR" ] || ParaView_MAJOR=unknown # if needed, set MAJOR version to correspond to VERSION # ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index 850eb78d27983bbbef90f55332c185c60fedb5f4..dc52735480cfa8bea5284e3155697da67a922741 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -26,7 +26,7 @@ # # Description # Setup file for paraview-3.x -# Sourced from OpenFOAM-*/etc/cshrc or from foamPV alias +# Sourced from OpenFOAM-<VERSION>/etc/cshrc or from foamPV alias # # Note # The env. variables 'ParaView_DIR' and 'ParaView_MAJOR' @@ -49,8 +49,14 @@ foreach cmake ( cmake-2.8.3 cmake-2.8.1 cmake-2.8.0 cmake-2.6.4 ) end # set VERSION and MAJOR (version) variables -setenv ParaView_VERSION 3.8.0 -setenv ParaView_MAJOR unknown +if ( ! $?ParaView_VERSION ) +then + setenv ParaView_VERSION 3.8.0 + setenv ParaView_MAJOR unknown + echo "Warning in app/paraview3/cshrc:" + echo " ParaView_VERSION not set, using '$ParaView_VERSION'" +fi +if ( ! $?ParaView_MAJOR ) setenv ParaView_MAJOR unknown # if needed, set MAJOR version to correspond to VERSION # ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION diff --git a/etc/bashrc b/etc/bashrc index 2b0e3d0be71897e8f825e5d6dcb0a40f7a6b8f05..c95a7951bba68b7f91627faf5a9840a511e6ba7e 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -35,24 +35,73 @@ export WM_PROJECT=OpenFOAM export WM_PROJECT_VERSION=dev ################################################################################ -# USER EDITABLE PART. Note changes made here may be lost with the next upgrade +# USER EDITABLE PART: Changes made here may be lost with the next upgrade # # either set $FOAM_INST_DIR before sourcing this file or set -# $foamInstall below to where OpenFOAM is installed +# 'foamInstall' below to where OpenFOAM is installed # # Location of the OpenFOAM installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foamInstall=$HOME/$WM_PROJECT # foamInstall=~$WM_PROJECT -# foamInstall=/usr/local/$WM_PROJECT # foamInstall=/opt/$WM_PROJECT +# foamInstall=/usr/local/$WM_PROJECT # # END OF (NORMAL) USER EDITABLE PART ################################################################################ -# note the location for later use (eg, in job scripts) +# +# These are the defaults for this version which should generally be +# overridden from the prefs.sh file or from command-line specification +# +#- note the location for later use (eg, in job scripts) : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR +#- ParaView version, automatically determine major version: +export ParaView_VERSION=3.8.0 +export ParaView_MAJOR=unknown + +#- Compiler location: +# foamCompiler= system | ThirdParty (OpenFOAM) +foamCompiler=system + +#- Compiler: +# WM_COMPILER = Gcc | Gcc43 | Gcc44 | Gcc45 | Clang | Icc (Intel icc) +export WM_COMPILER=Gcc +unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH + +#- Architecture: +# WM_ARCH_OPTION = 32 | 64 +export WM_ARCH_OPTION=64 + +#- Precision: +# WM_PRECISION_OPTION = DP | SP +export WM_PRECISION_OPTION=DP + +#- Optimised, debug, profiling: +# WM_COMPILE_OPTION = Opt | Debug | Prof +export WM_COMPILE_OPTION=Opt + +#- MPI implementation: +# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI +# | GAMMA | MPI | QSMPI +export WM_MPLIB=OPENMPI + +#- Operating System: +# WM_OSTYPE = POSIX | ??? +export WM_OSTYPE=POSIX + +#- Floating-point signal handling: +# set or unset +export FOAM_SIGFPE= + +#- memory initialisation: +# set or unset +#export FOAM_SETNAN= + + +################################################################################ + # The old dirs to be cleaned from the various environment variables # - remove anything under top-level directory. # NB: the WM_PROJECT_INST_DIR might not be identical between versions @@ -90,6 +139,7 @@ _foamSource() _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` # Evaluate command-line parameters and record settings for later +# these can be used to set/unset values, or specify prefs files export FOAM_SETTINGS="$@" while [ $# -gt 0 ] do @@ -116,41 +166,6 @@ do done -# Operating System/Platform -# ~~~~~~~~~~~~~~~~~~~~~~~~~ -# WM_OSTYPE = POSIX | ???? -: ${WM_OSTYPE:=POSIX}; export WM_OSTYPE - - -# Compiler: set to Gcc, Gcc43, Gcc44, or Icc (for Intel's icc) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -: ${WM_COMPILER:=Gcc}; export WM_COMPILER - -unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH - - -# Compilation options (architecture, precision, optimised, debug or profiling) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# WM_ARCH_OPTION = 32 | 64 -: ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION - -# WM_PRECISION_OPTION = DP | SP -: ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION - -# WM_COMPILE_OPTION = Opt | Debug | Prof -: ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION - -# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA -# | MPI | QSMPI -: ${WM_MPLIB:=OPENMPI}; export WM_MPLIB - - -# Run options (floating-point signal handling and memory initialisation) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -export FOAM_SIGFPE= -# export FOAM_SETNAN= - - # Detect system type and set environment variables appropriately # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export WM_ARCH=`uname -s` @@ -165,7 +180,7 @@ Linux) ;; x86_64) - case $WM_ARCH_OPTION in + case "$WM_ARCH_OPTION" in 32) export WM_COMPILER_ARCH='-64' export WM_CC='gcc' @@ -196,13 +211,13 @@ Linux) mips64) WM_ARCH=SiCortex64 + WM_MPLIB=MPI export WM_COMPILER_LIB_ARCH=64 export WM_CC='gcc' export WM_CXX='g++' export WM_CFLAGS='-mabi=64 -fPIC' export WM_CXXFLAGS='-mabi=64 -fPIC' export WM_LDFLAGS='-mabi=64 -G0' - export WM_MPLIB=MPI ;; ppc64) @@ -223,13 +238,13 @@ Linux) SunOS) WM_ARCH=SunOS64 + WM_MPLIB=FJMPI export WM_COMPILER_LIB_ARCH=64 export WM_CC='gcc' export WM_CXX='g++' export WM_CFLAGS='-mabi=64 -fPIC' export WM_CXXFLAGS='-mabi=64 -fPIC' export WM_LDFLAGS='-mabi=64 -G0' - export WM_MPLIB=FJMPI ;; *) # an unsupported operating system diff --git a/etc/cshrc b/etc/cshrc index 0ef3f0ce78ce345c33d931f32ced7fe6c155a4d5..2a7369913779bc24c3a66e47dd79220b3e27f82c 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -34,24 +34,74 @@ setenv WM_PROJECT OpenFOAM setenv WM_PROJECT_VERSION dev ################################################################################ -# USER EDITABLE PART. Note changes made here may be lost with the next upgrade +# USER EDITABLE PART: Changes made here may be lost with the next upgrade # -# either setenv FOAM_INST_DIR before sourcing this file or set -# foamInstall below to where OpenFOAM is installed +# either setenv FOAM_INST_DIR before sourcing this file or set +# 'foamInstall' below to where OpenFOAM is installed # # Location of the OpenFOAM installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ set foamInstall = $HOME/$WM_PROJECT # set foamInstall = ~$WM_PROJECT -# set foamInstall = /usr/local/$WM_PROJECT # set foamInstall = /opt/$WM_PROJECT +# set foamInstall = /usr/local/$WM_PROJECT # # END OF (NORMAL) USER EDITABLE PART ################################################################################ -# note the location for later use (eg, in job scripts) +# +# These are the defaults for this version which should generally be +# overridden from the prefs.csh file or from command-line specification +# +#- note the location for later use (eg, in job scripts) if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall +#- ParaView version, automatically determine major version: +setenv ParaView_VERSION 3.8.0 +setenv ParaView_MAJOR unknown + +#- Compiler location: +# foamCompiler= system | ThirdParty (OpenFOAM) +set foamCompiler=system + +#- Compiler: +# WM_COMPILER = Gcc | Gcc43 | Gcc44 | Gcc45 | Clang | Icc (Intel icc) +setenv WM_COMPILER Gcc +setenv WM_COMPILER_ARCH # defined but empty +setenv WM_COMPILER_LIB_ARCH # defined but empty +# +#- Architecture: +# WM_ARCH_OPTION = 32 | 64 +setenv WM_ARCH_OPTION 64 + +#- Precision: +# WM_PRECISION_OPTION = DP | SP +setenv WM_PRECISION_OPTION DP + +#- Optimised, debug, profiling: +# WM_COMPILE_OPTION = Opt | Debug | Prof +setenv WM_COMPILE_OPTION Opt + +#- MPI implementation: +# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI +# | GAMMA | MPI | QSMPI +setenv WM_MPLIB OPENMPI + +#- Operating System: +# WM_OSTYPE = POSIX | ??? +setenv WM_OSTYPE POSIX + +#- Floating-point signal handling: +# set or unset +setenv FOAM_SIGFPE + +#- memory initialisation: +# set or unset +#setenv FOAM_SETNAN + + +################################################################################ + # The old dirs to be cleaned from the various environment variables # - remove anything under top-level directory. # NB: the WM_PROJECT_INST_DIR might not be identical between versions @@ -75,6 +125,7 @@ alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh` # Evaluate command-line parameters and record settings for later +# these can be used to set/unset values, or specify prefs files setenv FOAM_SETTINGS "${*}" while ( $#argv > 0 ) switch ($argv[1]) @@ -99,41 +150,6 @@ while ( $#argv > 0 ) end -# Operating System/Platform -# ~~~~~~~~~~~~~~~~~~~~~~~~~ -# WM_OSTYPE = POSIX | ???? -if ( ! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX - - -# Compiler: set to Gcc, Gcc43, Gcc44 or Icc (for Intel's icc) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc - -setenv WM_COMPILER_ARCH -setenv WM_COMPILER_LIB_ARCH - - -# Compilation options (architecture, precision, optimised, debug or profiling) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# WM_ARCH_OPTION = 32 | 64 -if ( ! $?WM_ARCH_OPTION ) setenv WM_ARCH_OPTION 64 - -# WM_PRECISION_OPTION = DP | SP -if ( ! $?WM_PRECISION_OPTION ) setenv WM_PRECISION_OPTION DP - -# WM_COMPILE_OPTION = Opt | Debug | Prof -if ( ! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION Opt - -# WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI -if ( ! $?WM_MPLIB ) setenv WM_MPLIB OPENMPI - - -# Run options (floating-point signal handling and memory initialisation) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -setenv FOAM_SIGFPE -# setenv FOAM_SETNAN - - # Detect system type and set environment variables # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ setenv WM_ARCH `uname -s` @@ -181,13 +197,13 @@ case Linux: case mips64: setenv WM_ARCH SiCortex64 + setenv WM_MPLIB MPI setenv WM_COMPILER_LIB_ARCH 64 setenv WM_CC 'gcc' setenv WM_CXX 'g++' setenv WM_CFLAGS '-mabi=64 -fPIC' setenv WM_CXXFLAGS '-mabi=64 -fPIC' setenv WM_LDFLAGS '-mabi=64 -G0' - setenv WM_MPLIB MPI breaksw case ppc64: @@ -209,13 +225,13 @@ case Linux: case SunOS: setenv WM_ARCH SunOS64 + setenv WM_MPLIB FJMPI setenv WM_COMPILER_LIB_ARCH 64 setenv WM_CC 'gcc' setenv WM_CXX 'g++' setenv WM_CFLAGS '-mabi=64 -fPIC' setenv WM_CXXFLAGS '-mabi=64 -fPIC' setenv WM_LDFLAGS '-mabi=64 -G0' - setenv WM_MPLIB FJMPI breaksw default: diff --git a/etc/settings.csh b/etc/settings.csh index 6713fda203fadd88078b4129007e933ff025e9a5..36ede3f98a747752c94b087ebd1318cfdafd5e12 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -83,10 +83,14 @@ unset gcc_version gmp_version mpfr_version mpc_version unsetenv MPFR_ARCH_PATH -# Select compiler installation -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# foamCompiler = system | ThirdParty (OpenFOAM) -if ( ! $?foamCompiler ) set foamCompiler=system +# Location of compiler installation +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +if ( ! $?foamCompiler ) then +then + foamCompiler=system + echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo " foamCompiler not set, using '$foamCompiler'" +fi switch ("$foamCompiler") case OpenFOAM: @@ -146,7 +150,7 @@ case ThirdParty: echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" echo " Cannot find $gccDir installation." echo " Please install this compiler version or if you wish to use the system compiler," - echo " change the 'foamCompiler' setting to 'system' in this file" + echo " change the 'foamCompiler' setting to 'system'" echo endif @@ -184,7 +188,7 @@ case ThirdParty: echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" echo " Cannot find $clangDir installation." echo " Please install this compiler version or if you wish to use the system compiler," - echo " change the 'foamCompiler' setting to 'system' in this file" + echo " change the 'foamCompiler' setting to 'system'" echo endif @@ -194,6 +198,15 @@ case ThirdParty: unset clang_version clangDir breaksw + +case system: + # okay, use system compiler + breaksw + +default: + echo "Warn: foamCompiler='$foamCompiler' is unsupported" + echo " treating as 'system' instead" + breaksw endsw diff --git a/etc/settings.sh b/etc/settings.sh index 4a55023568bd30d00523434cb05987da03d5783d..7f1083e0b870ab14c3b68d84dcded4dbbcd5c49d 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -105,10 +105,14 @@ _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_LIBBIN/dummy unset gcc_version gmp_version mpfr_version mpc_version unset MPFR_ARCH_PATH -# Select compiler installation -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# foamCompiler = system | ThirdParty (OpenFOAM) -: ${foamCompiler:=system} +# Location of compiler installation +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +if [ -z "$foamCompiler" ] +then + foamCompiler=system + echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" 1>&2 + echo " foamCompiler not set, using '$foamCompiler'" 1>&2 +fi case "${foamCompiler}" in OpenFOAM | ThirdParty) @@ -163,7 +167,7 @@ OpenFOAM | ThirdParty) echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" echo " Cannot find $gccDir installation." echo " Please install this compiler version or if you wish to use the system compiler," - echo " change the 'foamCompiler' setting to 'system' in this file" + echo " change the 'foamCompiler' setting to 'system'" echo } @@ -204,7 +208,7 @@ OpenFOAM | ThirdParty) echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" echo " Cannot find $clangDir installation." echo " Please install this compiler version or if you wish to use the system compiler," - echo " change the 'foamCompiler' setting to 'system' in this file" + echo " change the 'foamCompiler' setting to 'system'" echo } @@ -213,6 +217,13 @@ OpenFOAM | ThirdParty) fi unset clang_version clangDir ;; +system) + # okay, use system compiler + ;; +*) + echo "Warn: foamCompiler='$foamCompiler' is unsupported" 1>&2 + echo " treating as 'system' instead" 1>&2 + ;; esac