ENH: improved handling of gmp/mpfr library settings (issue #674)

- export library path for gmp/mpfr from CGAL config files.
  This is required when non-system gmp/mpfr libraries are being
  used, but not using a ThirdParty compiler installation.

- automatically handle lib/ vs lib64/ (eg, for central installations)
  for packages such as boost, CGAL, etc. While the ThirdParty
  compilation of these will normally land in lib64/, this may not be
  the case when they are supplied by another means.

- reworked the handling of foamEtcFile and foamCleanPath for less
  clutter in the configuration files.
  Added the bin/tools/lib-dir script to handle logic that is
  too complex to easily manage in csh.
This commit is contained in:
Mark Olesen
2018-01-11 01:30:23 +01:00
parent 2d51d4b340
commit 110b00f048
47 changed files with 763 additions and 383 deletions

View File

@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -15,6 +15,7 @@
# #
# Description # Description
# Usage: foamCleanPath [OPTION] path [wildcard] .. [wildcard] # Usage: foamCleanPath [OPTION] path [wildcard] .. [wildcard]
# foamCleanPath [OPTION] -env=name [wildcard1] .. [wildcardN]
# #
# Prints its argument (which should be a ':' separated path) # Prints its argument (which should be a ':' separated path)
# without the following: # without the following:
@ -23,24 +24,48 @@
# - inaccessible directories (with the -strip option) # - inaccessible directories (with the -strip option)
# #
# Note # Note
# - this routine will fail when directories have embedded spaces # - this routine fails when directories have embedded spaces
# - false matches possible if a wildcard contains '.' (sed regex) # - false matches possible if a wildcard contains '.' (sed regex)
# - the wildcards themselves can be written together and separated # - the wildcards themselves can be written together and separated
# by colons or whitespace # by colons or whitespace
#
# Examples for cleaning the path:
#
# - Using explicit arguments
# cleaned=$(foamCleanPath "$PATH" dir1:dir2) && PATH=$cleaned
#
# - Variable to clean passed as an option
# cleaned=$(foamCleanPath -env=PATH dir1:dir2) && PATH=$cleaned
#
# - Using shell evaluation for the output
# eval $(foamCleanPath -sh=PATH "$PATH" dir1:dir2)
# eval $(foamCleanPath -sh=PATH -env=PATH dir1:dir2)
# eval $(foamCleanPath -sh-env=PATH dir1:dir2)
#
# - Similarly for c-shell
# eval `foamCleanPath -csh-env=PATH dir1:dir2`
#
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { usage() {
cat <<USAGE 1>&2 cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN] Usage: foamCleanPath [OPTION] path [wildcard1] .. [wildcardN]]
foamCleanPath [OPTION] -env=name [wildcard1] .. [wildcardN]
options: options:
-csh=NAME Produce 'setenv NAME ...' output for csh eval
-sh=NAME Produce 'NAME=...' output for sh eval
-csh-env=NAME As per -csh, with -env for initial content
-sh-env=NAME As per -sh, with -env for initial content
-env=NAME Evaluate NAME to obtain initial content
-debug print debug information to stderr -debug print debug information to stderr
-strip remove inaccessible directories -strip remove inaccessible directories
-verbose report some progress (input, output, ...) -verbose report some progress (input, output, ...)
-help print the usage -help print the usage
Prints its argument (which should be a ':' separated list) cleansed from Prints its argument (which should be a ':' separated list) cleansed from
- duplicate elements * duplicate elements
- elements whose start matches one of the wildcard(s) * elements whose start matches one of the wildcard(s)
- inaccessible directories (with the -strip option) * inaccessible directories (the -strip option)
Exit status Exit status
0 on success 0 on success
@ -51,15 +76,58 @@ USAGE
exit 1 exit 1
} }
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See 'foamCleanPath -help' for usage"
echo
exit 1
}
#-------------------------------------------------------------------------------
# Input and outputs
unset dirList shellOutput
# Parse options # Parse options
unset optDebug optStrip optVerbose unset optDebug optEnvName optStrip optVerbose
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
-h | -help*) -h | -help*)
usage usage
;; ;;
-csh=* | -sh=* | -csh-env=* | -sh-env=*)
name="${1#*=}"
[ -n "$name" ] || die "Option '$1' missing an ENVNAME"
# Output prefix
case "$1" in
-csh*)
shellOutput="setenv $name " # eg, "setenv PATH xyz"
;;
*)
shellOutput="$name=" # eg, "PATH=xyz"
;;
esac
# For (-csh-env | -sh-env) also use name for input evaluation
case "$1" in
*-env=*)
optEnvName="$name"
;;
esac
;;
-env=*)
name="${1#*=}"
[ -n "$name" ] || die "Option '$1' missing an ENVNAME"
optEnvName="$name"
;;
-debug) -debug)
optDebug=true optDebug=true
;; ;;
@ -76,11 +144,18 @@ do
shift shift
done done
# Basic checks, setup
[ "$#" -ge 1 ] || usage
dirList="$1" # Basic checks
shift if [ -n "$optEnvName" ]
then
eval "dirList=\$$optEnvName"
elif [ "$#" -ge 1 ]
then
dirList="$1"
shift
else
die "Requires at least one argument, or use the -env option"
fi
[ -n "$dirList" ] || exit 2 # Quick exit on empty 'dirList' [ -n "$dirList" ] || exit 2 # Quick exit on empty 'dirList'
@ -105,8 +180,8 @@ fi
# The "wildcard1 ... wildcardN" may have been passed as a single parameter # The "wildcard1 ... wildcardN" may have been passed as a single parameter
# or may contain ':' separators # or may contain ':' separators
oldIFS="$IFS" # Preserve initial IFS oldIFS="$IFS" # Preserve initial IFS
IFS=': ' # Split on colon, whitespace IFS=': ' # Split on colon, whitespace
set -- $* set -- $*
if [ -n "$optVerbose" ] if [ -n "$optVerbose" ]
@ -128,10 +203,10 @@ do
done done
printDebug "intermediate>$dirList<" printDebug "intermediate>$dirList<"
IFS=': ' # Split on colon, whitespace (to avoid surprises) IFS=': ' # Split on colon, whitespace (to avoid surprises)
set -- $dirList set -- $dirList
IFS="$oldIFS" # Restore initial IFS IFS="$oldIFS" # Restore initial IFS
# Rebuild the list # Rebuild the list
unset dirList unset dirList
@ -153,12 +228,11 @@ do
done done
printDebug "output>$dirList<" printDebug "output>$dirList<"
if [ -n "$optVerbose" ] if [ -n "$optVerbose" ]
then then
echo "output: $dirList" 1>&2 echo "output: $dirList" 1>&2
fi fi
echo "$dirList" echo "$shellOutput$dirList"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -56,10 +56,13 @@ options:
-mode=MODE Any combination of u(user), g(group), o(other) -mode=MODE Any combination of u(user), g(group), o(other)
-prefix=DIR Specify an alternative installation prefix -prefix=DIR Specify an alternative installation prefix
-version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...) -version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...)
-csh Produce output suitable for a csh or sh 'eval' -csh Produce 'source FILE' output for a csh eval
-csh-verbose As per -csh with additional verbosity -sh Produce '. FILE' output for a sh eval
-sh Produce output suitable for a csh or sh 'eval' -csh-verbose As per -csh, with additional verbosity
-sh-verbose As per -sh with additional verbosity -sh-verbose As per -sh, with additional verbosity
-config Add config directory prefix for shell type:
with -csh* for a config.csh/ prefix
with -sh* for a config.sh/ prefix
-quiet (-q) Suppress all normal output -quiet (-q) Suppress all normal output
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output -silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
-help Print the usage -help Print the usage
@ -81,7 +84,6 @@ USAGE
exit 0 # A clean exit exit 0 # A clean exit
} }
unset optQuiet optSilent unset optQuiet optSilent
# Report error and exit # Report error and exit
die() die()
@ -183,7 +185,8 @@ setVersion()
optMode=ugo # Default mode is always 'ugo' optMode=ugo # Default mode is always 'ugo'
unset optAll optList optShell optVersion unset shellOutput verboseOutput
unset optAll optConfig optList optVersion
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
@ -194,19 +197,24 @@ do
;; ;;
-a | -all) -a | -all)
optAll=true optAll=true
unset optShell unset shellOutput verboseOutput
;; ;;
-l | -list) -l | -list)
optList=true optList=true
unset optShell
;; ;;
-list-test) -list-test)
optList='test' optList='test'
unset optShell
;; ;;
-csh | -sh | -csh-verbose | -sh-verbose) -csh | -sh)
optShell="${1#-}" shellOutput="${1#-}"
unset optAll unset verboseOutput
;;
-csh-verbose | -sh-verbose)
shellOutput="${1#-}"
verboseOutput="source " # Report: "source FILE"
;;
-config)
optConfig=true
;; ;;
-mode=[ugo]*) -mode=[ugo]*)
optMode="${1#*=}" optMode="${1#*=}"
@ -260,7 +268,6 @@ do
shift shift
done done
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
if [ -n "$optVersion" ] if [ -n "$optVersion" ]
@ -309,27 +316,61 @@ case "$optMode" in (*o*) # (O)ther == shipped
esac esac
set -- $dirList set -- $dirList
[ "$#" -ge 1 ] || die "No directories to scan. Programming error?"
exitCode=2 # Fallback is a FileNotFound error
#
# Preliminaries
#
# Special handling of config.sh/ , config.csh/ directories
if [ -n "$optConfig" -a -n "$shellOutput" -a -n "$fileName" ]
then
case "$shellOutput" in
csh*)
optConfig="config.csh/"
;;
sh*)
optConfig="config.sh/"
;;
*)
unset optConfig
;;
esac
if [ -n "$optConfig" ]
then
case "$fileName" in
/* | config.csh* | config.sh*)
# Does not need or cannot add a prefix
unset optConfig
;;
*)
fileName="$optConfig$fileName"
;;
esac
fi
fi
# #
# The main routine # The main routine
# #
exitCode=0
if [ -n "$optList" ] if [ -n "$optList" ]
then then
# List directories, or potential file locations # List directories, or potential file locations
[ "$nArgs" -le 1 ] || \ [ "$nArgs" -le 1 ] || \
die "-list expects 0 or 1 filename, but $nArgs provided" die "-list options expect 0 or 1 filename, but $nArgs provided"
# A silly combination, but -quiet does have precedence # A silly combination, but -quiet has absolute precedence
[ -n "$optQuiet" ] && exit 0 [ -n "$optQuiet" ] && exit 0
# Test for directory or file too? # Test for directory or file too?
if [ "$optList" = "test" ] if [ "$optList" = "test" ]
then then
exitCode=2 # Fallback to a general error (file not found)
if [ "$nArgs" -eq 1 ] if [ "$nArgs" -eq 1 ]
then then
for dir for dir
@ -352,6 +393,7 @@ then
done done
fi fi
else else
exitCode=0 # OK, already verified that $# != 0
for dir for dir
do do
echo "$dir${fileName:+/}$fileName" echo "$dir${fileName:+/}$fileName"
@ -362,35 +404,39 @@ else
[ "$nArgs" -eq 1 ] || die "One filename expected - $nArgs provided" [ "$nArgs" -eq 1 ] || die "One filename expected - $nArgs provided"
exitCode=2 # Fallback to a general error (file not found) # Output for sourcing files ("source" for csh, "." for POSIX shell)
# Only allow sourcing a single file (disallow combination with -all)
case "$shellOutput" in
csh*)
shellOutput="source " # eg, "source FILE"
;;
sh*)
shellOutput=". " # eg, ". FILE"
;;
esac
# Anti-pattern: -all disables shell commands
if [ -n "$optAll" ]
then
unset shellOutput verboseOutput
fi
for dir for dir
do do
if [ -f "$dir/$fileName" ] resolved="$dir/$fileName"
if [ -f "$resolved" ]
then then
exitCode=0 exitCode=0 # OK
[ -n "$optQuiet" ] && break if [ -n "$optQuiet" ]
then
case "$optShell" in
(*verbose)
echo "Using: $dir/$fileName" 1>&2
;;
esac
case "$optShell" in
csh*)
echo "source $dir/$fileName"
break break
;; elif [ -n "$verboseOutput" ]
sh*) then
echo ". $dir/$fileName" echo "$verboseOutput$resolved" 1>&2
break fi
;;
*) echo "$shellOutput$resolved"
echo "$dir/$fileName" [ -n "$optAll" ] || break
[ -n "$optAll" ] || break
;;
esac
fi fi
done done

162
bin/tools/lib-dir Executable file
View File

@ -0,0 +1,162 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# Script
# tools/lib-dir [OPTION] DIR [LIBEXT]
#
# Description
# Since csh/tcsh doesn't have functions, this script can be used to manage
# slightly more complex logic.
#
# Resolves for the existence of DIR/lib64 and DIR/lib, or uses the fallback
# LIBEXT if these failed. A DIR ending in "-none" or "-system" is skipped.
#
# output -csh: setenv LD_LIBRARY_PATH dir/lib:$LD_LIBRARY_PATH
# output -make: -Ldir/lib
# output -sh: LD_LIBRARY_PATH=dir/lib:$LD_LIBRARY_PATH
#
#------------------------------------------------------------------------------
printHelp() {
cat<<USAGE
Usage: ${0##*/} [OPTION] DIR [LIBEXT]
options:
-sh Emit POSIX shell syntax (default)
-csh Emit C-shell shell syntax
-make Emit content for a makefile
-help Print the usage
Resolves for the existence of DIR/lib64 and DIR/lib, or uses the fallback
LIBEXT if these failed. A DIR ending in "-none" or "-system" is skipped.
With -sh LD_LIBRARY_PATH=dir/lib:$LD_LIBRARY_PATH
With -csh setenv LD_LIBRARY_PATH dir/lib:$LD_LIBRARY_PATH
With -make -Ldir/lib
Exit status is zero (success) or non-zero (failure)
USAGE
exit 0 # A clean exit
}
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${Script##*/} -help' for usage"
echo
exit 1
}
#------------------------------------------------------------------------------
optSyntax=sh
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*)
printHelp
;;
-csh | -sh | -make)
optSyntax="${1#-}"
;;
--)
shift
break
;;
-*)
die "unknown option: '$1'"
;;
*)
break
;;
esac
shift
done
#------------------------------------------------------------------------------
dir="$1" # $1 = base directory for 'lib' or 'lib64'
alt="$2" # $2 = fallback libname ('lib' or 'lib64')
unset resolved
# 0)
# Skip entirely if directory ends in "-none" or "-system".
# These special cases (disabled, system directories) should not require
# adjustment of LD_LIBRARY_PATH
case "$dir" in
none | system | *-none | *-system)
unset dir
;;
esac
if [ -z "$dir" ]
then
exit 1
elif [ -d "$dir" ]
then
# 1) Check for dir/lib64 and dir/lib
for end in lib$WM_COMPILER_LIB_ARCH lib
do
if [ -d "$dir/$end" ]
then
resolved=$dir/$end
break
fi
done
fi
# 2) Use fallback if the previous failed
if [ -z "$resolved" -a -n "$alt" ]
then
# Fallback
case "$alt" in
/*)
resolved=$alt
;;
(*)
resolved=$dir/$alt
;;
esac
return 0
fi
if [ -n "$resolved" ]
then
case "$optSyntax" in
csh)
echo "setenv LD_LIBRARY_PATH $resolved:$LD_LIBRARY_PATH"
;;
make)
printf "%s\n" "-L$resolved"
;;
*)
echo "LD_LIBRARY_PATH=$resolved:$LD_LIBRARY_PATH"
;;
esac
exit 0 # Good
else
exit 1 # Error
fi
#------------------------------------------------------------------------------

View File

@ -139,65 +139,55 @@ _foamEtc -mode=ug prefs.sh
export FOAM_SETTINGS="$@" export FOAM_SETTINGS="$@"
_foamEval $@ _foamEval $@
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH) # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath export PATH MANPATH LD_LIBRARY_PATH
_foamClean PATH "$foamOldDirs"
# Clean PATH _foamClean MANPATH "$foamOldDirs"
cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned" _foamClean LD_LIBRARY_PATH "$foamOldDirs"
# Clean LD_LIBRARY_PATH
cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") \
&& LD_LIBRARY_PATH="$cleaned"
# Clean MANPATH
cleaned=$($foamClean "$MANPATH" "$foamOldDirs") && MANPATH="$cleaned"
export PATH LD_LIBRARY_PATH MANPATH
# Setup for OpenFOAM compilation etc # Setup for OpenFOAM compilation etc
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc config.sh/settings _foamEtc -config settings
# Setup for third-party packages # Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc config.sh/mpi _foamEtc -config mpi
_foamEtc config.sh/paraview _foamEtc -config paraview
_foamEtc config.sh/vtk _foamEtc -config vtk
_foamEtc config.sh/ensight _foamEtc -config ensight
_foamEtc config.sh/gperftools _foamEtc -config gperftools
## _foamEtc config.csh/ADIOS ## _foamEtc -config ADIOS
_foamEtc config.sh/CGAL _foamEtc -config CGAL
_foamEtc config.sh/scotch _foamEtc -config scotch
_foamEtc config.sh/FFTW _foamEtc -config FFTW
# Interactive shell # Interactive shell
if /usr/bin/tty -s 2>/dev/null if /usr/bin/tty -s 2>/dev/null
then then
_foamEtc config.sh/aliases _foamEtc -config aliases
[ "${BASH_VERSINFO:-0}" -ge 4 ] && _foamEtc config.sh/bash_completion [ "${BASH_VERSINFO:-0}" -ge 4 ] && _foamEtc -config bash_completion
fi fi
# Clean environment paths again. Only remove duplicates # Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Clean PATH export PATH MANPATH LD_LIBRARY_PATH
cleaned=$($foamClean "$PATH") && PATH="$cleaned"
# Clean LD_LIBRARY_PATH _foamClean PATH
cleaned=$($foamClean "$LD_LIBRARY_PATH") && LD_LIBRARY_PATH="$cleaned" _foamClean MANPATH
_foamClean LD_LIBRARY_PATH
# Clean MANPATH (trailing ':' to find system pages) # Add trailing ':' for system manpages
cleaned=$($foamClean "$MANPATH") && MANPATH="${cleaned}:" if [ -n "$MANPATH" ]
then
MANPATH="${MANPATH}:"
fi
export PATH LD_LIBRARY_PATH MANPATH
# Clean LD_PRELOAD
if [ -n "$LD_PRELOAD" ] if [ -n "$LD_PRELOAD" ]
then then
cleaned=$($foamClean "$LD_PRELOAD") && LD_PRELOAD="$cleaned"
export LD_PRELOAD export LD_PRELOAD
_foamClean LD_PRELOAD
fi fi
@ -208,6 +198,6 @@ fi
. $WM_PROJECT_DIR/etc/config.sh/functions . $WM_PROJECT_DIR/etc/config.sh/functions
# Variables (done as the last statement for a clean exit code) # Variables (done as the last statement for a clean exit code)
unset cleaned foamClean foamOldDirs unset cleaned foamOldDirs
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.csh/ADIOS # etc/config.csh/ADIOS
# - sourced by OpenFOAM-*/etc/cshrc
# #
# Description # Description
# Setup for ADIOS include/libraries (usually ThirdParty installation). # Setup for ADIOS include/libraries (usually ThirdParty installation).
# Sourced from OpenFOAM-<VERSION>/etc/cshrc
# #
# To disable its use: adios_version=adios-none # To disable its use: adios_version=adios-none
# For system-wide installations: adios_version=adios-system # For system-wide installations: adios_version=adios-system

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.csh/ADIOS2 # etc/config.csh/ADIOS2
# - sourced by OpenFOAM-*/etc/cshrc
# #
# Description # Description
# Setup for ADIOS2 include/libraries (usually ThirdParty installation). # Setup for ADIOS2 include/libraries (usually ThirdParty installation).
# Sourced from OpenFOAM-<VERSION>/etc/cshrc
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade # USER EDITABLE PART: Changes made here may be lost with the next upgrade

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,10 @@
# #
# File # File
# etc/config.csh/CGAL # etc/config.csh/CGAL
# - sourced by OpenFOAM-*/etc/cshrc
# #
# Description # Description
# Setup file for CGAL (& boost) include/libraries. # Setup CGAL (& boost) include/libraries (usually ThirdParty installation).
# Sourced from OpenFOAM-<VERSION>/etc/cshrc
# #
# To disable its use: # To disable its use:
# boost_version=boost-none # boost_version=boost-none
@ -29,6 +29,9 @@
# 2. and provide full paths for BOOST_ARCH_PATH / CGAL_ARCH_PATH # 2. and provide full paths for BOOST_ARCH_PATH / CGAL_ARCH_PATH
# #
# Note # Note
# Define GMP_ARCH_PATH and MPFR_ARCH_PATH here, if required and when not
# using a ThirdParty gcc.
#
# Changes made here MUST be made in the equivalent config.sh version too, # Changes made here MUST be made in the equivalent config.sh version too,
# since that is the one used in the build process. # since that is the one used in the build process.
# #
@ -50,20 +53,19 @@ if ($?FOAM_VERBOSE && $?prompt) then
echo "Using CGAL ($cgal_version) -> $CGAL_ARCH_PATH" echo "Using CGAL ($cgal_version) -> $CGAL_ARCH_PATH"
endif endif
# If BOOST_ARCH_PATH, CGAL_ARCH_PATH do not end with '-system' or '-none', _foamAddLibAuto $BOOST_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
# they are either located within ThirdParty, or a central installation _foamAddLibAuto $CGAL_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
# outside of ThirdParty and must be added to the lib-path.
set ending="${BOOST_ARCH_PATH:t}" # GMP/MPFR may have already been added with ThirdParty compiler, but cannot
if ( "$ending" != "boost-none" && "$ending" != "boost-system" ) then # be certain so add here. If they are duplicates, they will be removed later.
_foamAddLib $BOOST_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
if ( $?GMP_ARCH_PATH ) then
_foamAddLibAuto $GMP_ARCH_PATH # No fallback libdir
endif
if ( $?MPFR_ARCH_PATH ) then
_foamAddLibAuto $MPFR_ARCH_PATH # No fallback libdir
endif endif
set ending="${CGAL_ARCH_PATH:t}" unset boost_version cgal_version
if ( "$ending" != "cgal-none" && "$ending" != "cgal-system" ) then
_foamAddLib $CGAL_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
endif
unset boost_version cgal_version ending
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -11,10 +11,10 @@
# #
# File # File
# etc/config.csh/FFTW # etc/config.csh/FFTW
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Setup for FFTW include/libraries (usually ThirdParty installation). # Setup for FFTW include/libraries (usually ThirdParty installation).
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
# #
# To disable its use: fftw_version=fftw-none # To disable its use: fftw_version=fftw-none
# For system-wide installations: fftw_version=fftw-system # For system-wide installations: fftw_version=fftw-system
@ -41,15 +41,8 @@ if ($?FOAM_VERBOSE && $?prompt) then
echo "Using fftw ($fftw_version) -> $FFTW_ARCH_PATH" echo "Using fftw ($fftw_version) -> $FFTW_ARCH_PATH"
endif endif
# If FFTW_ARCH_PATH does not end with '-system' or '-none', _foamAddLibAuto $FFTW_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
# it is either located within ThirdParty, or a central installation
# outside of ThirdParty and must be added to the lib-path.
set ending="${FFTW_ARCH_PATH:t}" unset fftw_version
if ( "$ending" != "fftw-none" && "$ending" != "fftw-system" ) then
_foamAddLib $FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
endif
unset fftw_version ending
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,10 @@
# #
# File # File
# etc/config.csh/aliases # etc/config.csh/aliases
# - sourced by OpenFOAM-*/etc/cshrc (or from the user's ~/.cshrc)
# #
# Description # Description
# Aliases for working with OpenFOAM # Aliases for working with OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/cshrc and/or ~/.cshrc
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.csh/compiler # etc/config.csh/compiler
# - sourced by OpenFOAM-*/etc/config.csh/settings
# #
# Description # Description
# Setup for custom compiler versions for OpenFOAM # Setup for custom compiler versions for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/config.csh/settings
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.csh/ensight # etc/config.csh/ensight
# - sourced by OpenFOAM-*/etc/cshrc
# #
# Description # Description
# Setup for ENSIGHT # Setup for ENSIGHT
# Sourced from OpenFOAM-*/etc/cshrc
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,15 +11,15 @@
# #
# File # File
# config.csh/example/compiler # config.csh/example/compiler
# - sourced by OpenFOAM-*/etc/config.csh/settings
# #
# Description # Description
# Example of fine tuning ThirdParty compiler settings for OpenFOAM # Example of fine tuning ThirdParty compiler settings for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/config.csh/settings
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Load the standard versions # Load the standard versions
eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh -mode=o config.csh/compiler` eval `$WM_PROJECT_DIR/bin/foamEtcFile -mode=o -csh -config compiler`
# Modify/override compiler settings # Modify/override compiler settings
switch ("$WM_COMPILER") switch ("$WM_COMPILER")

View File

@ -11,14 +11,13 @@
# #
# File # File
# config.csh/example/openmpi # config.csh/example/openmpi
# - sourced by OpenFOAM-*/etc/config.csh/mpi
# #
# Description # Description
# Example of fine tuning openmpi settings for OpenFOAM # Example of fine tuning openmpi settings for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/config.csh/settings
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Modified openmpi settings
setenv FOAM_MPI openmpi-3.0.0 setenv FOAM_MPI openmpi-3.0.0
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -22,8 +22,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Use shipped paraview config file (-mode=o) with a different ParaView_VERSION # Use standard paraview config file (-mode=o) with a different ParaView_VERSION
set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode=o config.csh/paraview` set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode=o config.csh/paraview`
if ( $status == 0 ) source $foamFile ParaView_VERSION=5.4.0 if ( $status == 0 ) source $foamFile ParaView_VERSION=5.4.0

View File

@ -11,12 +11,10 @@
# #
# File # File
# config.csh/example/prefs.csh # config.csh/example/prefs.csh
# - sourced by OpenFOAM-*/etc/cshrc
# #
# Description # Description
# Preset variables for the OpenFOAM configuration - C-Shell shell syntax. # Example of preset variables for the OpenFOAM configuration (C-Shell shell)
#
# The prefs.csh file will be sourced by the OpenFOAM etc/cshrc when it is
# found by foamEtcFile.
# #
# See also # See also
# 'foamEtcFile -help' or 'foamEtcFile -list' for information about the # 'foamEtcFile -help' or 'foamEtcFile -list' for information about the
@ -24,13 +22,8 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
#- Compiler location:
setenv WM_COMPILER_TYPE ThirdParty setenv WM_COMPILER_TYPE ThirdParty
#- Compiler:
setenv WM_COMPILER Clang setenv WM_COMPILER Clang
#- MPI implementation:
setenv WM_MPLIB SYSTEMOPENMPI setenv WM_MPLIB SYSTEMOPENMPI
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

62
etc/config.csh/functions Normal file
View File

@ -0,0 +1,62 @@
#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# File
# etc/config.csh/functions
# - sourced by OpenFOAM-*/etc/cshrc
#
# Description
# C-shell aliases and variables used when sourcing the OpenFOAM environment
#
# Some functionality implemented via bin/tools/lib-dir
#
#------------------------------------------------------------------------------
# Cleaning environment variables
alias _foamClean 'eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-env=\!*`'
# Prepend PATH, MANPATH, LD_LIBRARY_PATH
alias _foamAddPath 'setenv PATH \!*\:${PATH}'
alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
# Prefix to LD_LIBRARY_PATH with additional checking
# $1 = base directory for 'lib' or 'lib64'
# $2 = fallback libname ('lib' or 'lib64')
alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`'
# Source an etc file, possibly with some verbosity
if ($?FOAM_VERBOSE && $?prompt) then
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
else
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
endif
#------------------------------------------------------------------------------
# Avoid any ThirdParty settings that may have 'leaked' into the environment
unsetenv MPI_ARCH_PATH
unsetenv ADIOS_ARCH_PATH
unsetenv ADIOS1_ARCH_PATH
unsetenv ADIOS2_ARCH_PATH
unsetenv BOOST_ARCH_PATH
unsetenv CCMIO_ARCH_PATH
unsetenv CGAL_ARCH_PATH
unsetenv FFTW_ARCH_PATH
unsetenv GPERFTOOLS_ARCH_PATH
unsetenv GMP_ARCH_PATH
unsetenv MPFR_ARCH_PATH
unsetenv MESA_ARCH_PATH
unsetenv METIS_ARCH_PATH
unsetenv SCOTCH_ARCH_PATH
#------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,16 @@
# #
# File # File
# etc/config.csh/mpi # etc/config.csh/mpi
# - sourced by OpenFOAM-*/etc/cshrc
# #
# Description # Description
# Setup for MPI communications library for OpenFOAM # Setup for MPI communications library for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/cshrc #
# User adjustments are possible in these files:
# - config.csh/openmpi-system
# - config.csh/openmpi
# - config.csh/mpi-user
# - config.csh/mpi-system
# #
# For USERMPI, the user is responsible for supplying an appropriate # For USERMPI, the user is responsible for supplying an appropriate
# wmake/rules/General/mplibUSERMPI file and managing all settings # wmake/rules/General/mplibUSERMPI file and managing all settings
@ -25,25 +31,35 @@ setenv FOAM_MPI dummy # Fallback value
switch ("$WM_MPLIB") switch ("$WM_MPLIB")
case SYSTEMOPENMPI: case SYSTEMOPENMPI:
# Use the system installed openmpi, get library directory via mpicc # The system installed openmpi, locations discovery via mpicc.
setenv FOAM_MPI openmpi-system setenv FOAM_MPI openmpi-system
_foamEtc -config openmpi-system # <- Adjustments (optional)
# Bit of a hack: strip off 'lib' and assume it is the prefix for openmpi # Respect MPI_ARCH_PATH if set to a valid directory (ie, from user adjustments)
# include files and libraries. if (! $?MPI_ARCH_PATH ) setenv MPI_ARCH_PATH
set libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'` if ( -d "$MPI_ARCH_PATH" ) then
_foamAddLibAuto $MPI_ARCH_PATH
else
# Slight hack: strip off 'lib' to get presumed prefix for include and libs
set libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
setenv MPI_ARCH_PATH "${libDir:h}" setenv MPI_ARCH_PATH "${libDir:h}"
_foamAddLib $libDir _foamAddLib $libDir
unset libDir unset libDir
endif
breaksw breaksw
case OPENMPI: case OPENMPI:
setenv FOAM_MPI openmpi-1.10.4 setenv FOAM_MPI openmpi-1.10.4
_foamEtc config.csh/openmpi # <- Adjustments (optional) _foamEtc -config openmpi # <- Adjustments (optional)
setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI # Respect MPI_ARCH_PATH if set to a valid directory (ie, from user adjustments)
if (! $?MPI_ARCH_PATH ) setenv MPI_ARCH_PATH
if (! -d "$MPI_ARCH_PATH" ) then
setenv mpiDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
endif
# Tell OpenMPI where to find its install directory # Inform openmpi where to find its install directory
setenv OPAL_PREFIX $MPI_ARCH_PATH setenv OPAL_PREFIX $MPI_ARCH_PATH
if ($?FOAM_VERBOSE && $?prompt) then if ($?FOAM_VERBOSE && $?prompt) then
@ -53,19 +69,19 @@ case OPENMPI:
endif endif
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man _foamAddMan $MPI_ARCH_PATH/share/man
_foamAddLibAuto $MPI_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
breaksw breaksw
case USERMPI: case USERMPI:
# Use an arbitrary, user-specified mpi implementation # Use an arbitrary, user-specified mpi implementation
setenv FOAM_MPI mpi-user setenv FOAM_MPI mpi-user
_foamEtc config.csh/mpi-user # <- Adjustments _foamEtc -config mpi-user # <- Adjustments (optional)
breaksw breaksw
case SYSTEMMPI: case SYSTEMMPI:
setenv FOAM_MPI mpi-system setenv FOAM_MPI mpi-system
_foamEtc config.csh/mpi-system # <- Adjustments (optional) _foamEtc -config mpi-system # <- Adjustments (optional)
if ( ! $?MPI_ROOT ) then if ( ! $?MPI_ROOT ) then
echo echo
@ -114,8 +130,8 @@ case MPICH:
setenv MPI_HOME $MPI_ARCH_PATH setenv MPI_HOME $MPI_ARCH_PATH
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man _foamAddMan $MPI_ARCH_PATH/share/man
_foamAddLibAuto $MPI_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
breaksw breaksw
case MPICH-GM: case MPICH-GM:

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,10 @@
# #
# File # File
# config.csh/paraview # config.csh/paraview
# - sourced by OpenFOAM-*/etc/cshrc or via foamPV alias
# #
# Description # Description
# Setup for PARAVIEW (partially cmake, qt too) # Setup for PARAVIEW (partially cmake, qt too)
# Sourced from OpenFOAM-<VERSION>/etc/cshrc or from foamPV alias
# #
# For system-wide cmake: cmake_version=cmake-system # For system-wide cmake: cmake_version=cmake-system
# For system-wide qt: ParaView_QT=qt-system # For system-wide qt: ParaView_QT=qt-system
@ -54,13 +54,8 @@ if (! $?WM_COMPILER_LIB_ARCH ) setenv WM_COMPILER_LIB_ARCH
set archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER" set archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
# Clean PATH and LD_LIBRARY_PATH # Clean PATH and LD_LIBRARY_PATH
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $archDir/cmake- $archDir/qt- $archDir/ParaView-"` eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-env=PATH "$ParaView_DIR $archDir/ParaView- $archDir/qt- $archDir/cmake-"`
if ( $status == 0 ) setenv PATH $cleaned eval `$WM_PROJECT_DIR/bin/foamCleanPath -csh-env=LD_LIBRARY_PATH "$ParaView_DIR $archDir/ParaView- $archDir/qt-"`
if ( $?LD_LIBRARY_PATH ) then
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$LD_LIBRARY_PATH" "$ParaView_DIR $archDir/qt- $archDir/ParaView-"`
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
endif
# ThirdParty cmake # ThirdParty cmake
set cmake=$archDir/$cmake_version set cmake=$archDir/$cmake_version

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,19 +11,11 @@
# #
# File # File
# etc/config.csh/settings # etc/config.csh/settings
# - sourced by OpenFOAM-*/etc/cshrc
# #
# Description # Description
# Settings for OpenFOAM, sourced from OpenFOAM-<VERSION>/etc/cshrc # Settings for OpenFOAM
# #
#------------------------------------------------------------------------------
# Prefix to PATH
alias _foamAddPath 'setenv PATH \!*\:${PATH}'
# Prefix to LD_LIBRARY_PATH
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
# Prefix to MANPATH
alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
setenv WM_ARCH `uname -s` # System name setenv WM_ARCH `uname -s` # System name
if (! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX # System type (POSIX is default) if (! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX # System type (POSIX is default)
@ -228,7 +220,7 @@ unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
# Load pre-defined compiler versions # Load pre-defined compiler versions
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc config.csh/compiler _foamEtc -config compiler
# ThirdParty base for compilers # ThirdParty base for compilers
set archDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH set archDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
@ -263,19 +255,19 @@ GCC_NOT_FOUND
# Add ThirdParty compiler libraries to run-time environment # Add ThirdParty compiler libraries to run-time environment
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
# Add ThirdParty gmp/mpfr/mpc libraries to run-time environment # Add gmp/mpfr/mpc libraries to run-time environment.
# Require that they exist, automatically find lib64/ or lib/.
if ( "${gmpDir:t}" != "gmp-system" ) then if ( "${gmpDir:t}" != "gmp-system" ) then
_foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH _foamAddLibAuto $gmpDir
setenv GMP_ARCH_PATH $gmpDir # For ThirdParty CGAL setenv GMP_ARCH_PATH $gmpDir # For non-system CGAL
endif endif
if ( "${mpfrDir:t}" != "mpfr-system" ) then if ( "${mpfrDir:t}" != "mpfr-system" ) then
_foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH _foamAddLibAuto $mpfrDir
setenv MPFR_ARCH_PATH $mpfrDir # For ThirdParty CGAL setenv MPFR_ARCH_PATH $mpfrDir # For non-system CGAL
endif
if ( "${mpcDir:t}" != "mpc-system" ) then
_foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH
endif endif
_foamAddLibAuto $mpcDir
if ($?FOAM_VERBOSE && $?prompt) then if ($?FOAM_VERBOSE && $?prompt) then
echo "Using ThirdParty compiler" echo "Using ThirdParty compiler"
echo " ${gccDir:t} (${gmpDir:t} ${mpfrDir:t} ${mpcDir:t})" echo " ${gccDir:t} (${gmpDir:t} ${mpfrDir:t} ${mpcDir:t})"
@ -332,6 +324,6 @@ unset archDir
unset gcc_version gccDir unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
unset clang_version clangDir unset clang_version clangDir
# Retain: _foamAddPath _foamAddLib _foamAddMan # Retain: _foamAddPath _foamAddLib _foamAddMan _foamAddLibAuto
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,6 +11,7 @@
# #
# File # File
# etc/config.csh/tcsh_completion # etc/config.csh/tcsh_completion
# - sourced by OpenFOAM-*/etc/cshrc
# #
# Description # Description
# Tcsh completions for OpenFOAM applications # Tcsh completions for OpenFOAM applications

View File

@ -114,7 +114,7 @@ unsetenv PV_PLUGIN_PATH
unsetenv VTK_DIR unsetenv VTK_DIR
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# unset other ThirdParty environment variables # Unset other ThirdParty environment variables
unsetenv ADIOS_ARCH_PATH unsetenv ADIOS_ARCH_PATH
unsetenv ADIOS1_ARCH_PATH unsetenv ADIOS1_ARCH_PATH
@ -136,18 +136,15 @@ unsetenv SCOTCH_ARCH_PATH
if ( $?foamClean ) then if ( $?foamClean ) then
set cleaned=`$foamClean "$PATH" "$foamOldDirs"` eval `$foamClean -csh-env=PATH "$foamOldDirs"`
if ( $status == 0 ) setenv PATH $cleaned
if ($?LD_LIBRARY_PATH) then if ($?LD_LIBRARY_PATH) then
set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` eval `$foamClean -csh-env=LD_LIBRARY_PATH "$foamOldDirs"`
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
if ( ${%LD_LIBRARY_PATH} == 0 ) unsetenv LD_LIBRARY_PATH if ( ${%LD_LIBRARY_PATH} == 0 ) unsetenv LD_LIBRARY_PATH
endif endif
if ($?MANPATH) then if ($?MANPATH) then
set cleaned=`$foamClean "$MANPATH" "$foamOldDirs"` eval `$foamClean -csh-env=MANPATH "$foamOldDirs"`
if ( $status == 0 ) setenv MANPATH $cleaned
if ( ${%MANPATH} == 0 ) unsetenv MANPATH if ( ${%MANPATH} == 0 ) unsetenv MANPATH
endif endif

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.csh/vtk # etc/config.csh/vtk
# - sourced by OpenFOAM-*/etc/cshrc
# #
# Description # Description
# Setup file for VTK (and MESA) # Setup file for VTK (and MESA)
# Sourced from OpenFOAM-<VERSION>/etc/cshrc
# #
# The library path is only adjusted when the paths specified here # The library path is only adjusted when the paths specified here
# actually exist at the time of sourcing. # actually exist at the time of sourcing.

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/ADIOS # etc/config.sh/ADIOS
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Setup for ADIOS include/libraries (usually ThirdParty installation). # Setup for ADIOS include/libraries (usually ThirdParty installation).
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
# #
# To disable its use: adios_version=adios-none # To disable its use: adios_version=adios-none
# For system-wide installations: adios_version=adios-system # For system-wide installations: adios_version=adios-system
@ -42,7 +42,7 @@ then
echo "Using adios ($adios_version) -> $ADIOS_ARCH_PATH" 1>&2 echo "Using adios ($adios_version) -> $ADIOS_ARCH_PATH" 1>&2
fi fi
if command -v _foamAddPath >/dev/null 2>&1 # normal sourcing if command -v _foamAddPath >/dev/null 2>&1 # Normal sourcing
then then
# If ADIOS_ARCH_PATH does not end with '-system' or '-none', # If ADIOS_ARCH_PATH does not end with '-system' or '-none',
# it is located within ThirdParty, or a central installation # it is located within ThirdParty, or a central installation

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/ADIOS2 # etc/config.sh/ADIOS2
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Setup for ADIOS2 include/libraries (usually ThirdParty installation). # Setup for ADIOS2 include/libraries (usually ThirdParty installation).
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade # USER EDITABLE PART: Changes made here may be lost with the next upgrade
@ -29,7 +29,7 @@ then
echo "Using adios ($adios2_version) -> $ADIOS2_ARCH_PATH" 1>&2 echo "Using adios ($adios2_version) -> $ADIOS2_ARCH_PATH" 1>&2
fi fi
if command -v _foamAddPath >/dev/null 2>&1 # normal sourcing if command -v _foamAddPath >/dev/null 2>&1 # Normal sourcing
then then
# If *_ARCH_PATH does not end with '-system' or '-none', # If *_ARCH_PATH does not end with '-system' or '-none',
# it is located within ThirdParty, or a central installation # it is located within ThirdParty, or a central installation

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/CGAL # etc/config.sh/CGAL
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Setup file for CGAL (& boost) include/libraries. # Setup CGAL (& boost) include/libraries (usually ThirdParty installation).
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
# #
# To disable its use: # To disable its use:
# boost_version=boost-none # boost_version=boost-none
@ -29,7 +29,10 @@
# 2. and provide full paths for BOOST_ARCH_PATH / CGAL_ARCH_PATH # 2. and provide full paths for BOOST_ARCH_PATH / CGAL_ARCH_PATH
# #
# Note # Note
# When _foamAddLib is unset (eg, called from makeCGAL): # Define GMP_ARCH_PATH and MPFR_ARCH_PATH here, if required and when not
# using a ThirdParty gcc.
#
# When _foamAddLibAuto is unset (eg, called from makeCGAL):
# - boost_version / cgal_version variables are retained. # - boost_version / cgal_version variables are retained.
# - the LD_LIBRARY_PATH is not adjusted. # - the LD_LIBRARY_PATH is not adjusted.
# #
@ -52,26 +55,18 @@ then
echo "Using CGAL ($cgal_version) -> $CGAL_ARCH_PATH" 1>&2 echo "Using CGAL ($cgal_version) -> $CGAL_ARCH_PATH" 1>&2
fi fi
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing (not makeCGAL)
then then
_foamAddLibAuto $BOOST_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
_foamAddLibAuto $CGAL_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
# If BOOST_ARCH_PATH, CGAL_ARCH_PATH do not end with '-system' or '-none', # GMP/MPFR may have already been added with ThirdParty compiler, but cannot
# they are either located within ThirdParty, or a central installation # be certain so add here. Any duplicates will be removed later.
# outside of ThirdParty and must be added to the lib-path.
ending="${BOOST_ARCH_PATH##*-}" _foamAddLibAuto $GMP_ARCH_PATH # No fallback libdir
if [ "$ending" != none -a "$ending" != system ] _foamAddLibAuto $MPFR_ARCH_PATH # No fallback libdir
then
_foamAddLib $BOOST_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
fi
ending="${CGAL_ARCH_PATH##*-}" unset boost_version cgal_version
if [ "$ending" != none -a "$ending" != system ]
then
_foamAddLib $CGAL_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
fi
unset boost_version cgal_version ending
fi fi

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/FFTW # etc/config.sh/FFTW
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Setup for FFTW include/libraries (usually ThirdParty installation). # Setup for FFTW include/libraries (usually ThirdParty installation).
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
# #
# To disable its use: fftw_version=fftw-none # To disable its use: fftw_version=fftw-none
# For system-wide installations: fftw_version=fftw-system # For system-wide installations: fftw_version=fftw-system
@ -24,7 +24,7 @@
# 2. and provide full path for FFTW_ARCH_PATH # 2. and provide full path for FFTW_ARCH_PATH
# #
# Note # Note
# When _foamAddLib is unset (eg, called from makeFFTW): # When _foamAddLibAuto is unset (eg, called from makeFFTW):
# - fftw_version variable is retained. # - fftw_version variable is retained.
# - LD_LIBRARY_PATH is not adjusted. # - LD_LIBRARY_PATH is not adjusted.
# #
@ -43,20 +43,12 @@ then
echo "Using fftw ($fftw_version) -> $FFTW_ARCH_PATH" 1>&2 echo "Using fftw ($fftw_version) -> $FFTW_ARCH_PATH" 1>&2
fi fi
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing (not makeFFTW)
then then
# If FFTW_ARCH_PATH does not end with '-system' or '-none', _foamAddLibAuto $FFTW_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
# it is either located within ThirdParty, or a central installation
# outside of ThirdParty and must be added to the lib-path.
ending="${FFTW_ARCH_PATH##*-}" unset fftw_version
if [ "$ending" != none -a "$ending" != system ]
then
_foamAddLib $FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
fi
unset fftw_version ending
fi fi

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/aliases # etc/config.sh/aliases
# - sourced by OpenFOAM-*/etc/bashrc (or from the user's ~/.bashrc)
# #
# Description # Description
# Aliases for working with OpenFOAM # Aliases for working with OpenFOAM.
# Sourced from OpenFOAM-<VERSION>/etc/bashrc and/or ~/.bashrc
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,6 +11,7 @@
# #
# File # File
# etc/config.sh/bash_completion # etc/config.sh/bash_completion
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Bash completion handler for OpenFOAM applications and automatic # Bash completion handler for OpenFOAM applications and automatic

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/ccmio # etc/config.sh/ccmio
# - sourced during wmake process only.
# #
# Description # Description
# Setup for LIBCCMIO include/libraries. # Setup for LIBCCMIO include/libraries.
# Sourced during wmake process only.
# #
# Static libraries (recommended) are found under CCMIO_ARCH_PATH/lib. # Static libraries (recommended) are found under CCMIO_ARCH_PATH/lib.
# Dynamic libraries are found under FOAM_EXT_LIBBIN path. # Dynamic libraries are found under FOAM_EXT_LIBBIN path.

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/compiler # etc/config.sh/compiler
# - sourced by OpenFOAM-*/etc/config.sh/settings
# #
# Description # Description
# Setup for custom compiler versions for OpenFOAM # Setup for custom compiler versions for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/config.sh/settings
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/ensight # etc/config.sh/ensight
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Setup for ENSIGHT # Setup for ENSIGHT
# Sourced from OpenFOAM-*/etc/bashrc
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -11,15 +11,15 @@
# #
# File # File
# config.sh/example/compiler # config.sh/example/compiler
# - sourced by OpenFOAM-*/etc/config.sh/settings
# #
# Description # Description
# Example of fine tuning compiler versions and settings for OpenFOAM # Example of fine tuning compiler versions and settings for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/config.sh/settings
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Load the standard versions # Load the standard versions
eval $($WM_PROJECT_DIR/bin/foamEtcFile -sh -mode=o config.sh/compiler) eval $($WM_PROJECT_DIR/bin/foamEtcFile -mode=o -sh -config compiler)
# Modify/override compiler settings # Modify/override compiler settings
case "$WM_COMPILER" in case "$WM_COMPILER" in

View File

@ -11,14 +11,13 @@
# #
# File # File
# config.sh/example/openmpi # config.sh/example/openmpi
# - sourced by OpenFOAM-*/etc/config.sh/mpi
# #
# Description # Description
# Example of fine tuning openmpi settings for OpenFOAM # Example of fine tuning openmpi settings for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/config.sh/settings
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Modified openmpi settings
export FOAM_MPI=openmpi-3.0.0 export FOAM_MPI=openmpi-3.0.0
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -22,7 +22,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Use shipped paraview config file (-mode=o) with a different ParaView_VERSION # Use standard paraview config file (-mode=o) with a different ParaView_VERSION
foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode=o config.sh/paraview 2>/dev/null) foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode=o config.sh/paraview 2>/dev/null)
[ $? -eq 0 ] && . $foamFile ParaView_VERSION=5.4.0 [ $? -eq 0 ] && . $foamFile ParaView_VERSION=5.4.0

View File

@ -11,12 +11,10 @@
# #
# File # File
# config.sh/example/prefs.sh # config.sh/example/prefs.sh
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Preset variables for the OpenFOAM configuration - POSIX shell syntax. # Example of preset variables for the OpenFOAM configuration (POSIX shell)
#
# The prefs.sh file will be sourced by the OpenFOAM etc/bashrc when it is
# found by foamEtcFile.
# #
# See also # See also
# 'foamEtcFile -help' or 'foamEtcFile -list' for information about the # 'foamEtcFile -help' or 'foamEtcFile -list' for information about the
@ -24,13 +22,8 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
#- Compiler location: export WM_COMPILER_TYPE=ThirdParty
WM_COMPILER_TYPE=ThirdParty
#- Compiler:
export WM_COMPILER=Clang export WM_COMPILER=Clang
#- MPI implementation:
export WM_MPLIB=SYSTEMOPENMPI export WM_MPLIB=SYSTEMOPENMPI
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,12 @@
# #
# File # File
# etc/config.sh/functions # etc/config.sh/functions
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Initialization script functions for the bashrc environment # Shell functions and variables used when sourcing the OpenFOAM environment
# Sourced from OpenFOAM-<VERSION>/etc/config.sh/bashrc #
# Some functionality is shadowed in bin/tools/lib-dir
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -25,24 +27,91 @@ then
# Temporary environment variable to track loading/unloading of functions # Temporary environment variable to track loading/unloading of functions
WM_SHELL_FUNCTIONS=loaded WM_SHELL_FUNCTIONS=loaded
# Prefix to PATH # Cleaning environment variables
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
# Cleaning environment variables
_foamClean()
{
local var=$1
shift
eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=$var "$@")
}
# Prepend PATH
_foamAddPath() _foamAddPath()
{ {
[ $# -gt 0 ] && export PATH=$1:$PATH [ -n "$1" ] && export PATH=$1:$PATH
} }
# Prefix to LD_LIBRARY_PATH # Prepend MANPATH
_foamAddLib()
{
[ $# -gt 0 ] && export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
}
# Prefix to MANPATH
_foamAddMan() _foamAddMan()
{ {
[ $# -gt 0 ] && export MANPATH=$1:$MANPATH [ -n "$1" ] && export MANPATH=$1:$MANPATH
} }
# Prepend LD_LIBRARY_PATH
_foamAddLib()
{
[ -n "$1" ] && export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
}
# Prefix to LD_LIBRARY_PATH with additional checking
# $1 = base directory for 'lib' or 'lib64'
# $2 = fallback libname ('lib' or 'lib64')
#
# 0) Skip entirely if directory ends in "-none" or "-system".
# These special cases (disabled, system directories) should not require
# adjustment of LD_LIBRARY_PATH
# 1) Check for dir/lib64 and dir/lib
# 2) Use fallback if the previous failed
#
# Return 0 on success
_foamAddLibAuto()
{
# Note ksh doesn't have 'local' thus these ugly variable names
foamVar_prefix="$1"
foamVar_end="${1##*-}"
# Do not add (none) or a system directory
if [ -z "$foamVar_prefix" -o "$foamVar_end" = none -o "$foamVar_end" = system ]
then
unset foamVar_prefix foamVar_end
return 1
elif [ -d "$foamVar_prefix" ]
then
for foamVar_end in lib$WM_COMPILER_LIB_ARCH lib
do
if [ -d "$foamVar_prefix/$foamVar_end" ]
then
export LD_LIBRARY_PATH=$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH
unset foamVar_prefix foamVar_end
return 0
fi
done
fi
# Use fallback. Add without checking existence of the directory
foamVar_end=$2
if [ -n "$foamVar_end" ]
then
case "$foamVar_end" in
/*) # An absolute path
export LD_LIBRARY_PATH=$foamVar_end:$LD_LIBRARY_PATH
;;
(*) # Relative to prefix
export LD_LIBRARY_PATH=$foamVar_prefix/$foamVar_end:$LD_LIBRARY_PATH
;;
esac
unset foamVar_prefix foamVar_end
return 0
fi
unset foamVar_prefix foamVar_end
return 1 # Nothing set
}
# Source an etc file, possibly with some verbosity # Source an etc file, possibly with some verbosity
# - use eval to avoid intermediate variables (ksh doesn't have 'local') # - use eval to avoid intermediate variables (ksh doesn't have 'local')
if [ "$FOAM_VERBOSE" -a "$PS1" ] if [ "$FOAM_VERBOSE" -a "$PS1" ]
@ -87,11 +156,31 @@ then
done done
} }
#--------------------------------------------------------------------------
# Avoid any ThirdParty settings that may have 'leaked' into the environment
unset MPI_ARCH_PATH
unset ADIOS_ARCH_PATH
unset ADIOS1_ARCH_PATH
unset ADIOS2_ARCH_PATH
unset BOOST_ARCH_PATH
unset CCMIO_ARCH_PATH
unset CGAL_ARCH_PATH
unset FFTW_ARCH_PATH
unset GPERFTOOLS_ARCH_PATH
unset GMP_ARCH_PATH
unset MPFR_ARCH_PATH
unset MESA_ARCH_PATH
unset METIS_ARCH_PATH
unset SCOTCH_ARCH_PATH
else else
# Was previously loaded/defined - now unset # Was previously loaded/defined - now unset
unset -f _foamAddPath _foamAddLib _foamAddMan 2>/dev/null unset -f _foamAddPath _foamAddMan _foamAddLib _foamAddLibAuto 2>/dev/null
unset -f _foamEtc _foamEval 2>/dev/null unset -f _foamClean _foamEtc _foamEval 2>/dev/null
unset foamClean
unset WM_SHELL_FUNCTIONS unset WM_SHELL_FUNCTIONS
fi fi

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/gperftools # etc/config.sh/gperftools
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Setup file for GPERFTOOLS binaries/libraries. # Setup file for GPERFTOOLS binaries/libraries.
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
# #
# To disable its use: gperftools_version=gperftools-none # To disable its use: gperftools_version=gperftools-none
# For system-wide installations: gperftools_version=gperftools-system # For system-wide installations: gperftools_version=gperftools-system
@ -45,7 +45,7 @@ then
echo "Using gperftools ($gperftools_version) -> $GPERFTOOLS_ARCH_PATH" 1>&2 echo "Using gperftools ($gperftools_version) -> $GPERFTOOLS_ARCH_PATH" 1>&2
fi fi
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing if command -v _foamAddLib > /dev/null 2>&1 # Normal sourcing
then then
# If GPERFTOOLS_ARCH_PATH does not end with '-system' or '-none', # If GPERFTOOLS_ARCH_PATH does not end with '-system' or '-none',

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/kahip # etc/config.sh/kahip
# - sourced during wmake process only.
# #
# Description # Description
# Setup for KAHIP include/libraries (usually ThirdParty installation). # Setup for KAHIP include/libraries (usually ThirdParty installation).
# Sourced during wmake process only.
# #
# To disable its use: KAHIP_VERSION=kahip-none # To disable its use: KAHIP_VERSION=kahip-none
# For system-wide installations: KAHIP_VERSION=kahip-system # For system-wide installations: KAHIP_VERSION=kahip-system

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/metis # etc/config.sh/metis
# - sourced during wmake process only.
# #
# Description # Description
# Setup for METIS include/libraries (usually ThirdParty installation). # Setup for METIS include/libraries (usually ThirdParty installation).
# Sourced during wmake process only.
# #
# To disable its use: METIS_VERSION=metis-none # To disable its use: METIS_VERSION=metis-none
# For system-wide installations: METIS_VERSION=metis-system # For system-wide installations: METIS_VERSION=metis-system

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/mgridgen # etc/config.sh/mgridgen
# - sourced during wmake process only.
# #
# Description # Description
# Setup for MGRIDGEN include/libraries (usually ThirdParty installation). # Setup for MGRIDGEN include/libraries (usually ThirdParty installation).
# Sourced during wmake process only.
# #
# Normally used to specify the MGridGen version and location for a # Normally used to specify the MGridGen version and location for a
# ThirdParty installation. # ThirdParty installation.

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,16 @@
# #
# File # File
# etc/config.sh/mpi # etc/config.sh/mpi
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Setup for MPI communications library for OpenFOAM # Setup for MPI communications library for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/bashrc #
# User adjustments are possible in these files:
# - config.sh/openmpi-system
# - config.sh/openmpi
# - config.sh/mpi-user
# - config.sh/mpi-system
# #
# For USERMPI, the user is responsible for supplying an appropriate # For USERMPI, the user is responsible for supplying an appropriate
# wmake/rules/General/mplibUSERMPI file and managing all settings # wmake/rules/General/mplibUSERMPI file and managing all settings
@ -25,31 +31,41 @@ export FOAM_MPI=dummy # Fallback value
case "$WM_MPLIB" in case "$WM_MPLIB" in
SYSTEMOPENMPI) SYSTEMOPENMPI)
# Use the system installed openmpi, get library directory via mpicc # The system installed openmpi, locations discovery via mpicc.
export FOAM_MPI=openmpi-system export FOAM_MPI=openmpi-system
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs # Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs
if [ -z "$($foamClean "$OPAL_PREFIX" "$foamOldDirs")" ] if [ -z "$($foamClean -env=OPAL_PREFIX "$foamOldDirs")" ]
then then
unset OPAL_PREFIX unset OPAL_PREFIX
fi fi
_foamEtc -config openmpi-system # <- Adjustments (optional)
# Bit of a hack: strip off 'lib' and assume it is the prefix for openmpi # Respect MPI_ARCH_PATH if set to a valid directory (ie, from user adjustments)
# include files and libraries. if [ -d "$MPI_ARCH_PATH" ]
libDir=$(mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/') then
_foamAddLibAuto $MPI_ARCH_PATH
else
# Slight hack: strip off 'lib' to get presumed prefix for include and libs
libDir=$(mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/')
export MPI_ARCH_PATH="${libDir%/*}" export MPI_ARCH_PATH="${libDir%/*}"
_foamAddLib $libDir _foamAddLib $libDir
unset libDir unset libDir
fi
;; ;;
OPENMPI) OPENMPI)
export FOAM_MPI=openmpi-1.10.4 export FOAM_MPI=openmpi-1.10.4
_foamEtc config.sh/openmpi # <- Adjustments (optional) _foamEtc -config openmpi # <- Adjustments (optional)
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI # Respect MPI_ARCH_PATH if set to a valid directory (ie, from user adjustments)
if [ ! -d "$MPI_ARCH_PATH" ]
then
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
fi
# Tell OpenMPI where to find its install directory # Inform openmpi where to find its install directory
export OPAL_PREFIX=$MPI_ARCH_PATH export OPAL_PREFIX=$MPI_ARCH_PATH
if [ "$FOAM_VERBOSE" -a "$PS1" ] if [ "$FOAM_VERBOSE" -a "$PS1" ]
@ -60,23 +76,23 @@ OPENMPI)
fi fi
# Could be sourced from ThirdParty with incomplete environment # Could be sourced from ThirdParty with incomplete environment
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing
then then
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man _foamAddMan $MPI_ARCH_PATH/share/man
_foamAddLibAuto $MPI_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
fi fi
;; ;;
USERMPI) USERMPI)
# Use an arbitrary, user-specified mpi implementation # Use an arbitrary, user-specified mpi implementation
export FOAM_MPI=mpi-user export FOAM_MPI=mpi-user
_foamEtc config.sh/mpi-user # <- Adjustments _foamEtc -config mpi-user # <- Adjustments (optional)
;; ;;
SYSTEMMPI) SYSTEMMPI)
export FOAM_MPI=mpi-system export FOAM_MPI=mpi-system
_foamEtc config.sh/mpi-system # <- Adjustments (optional) _foamEtc -config mpi-system # <- Adjustments (optional)
if [ -z "$MPI_ROOT" ] if [ -z "$MPI_ROOT" ]
then then
@ -129,11 +145,11 @@ MPICH)
export MPI_HOME=$MPI_ARCH_PATH export MPI_HOME=$MPI_ARCH_PATH
# Could be sourced from ThirdParty with incomplete environment # Could be sourced from ThirdParty with incomplete environment
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing if command -v _foamAddLibAuto > /dev/null 2>&1 # Normal sourcing
then then
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man _foamAddMan $MPI_ARCH_PATH/share/man
_foamAddLibAuto $MPI_ARCH_PATH lib$WM_COMPILER_LIB_ARCH
fi fi
;; ;;

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/paraview # etc/config.sh/paraview
# - sourced by OpenFOAM-*/etc/bashrc or via foamPV alias
# #
# Description # Description
# Setup for PARAVIEW (partially cmake, qt too) # Setup for PARAVIEW (partially cmake, qt too)
# Sourced from OpenFOAM-<VERSION>/etc/bashrc or from foamPV alias
# #
# For system-wide cmake: cmake_version=cmake-system # For system-wide cmake: cmake_version=cmake-system
# For system-wide qt: ParaView_QT=qt-system # For system-wide qt: ParaView_QT=qt-system
@ -54,16 +54,11 @@ pv_api=auto # Normally auto or pair of digits (eg, '5.4' etc)
archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER" archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
# Clean PATH and LD_LIBRARY_PATH # Clean PATH and LD_LIBRARY_PATH
cleaned=$($WM_PROJECT_DIR/bin/foamCleanPath "$PATH" \ eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=PATH \
"$ParaView_DIR $archDir/cmake- $archDir/qt- $archDir/ParaView-" \ "$ParaView_DIR $archDir/ParaView- $archDir/qt- $archDir/cmake-")
) && PATH="$cleaned"
if [ -n "$LD_LIBRARY_PATH" ] eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=LD_LIBRARY_PATH \
then "$ParaView_DIR $archDir/ParaView- $archDir/qt-")
cleaned=$($WM_PROJECT_DIR/bin/foamCleanPath "$LD_LIBRARY_PATH" \
"$ParaView_DIR $archDir/qt- $archDir/ParaView-" \
) && LD_LIBRARY_PATH="$cleaned"
fi
# ThirdParty cmake # ThirdParty cmake
cmake=$archDir/$cmake_version cmake=$archDir/$cmake_version

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/scotch # etc/config.sh/scotch
# - sourced during wmake process only.
# #
# Description # Description
# Setup for SCOTCH include/libraries (usually ThirdParty installation). # Setup for SCOTCH include/libraries (usually ThirdParty installation).
# Sourced during wmake process only.
# #
# To disable its use: SCOTCH_VERSION=scotch-none # To disable its use: SCOTCH_VERSION=scotch-none
# For system-wide installations: SCOTCH_VERSION=scotch-system # For system-wide installations: SCOTCH_VERSION=scotch-system

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -11,9 +11,10 @@
# #
# File # File
# etc/config.sh/settings # etc/config.sh/settings
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Settings for OpenFOAM, sourced from OpenFOAM-<VERSION>/etc/bashrc # Settings for OpenFOAM.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
export WM_ARCH=$(uname -s) # System name export WM_ARCH=$(uname -s) # System name
@ -216,7 +217,7 @@ unset GMP_ARCH_PATH MPFR_ARCH_PATH
# Load pre-defined compiler versions # Load pre-defined compiler versions
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc config.sh/compiler _foamEtc -config compiler
# ThirdParty base for compilers # ThirdParty base for compilers
archDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH archDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
@ -246,21 +247,15 @@ GCC_NOT_FOUND
# Add ThirdParty compiler libraries to run-time environment # Add ThirdParty compiler libraries to run-time environment
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
# Add ThirdParty gmp/mpfr/mpc libraries to run-time environment # Add gmp/mpfr/mpc libraries to run-time environment.
if [ "${gmpDir##*-}" != system ] # Require that they exist, automatically find lib64/ or lib/.
then _foamAddLibAuto $gmpDir && \
_foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH export GMP_ARCH_PATH=$gmpDir # For non-system CGAL
export GMP_ARCH_PATH=$gmpDir # For ThirdParty CGAL
fi _foamAddLibAuto $mpfrDir && \
if [ "${mpfrDir##*-}" != system ] export MPFR_ARCH_PATH=$mpfrDir # For non-system CGAL
then
_foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH _foamAddLibAuto $mpcDir
export MPFR_ARCH_PATH=$mpfrDir # For ThirdParty CGAL
fi
if [ "${mpcDir##*-}" != system ]
then
_foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH
fi
if [ "$FOAM_VERBOSE" -a "$PS1" ] if [ "$FOAM_VERBOSE" -a "$PS1" ]
then then

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -93,7 +93,7 @@ unset MPI_ARCH_PATH
unset MPI_BUFFER_SIZE unset MPI_BUFFER_SIZE
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs # Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs
if [ -z "$($foamClean "$OPAL_PREFIX" "$foamOldDirs")" ] if [ -z "$($foamClean -env=OPAL_PREFIX "$foamOldDirs")" ]
then then
unset OPAL_PREFIX unset OPAL_PREFIX
fi fi
@ -110,7 +110,7 @@ unset PV_PLUGIN_PATH
unset VTK_DIR unset VTK_DIR
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# unset other ThirdParty environment variables # Unset other ThirdParty environment variables
unset ADIOS_ARCH_PATH unset ADIOS_ARCH_PATH
unset ADIOS1_ARCH_PATH unset ADIOS1_ARCH_PATH
@ -133,9 +133,9 @@ unset SCOTCH_ARCH_PATH
if [ -n "$foamClean" ] if [ -n "$foamClean" ]
then then
cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned" eval $($foamClean -sh-env=PATH "$foamOldDirs")
cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") && LD_LIBRARY_PATH="$cleaned" eval $($foamClean -sh-env=LD_LIBRARY_PATH "$foamOldDirs")
cleaned=$($foamClean "$MANPATH" "$foamOldDirs") && MANPATH="$cleaned" eval $($foamClean -sh-env=MANPATH "$foamOldDirs")
fi fi
[ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH [ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH

View File

@ -11,10 +11,10 @@
# #
# File # File
# etc/config.sh/vtk # etc/config.sh/vtk
# - sourced by OpenFOAM-*/etc/bashrc
# #
# Description # Description
# Setup file for VTK (and MESA) # Setup file for VTK (and MESA)
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
# #
# The library path is only adjusted when the paths specified here # The library path is only adjusted when the paths specified here
# actually exist at the time of sourcing. # actually exist at the time of sourcing.

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -136,12 +136,8 @@ endif
# [WM_PROJECT_USER_DIR] - Location of user files # [WM_PROJECT_USER_DIR] - Location of user files
setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
# Source an etc file, possibly with some verbosity # Load shell "functions" (actually aliases)
if ($?FOAM_VERBOSE && $?prompt) then source $WM_PROJECT_DIR/etc/config.csh/functions
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
else
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
endif
# Override definitions via prefs, with 'other' first so the sys-admin # Override definitions via prefs, with 'other' first so the sys-admin
# can provide base values independent of WM_PROJECT_SITE # can provide base values independent of WM_PROJECT_SITE
@ -181,68 +177,53 @@ while ( $#argv > 0 )
end end
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH) # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
# Prevent local variables from shadowing setenv variables # Prevent local variables from shadowing setenv variables
unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH
if (! $?MANPATH ) setenv MANPATH if (! $?MANPATH ) setenv MANPATH
# Clean PATH (path) _foamClean PATH "$foamOldDirs"
set cleaned=`$foamClean "$PATH" "$foamOldDirs"` _foamClean MANPATH "$foamOldDirs"
if ( $status == 0 ) setenv PATH $cleaned _foamClean LD_LIBRARY_PATH "$foamOldDirs"
# Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
# Clean MANPATH
set cleaned=`$foamClean "$MANPATH" "$foamOldDirs"`
if ( $status == 0 ) setenv MANPATH $cleaned
# Setup for OpenFOAM compilation etc # Setup for OpenFOAM compilation etc
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc config.csh/settings _foamEtc -config settings
# Setup for third-party packages # Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc config.csh/mpi _foamEtc -config mpi
_foamEtc config.csh/paraview _foamEtc -config paraview
_foamEtc config.csh/vtk _foamEtc -config vtk
_foamEtc config.csh/ensight _foamEtc -config ensight
## _foamEtc config.csh/ADIOS ## _foamEtc -config ADIOS
_foamEtc config.csh/CGAL _foamEtc -config CGAL
_foamEtc config.csh/FFTW _foamEtc -config FFTW
# Interactive shell # Interactive shell
if ($?prompt) then if ($?prompt) then
_foamEtc config.csh/aliases _foamEtc -config aliases
_foamEtc config.csh/tcsh_completion _foamEtc -config tcsh_completion
endif endif
# Clean environment paths again. Only remove duplicates # Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Clean PATH (path)
set cleaned=`$foamClean "$PATH"`
if ( $status == 0 ) setenv PATH $cleaned
# Clean LD_LIBRARY_PATH _foamClean PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH"` _foamClean MANPATH
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned _foamClean LD_LIBRARY_PATH
# Clean MANPATH (trailing ':' to find system pages) # Add trailing ':' for system manpages
set cleaned=`$foamClean "$MANPATH"` if ( $?MANPATH ) then
if ( $status == 0 ) setenv MANPATH "${cleaned}:" setenv MANPATH "${MANPATH}:"
endif
# Clean LD_PRELOAD
if ( $?LD_PRELOAD ) then if ( $?LD_PRELOAD ) then
set cleaned=`$foamClean "$LD_PRELOAD"` _foamClean LD_PRELOAD
if ( $status == 0 ) setenv LD_PRELOAD $cleaned
endif endif
@ -250,11 +231,14 @@ endif
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Unload shell "functions" # Unload shell "functions"
unalias _foamClean
unalias _foamEtc unalias _foamEtc
unalias _foamAddPath unalias _foamAddPath
unalias _foamAddLib
unalias _foamAddMan unalias _foamAddMan
unalias _foamAddLib
unalias _foamAddLibAuto
unset cleaned foamClean foamOldDirs # Variables (done as the last statement for a clean exit code)
unset cleaned foamOldDirs
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------