mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
CONFIG: improve prefix matching for system libraries (#1607)
- missed detection of system libraries when installed with multiarch paths like /usr/lib/x86_64-linux-gnu CONFIG: improve handling of group/user config files (#928) - changed bashrc handling of FOAM_CONFIG_NOUSER to use FOAM_CONFIG_MODE instead. Propagate into foamEtcFile to make this a stickier control. This change allows better control, but also enables cluster installations to define their own value within the OpenFOAM prefs.sh file to prevent users accidentally mis-configuring things if necessary. - remove undocumented handling of an (a)ll mode in foamEtcFile to avoid potential pitfalls. - add support for FOAM_CONFIG_ETC handling. This allows injection of an extra search layer when finding project etc files ENH: improvements to foamConfigurePaths (#928) - handle FOAM_CONFIG_ETC implicitly, or explicitly with the new -etc option. STYLE: more explicit wording in foamConfigurePaths usage (#1602) - document that an absolute path (eg, -scotch-path) overrides/ignores the equivalent ThirdParty setting (eg, -scotch) - longer options -system-compiler and -third-compiler for -system and -third, respectively. Clearer as to their purpose. - adjust the location sanity check to look for META-INFO directory.
This commit is contained in:
@ -33,7 +33,13 @@
|
||||
# \endcode
|
||||
#
|
||||
# Environment
|
||||
# - WM_PROJECT_SITE (unset defaults to PROJECT/site)
|
||||
# FOAM_CONFIG_ETC
|
||||
# Alternative etc directory for shipped files
|
||||
#
|
||||
# FOAM_CONFIG_MODE
|
||||
# Fallback search mode for etc files. Unset is the same as "ugo".
|
||||
#
|
||||
# WM_PROJECT_SITE (unset defaults to PROJECT/site)
|
||||
#
|
||||
# Note
|
||||
# This script must exist in the project 'bin' directory
|
||||
@ -46,8 +52,8 @@
|
||||
printHelp() {
|
||||
cat<<USAGE
|
||||
|
||||
Usage: foamEtcFile [OPTION] fileName [-- args]
|
||||
foamEtcFile [OPTION] [-list|-list-test] [fileName]
|
||||
Usage: ${0##*/} [OPTION] fileName [-- args]
|
||||
${0##*/} [OPTION] [-list|-list-test] [fileName]
|
||||
|
||||
options:
|
||||
-all (-a) Return all files (otherwise stop after the first match)
|
||||
@ -106,6 +112,20 @@ projectDir="$(\cd $(dirname $binDir) && \pwd -L)" # Project dir
|
||||
|
||||
userDir="$HOME/.OpenFOAM" # As per foamVersion.H
|
||||
groupDir="${WM_PROJECT_SITE:-$projectDir/site}" # As per foamVersion.H
|
||||
optMode=ugo # Default search = 'ugo'
|
||||
|
||||
# Environment overrides
|
||||
case "$FOAM_CONFIG_MODE" in ([ugo]*) optMode="$FOAM_CONFIG_MODE" ;; esac
|
||||
|
||||
# Verify validity of FOAM_CONFIG_ETC
|
||||
if [ -n "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
if [ ! -d "$FOAM_CONFIG_ETC" ] || [ "$FOAM_CONFIG_ETC" = "$projectDir/etc" ]
|
||||
then
|
||||
# Bad directory or redundant value
|
||||
unset FOAM_CONFIG_ETC
|
||||
fi
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@ -163,7 +183,6 @@ getPatchLevel()
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
optMode=ugo # Default mode is always 'ugo'
|
||||
unset shellOutput verboseOutput
|
||||
unset optAll optConfig optList projectApi
|
||||
|
||||
@ -208,7 +227,7 @@ do
|
||||
-config)
|
||||
optConfig=true
|
||||
;;
|
||||
-mode=[ugoa]*)
|
||||
-mode=[ugo]*)
|
||||
optMode="${1#*=}"
|
||||
;;
|
||||
-m | -mode)
|
||||
@ -216,7 +235,7 @@ do
|
||||
shift
|
||||
# Sanity check. Handles missing argument too.
|
||||
case "$optMode" in
|
||||
([ugoa]*)
|
||||
([ugo]*)
|
||||
;;
|
||||
(*)
|
||||
die "invalid mode '$optMode'"
|
||||
@ -259,7 +278,6 @@ done
|
||||
# Establish the API value
|
||||
[ -n "$projectApi" ] || projectApi=$(getApi)
|
||||
|
||||
|
||||
# Split arguments into filename (for searching) and trailing bits for shell eval
|
||||
# Silently remove leading ~OpenFOAM/ (as per Foam::findEtcFile)
|
||||
nArgs=$#
|
||||
@ -293,23 +311,23 @@ fi
|
||||
|
||||
# Define the various places to be searched:
|
||||
unset dirList
|
||||
case "$optMode" in (*[au]*) # (A)ll or (U)ser
|
||||
case "$optMode" in (*[u]*) # (U)ser
|
||||
dirList="$dirList $userDir/$projectApi $userDir"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$optMode" in (*[ag]*) # (A)ll or (G)roup == site
|
||||
case "$optMode" in (*[g]*) # (G)roup == site
|
||||
dirList="$dirList $groupDir/$projectApi/etc $groupDir/etc"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$optMode" in (*[ao]*) # (A)ll or (O)ther == shipped
|
||||
dirList="$dirList $projectDir/etc"
|
||||
case "$optMode" in (*[o]*) # (O)ther == shipped
|
||||
dirList="$dirList $FOAM_CONFIG_ETC $projectDir/etc"
|
||||
;;
|
||||
esac
|
||||
set -- $dirList
|
||||
|
||||
[ "$#" -ge 1 ] || die "No directories to scan. Programming error?"
|
||||
[ "$#" -ge 1 ] || die "No directories to scan. Programming or user error?"
|
||||
exitCode=2 # Fallback is a FileNotFound error
|
||||
|
||||
|
||||
@ -318,7 +336,7 @@ exitCode=2 # Fallback is a FileNotFound error
|
||||
#
|
||||
|
||||
# Special handling of config.sh/ , config.csh/ directories
|
||||
if [ -n "$optConfig" -a -n "$shellOutput" -a -n "$fileName" ]
|
||||
if [ -n "$optConfig" ] && [ -n "$shellOutput" ] && [ -n "$fileName" ]
|
||||
then
|
||||
case "$shellOutput" in
|
||||
csh*)
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
# or {user,site} locations and copy it into the case directory.
|
||||
#
|
||||
# Environment
|
||||
# FOAM_API
|
||||
# FOAM_CONFIG_ETC
|
||||
# WM_PROJECT_DIR
|
||||
# WM_PROJECT_SITE
|
||||
#
|
||||
@ -81,9 +81,7 @@ die()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
projectDir="$WM_PROJECT_DIR" # Project dir
|
||||
userDir="$HOME/.OpenFOAM" # As per foamVersion.H
|
||||
groupDir="${WM_PROJECT_SITE:-$projectDir/site}" # As per foamVersion.H
|
||||
projectApi="$FOAM_API"
|
||||
unset projectApi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@ -163,20 +161,12 @@ then
|
||||
fi
|
||||
|
||||
|
||||
# No api specified -with-api= or from environment (FOAM_API)
|
||||
if [ -z "$projectApi" ]
|
||||
then
|
||||
projectApi="$(foamEtcFile -show-api 2>/dev/null)"
|
||||
fi
|
||||
# The places to be searched.
|
||||
# Like foamEtcFile, but "etc/caseDicts/" for the projectDir
|
||||
|
||||
|
||||
# Define the various places to be searched.
|
||||
# Similar to foamEtcFile, but with etc/caseDicts/ for the projectDir
|
||||
# Filter out nonexistent directories later
|
||||
|
||||
searchDirs="${projectApi:+$userDir/$projectApi} $userDir \
|
||||
${projectApi:+$groupDir/$projectApi/etc} $groupDir/etc \
|
||||
$projectDir/etc/caseDicts";
|
||||
searchDirs="\
|
||||
$("$projectDir"/bin/foamEtcFile -list-test -mode=ug ${projectApi:+-with-api=$projectApi} 2>/dev/null) \
|
||||
$("$projectDir"/bin/foamEtcFile -list -mode=o caseDicts 2>/dev/null)";
|
||||
|
||||
## echo "Using <$searchDirs>" 1>&2
|
||||
|
||||
|
||||
13
bin/foamLog
13
bin/foamLog
@ -7,6 +7,7 @@
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -38,8 +39,6 @@
|
||||
#------------------------------------------------------------------------------
|
||||
Script="${0##*/}"
|
||||
toolsDir="${0%/*}/tools"
|
||||
groupDir="${WM_PROJECT_SITE:-${WM_PROJECT_DIR:-<unknown>}/site}"
|
||||
userDir="$HOME/.OpenFOAM"
|
||||
|
||||
usage() {
|
||||
exec 1>&2
|
||||
@ -91,13 +90,9 @@ cat <<HELP
|
||||
The value taken will be the first (non-space)word after this column.
|
||||
|
||||
The database ($Script.db) will taken from these locations:
|
||||
.
|
||||
$userDir/$FOAM_API/
|
||||
$userDir/
|
||||
$groupDir/$FOAM_API/etc/
|
||||
$groupDir/etc/
|
||||
$WM_PROJECT_DIR/etc/
|
||||
$toolsDir
|
||||
./
|
||||
$(foamEtcFile -list | sed -e 's#^# #')
|
||||
$toolsDir
|
||||
|
||||
option -quiet : suppresses the default information and only prints the
|
||||
extracted variables.
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -32,7 +33,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
DIR="$FOAM_ETC/codeTemplates/app"
|
||||
DIR="$WM_PROJECT_DIR/etc/codeTemplates/app"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -32,7 +33,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
DIR="$FOAM_ETC/codeTemplates/BC"
|
||||
DIR="$WM_PROJECT_DIR/etc/codeTemplates/BC"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -33,7 +34,7 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
DIR="$FOAM_ETC/codeTemplates/functionObject"
|
||||
DIR="$WM_PROJECT_DIR/etc/codeTemplates/functionObject"
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
|
||||
@ -19,15 +19,22 @@
|
||||
# Adjust hardcoded installation versions and paths
|
||||
# in etc/{bashrc,cshrc} and etc/config.{sh,csh}/
|
||||
#
|
||||
# Requires
|
||||
# - sed
|
||||
# - bin/foamEtcFile
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_ETC
|
||||
# Alternative etc directory for shipped files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
usage() {
|
||||
exec 1>&2
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
printHelp() {
|
||||
cat<<USAGE
|
||||
|
||||
usage: ${0##*/} options
|
||||
usage: $0 options
|
||||
|
||||
Basic
|
||||
-etc=DIR set FOAM_CONFIG_ETC for alternative project files
|
||||
-project-path DIR specify 'WM_PROJECT_DIR' (eg, /opt/openfoam1806-patch1)
|
||||
-version VER specify project version (eg, v1806)
|
||||
-sp | -SP | -float32 single precision (WM_PRECISION_OPTION)
|
||||
@ -36,13 +43,13 @@ Basic
|
||||
-int32 | -int64 the 'WM_LABEL_SIZE'
|
||||
|
||||
Compiler
|
||||
-system NAME specify 'system' compiler to use (eg, Gcc, Icc,...)
|
||||
-third NAME specify 'ThirdParty' compiler to use (eg, Clang40,...)
|
||||
-gcc VER specify 'default_gcc_version' for ThirdParty Gcc
|
||||
-clang VER specify 'default_clang_version' for ThirdParty Clang
|
||||
gmp-VERSION for ThirdParty gcc (gmp-system for system library)
|
||||
mpfr-VERSION for ThirdParty gcc (mpfr-system for system library)
|
||||
mpc-VERSION for ThirdParty gcc (mpc-system for system library)
|
||||
-system-compiler NAME The 'system' compiler to use (eg, Gcc, Clang, Icc,...)
|
||||
-third-compiler NAME The 'ThirdParty' compiler to use (eg, Clang40,...)
|
||||
-gcc VER The 'default_gcc_version' for ThirdParty Gcc
|
||||
-clang VER The 'default_clang_version' for ThirdParty Clang
|
||||
gmp-VERSION For ThirdParty gcc (gmp-system for system library)
|
||||
mpfr-VERSION For ThirdParty gcc (mpfr-system for system library)
|
||||
mpc-VERSION For ThirdParty gcc (mpc-system for system library)
|
||||
|
||||
MPI
|
||||
-mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc)
|
||||
@ -50,22 +57,24 @@ MPI
|
||||
-openmpi-system use system openmpi
|
||||
-openmpi-third use ThirdParty openmpi (using default version)
|
||||
|
||||
Components
|
||||
ThirdParty versions
|
||||
-adios VER specify 'adios2_version'
|
||||
-adios-path DIR specify 'ADIOS2_ARCH_PATH'
|
||||
-boost VER specify 'boost_version'
|
||||
-boost-path DIR specify 'BOOST_ARCH_PATH'
|
||||
-cgal ver specify 'cgal_version'
|
||||
-cgal-path DIR specify 'CGAL_ARCH_PATH'
|
||||
-cmake VER specify 'cmake_version'
|
||||
-fftw VER specify 'fffw_version'
|
||||
-fftw-path DIR specify 'FFTW_ARCH_PATH'
|
||||
-kahip VER specify 'KAHIP_VERSION'
|
||||
-kahip-path DIR specify 'KAHIP_ARCH_PATH'
|
||||
-metis ver specify 'METIS_VERSION'
|
||||
-metis-path DIR specify 'METIS_ARCH_PATH'
|
||||
-scotch VER specify 'SCOTCH_VERSION' (eg, scotch_6.0.4)
|
||||
-scotch-path DIR specify 'SCOTCH_ARCH_PATH' (eg, /opt/scotch_6.0.4)
|
||||
|
||||
Components specified by absolute path
|
||||
-adios-path DIR Path for 'ADIOS2_ARCH_PATH' (overrides -adios)
|
||||
-boost-path DIR Path for 'BOOST_ARCH_PATH' (overrides -boost)
|
||||
-cgal-path DIR Path for 'CGAL_ARCH_PATH' (overrides -cgal)
|
||||
-fftw-path DIR Path for 'FFTW_ARCH_PATH' (overrides -fftw)
|
||||
-kahip-path DIR Path for 'KAHIP_ARCH_PATH' (overrides -kahip)
|
||||
-metis-path DIR Path for 'METIS_ARCH_PATH' (overrides -metis)
|
||||
-scotch-path DIR Path for 'SCOTCH_ARCH_PATH' (overrides -scotch)
|
||||
|
||||
Graphics
|
||||
-paraview VER specify 'ParaView_VERSION' (eg, 5.4.1 or system)
|
||||
@ -92,11 +101,14 @@ Equivalent options:
|
||||
-paraview-path --paraviewInstall | -paraviewInstall
|
||||
-scotch --scotchVersion | -scotchVersion
|
||||
-scotch-path --scotchArchPath | -scotchArchPath
|
||||
-system-compiler -system
|
||||
-third-compiler -third
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
exit 0 # clean exit
|
||||
}
|
||||
|
||||
|
||||
# Report error and exit
|
||||
die()
|
||||
{
|
||||
@ -105,7 +117,7 @@ die()
|
||||
echo "Error encountered:"
|
||||
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||
echo
|
||||
echo "See '${0##*/} -help' for usage"
|
||||
echo "See '$0 -help' for usage"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
@ -113,8 +125,23 @@ die()
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# Check that it appears to be an OpenFOAM installation
|
||||
[ -f etc/bashrc -a -d etc/config.sh ] || \
|
||||
usage "Please run from top-level directory of installation"
|
||||
if [ -f etc/bashrc ] && [ -d "META-INFO" ]
|
||||
then
|
||||
echo "Configuring OpenFOAM" 1>&2
|
||||
else
|
||||
die "Please run from the OpenFOAM top-level installation directory" \
|
||||
"No etc/bashrc or META-INFO/ found"
|
||||
fi
|
||||
|
||||
# Use foamEtcFile to locate files, but only edit shipped files
|
||||
if [ -x bin/foamEtcFile ]
|
||||
then
|
||||
_foamEtc() {
|
||||
./bin/foamEtcFile -mode=o "$@"
|
||||
}
|
||||
else
|
||||
die "No bin/foamEtcFile found in installation"
|
||||
fi
|
||||
|
||||
|
||||
# Check if argument matches the expected input. Respects case.
|
||||
@ -211,6 +238,28 @@ replaceCsh()
|
||||
done
|
||||
}
|
||||
|
||||
# Locate file with foamEtcFile -mode=o and forward to replace()
|
||||
replaceEtc()
|
||||
{
|
||||
local file="$1"
|
||||
shift
|
||||
|
||||
file=$(_foamEtc "$file")
|
||||
replace $file "$@"
|
||||
}
|
||||
|
||||
|
||||
# Locate file with foamEtcFile -mode=o and forward to replaceCsh()
|
||||
replaceEtcCsh()
|
||||
{
|
||||
local file="$1"
|
||||
shift
|
||||
|
||||
file=$(_foamEtc "$file")
|
||||
replaceCsh $file "$@"
|
||||
}
|
||||
|
||||
|
||||
# Get the option's value (argument), or die on missing or empty argument
|
||||
# $1 option
|
||||
# $2 value
|
||||
@ -275,22 +324,55 @@ while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help* | --help*)
|
||||
usage
|
||||
printHelp
|
||||
;;
|
||||
'')
|
||||
# Discard empty arguments
|
||||
;;
|
||||
|
||||
-debug-list)
|
||||
# Undocumented (experimental)
|
||||
# TDB: List files that can be edited by this script
|
||||
cat << CONFIG_SH
|
||||
etc/bashrc
|
||||
etc/config.sh/adios2
|
||||
etc/config.sh/compiler
|
||||
etc/config.sh/paraview
|
||||
etc/config.sh/vtk
|
||||
etc/config.sh/CGAL
|
||||
etc/config.sh/FFTW
|
||||
etc/config.sh/metis
|
||||
etc/config.sh/kahip
|
||||
etc/config.sh/scotch
|
||||
CONFIG_SH
|
||||
|
||||
cat << CONFIG_CSH
|
||||
etc/cshrc
|
||||
etc/config.csh/adios2
|
||||
etc/config.csh/compiler
|
||||
etc/config.csh/paraview
|
||||
etc/config.csh/vtk
|
||||
etc/config.csh/CGAL
|
||||
etc/config.csh/FFTW
|
||||
CONFIG_CSH
|
||||
exit 0
|
||||
;;
|
||||
|
||||
## Basic ##
|
||||
|
||||
-etc=*)
|
||||
# Define FOAM_CONFIG_ETC for finding files
|
||||
export FOAM_CONFIG_ETC="${1#*=}"
|
||||
;;
|
||||
|
||||
-project-path)
|
||||
# Replace WM_PROJECT_DIR=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc WM_PROJECT_DIR "\"$optionValue\""
|
||||
replaceCsh etc/cshrc WM_PROJECT_DIR "\"$optionValue\""
|
||||
replaceEtc bashrc WM_PROJECT_DIR "\"$optionValue\""
|
||||
replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optionValue\""
|
||||
|
||||
removeBashMagic etc/bashrc
|
||||
removeCshMagic etc/cshrc
|
||||
removeBashMagic $(_foamEtc bashrc)
|
||||
removeCshMagic $(_foamEtc cshrc)
|
||||
|
||||
adjusted=true
|
||||
shift
|
||||
@ -299,8 +381,8 @@ do
|
||||
-version | -foamVersion | --projectVersion)
|
||||
# Replace WM_PROJECT_VERSION=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc WM_PROJECT_VERSION "$optionValue"
|
||||
replaceCsh etc/cshrc WM_PROJECT_VERSION "$optionValue"
|
||||
replaceEtc bashrc WM_PROJECT_VERSION "$optionValue"
|
||||
replaceEtcCsh cshrc WM_PROJECT_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -314,30 +396,30 @@ do
|
||||
|
||||
-sp | -SP | -float32)
|
||||
# Replace WM_PRECISION_OPTION=...
|
||||
replace etc/bashrc WM_PRECISION_OPTION "SP"
|
||||
replaceCsh etc/cshrc WM_PRECISION_OPTION "SP"
|
||||
replaceEtc bashrc WM_PRECISION_OPTION "SP"
|
||||
replaceEtcCsh cshrc WM_PRECISION_OPTION "SP"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-dp | -DP | -float64)
|
||||
# Replace WM_PRECISION_OPTION=...
|
||||
replace etc/bashrc WM_PRECISION_OPTION "DP"
|
||||
replaceCsh etc/cshrc WM_PRECISION_OPTION "DP"
|
||||
replaceEtc bashrc WM_PRECISION_OPTION "DP"
|
||||
replaceEtcCsh cshrc WM_PRECISION_OPTION "DP"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-spdp | -SPDP)
|
||||
# Replace WM_PRECISION_OPTION=...
|
||||
replace etc/bashrc WM_PRECISION_OPTION "SPDP"
|
||||
replaceCsh etc/cshrc WM_PRECISION_OPTION "SPDP"
|
||||
replaceEtc bashrc WM_PRECISION_OPTION "SPDP"
|
||||
replaceEtcCsh cshrc WM_PRECISION_OPTION "SPDP"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-int32 | -int64)
|
||||
# Replace WM_LABEL_SIZE=...
|
||||
optionValue="${1#-int}"
|
||||
replace etc/bashrc WM_LABEL_SIZE "$optionValue"
|
||||
replaceCsh etc/cshrc WM_LABEL_SIZE "$optionValue"
|
||||
replaceEtc bashrc WM_LABEL_SIZE "$optionValue"
|
||||
replaceEtcCsh cshrc WM_LABEL_SIZE "$optionValue"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
@ -347,8 +429,8 @@ do
|
||||
-clang)
|
||||
# Replace default_clang_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/compiler default_clang_version "$optionValue"
|
||||
replace etc/config.csh/compiler default_clang_version "$optionValue"
|
||||
replaceEtc config.sh/compiler default_clang_version "$optionValue"
|
||||
replaceEtc config.csh/compiler default_clang_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -356,32 +438,32 @@ do
|
||||
-gcc)
|
||||
# Replace default_gcc_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/compiler default_gcc_version "$optionValue"
|
||||
replace etc/config.csh/compiler default_gcc_version "$optionValue"
|
||||
replaceEtc config.sh/compiler default_gcc_version "$optionValue"
|
||||
replaceEtc config.csh/compiler default_gcc_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-system)
|
||||
-system-compiler | -system)
|
||||
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc \
|
||||
replaceEtc bashrc \
|
||||
WM_COMPILER_TYPE system \
|
||||
WM_COMPILER "$optionValue"
|
||||
replaceCsh etc/cshrc \
|
||||
replaceEtcCsh cshrc \
|
||||
WM_COMPILER_TYPE system \
|
||||
WM_COMPILER "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-third | -ThirdParty)
|
||||
-third-compiler | -third | -ThirdParty)
|
||||
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc \
|
||||
replaceEtc bashrc \
|
||||
WM_COMPILER_TYPE ThirdParty \
|
||||
WM_COMPILER "$optionValue"
|
||||
replaceCsh etc/cshrc \
|
||||
replaceEtcCsh cshrc \
|
||||
WM_COMPILER_TYPE ThirdParty \
|
||||
WM_COMPILER "$optionValue"
|
||||
adjusted=true
|
||||
@ -390,22 +472,22 @@ do
|
||||
|
||||
gmp-[4-9]* | gmp-system)
|
||||
# gcc-related package
|
||||
replace etc/config.sh/compiler default_gmp_version "$1"
|
||||
replace etc/config.csh/compiler default_gmp_version "$1"
|
||||
replaceEtc config.sh/compiler default_gmp_version "$1"
|
||||
replaceEtc config.csh/compiler default_gmp_version "$1"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
mpfr-[2-9]* | mpfr-system)
|
||||
# gcc-related package
|
||||
replace etc/config.sh/compiler default_mpfr_version "$1"
|
||||
replace etc/config.csh/compiler default_mpfr_version "$1"
|
||||
replaceEtc config.sh/compiler default_mpfr_version "$1"
|
||||
replaceEtc config.csh/compiler default_mpfr_version "$1"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
mpc-[0-9]* | mpc-system)
|
||||
# gcc-related package
|
||||
replace etc/config.sh/compiler default_mpc_version "$1"
|
||||
replace etc/config.csh/compiler default_mpc_version "$1"
|
||||
replaceEtc config.sh/compiler default_mpc_version "$1"
|
||||
replaceEtc config.csh/compiler default_mpc_version "$1"
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
@ -415,8 +497,8 @@ do
|
||||
-mpi)
|
||||
# Explicitly set WM_MPLIB=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/bashrc WM_MPLIB "$optionValue"
|
||||
replaceCsh etc/cshrc WM_MPLIB "$optionValue"
|
||||
replaceEtc bashrc WM_MPLIB "$optionValue"
|
||||
replaceEtcCsh cshrc WM_MPLIB "$optionValue"
|
||||
optMpi=system
|
||||
adjusted=true
|
||||
shift
|
||||
@ -431,34 +513,34 @@ do
|
||||
_matches "$optMpi" "$expected" || \
|
||||
die "'$1' has bad value: '$optMpi'"
|
||||
|
||||
_inlineSed etc/config.sh/mpi \
|
||||
_inlineSed $(_foamEtc config.sh/mpi) \
|
||||
"FOAM_MPI=$expected" \
|
||||
"FOAM_MPI=$optMpi" \
|
||||
"Replaced 'FOAM_MPI=$expected' setting by 'FOAM_MPI=$optMpi'"
|
||||
|
||||
_inlineSed etc/config.csh/mpi \
|
||||
_inlineSed $(_foamEtc config.csh/mpi) \
|
||||
"FOAM_MPI $expected" \
|
||||
"FOAM_MPI $optMpi" \
|
||||
"Replaced 'FOAM_MPI $expected' setting by 'FOAM_MPI $optMpi'"
|
||||
|
||||
replace etc/bashrc WM_MPLIB OPENMPI
|
||||
replaceCsh etc/cshrc WM_MPLIB OPENMPI
|
||||
replaceEtc bashrc WM_MPLIB OPENMPI
|
||||
replaceEtcCsh cshrc WM_MPLIB OPENMPI
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
-openmpi-system)
|
||||
# Explicitly set WM_MPLIB=SYSTEMOPENMPI
|
||||
replace etc/bashrc WM_MPLIB SYSTEMOPENMPI
|
||||
replaceCsh etc/cshrc WM_MPLIB SYSTEMOPENMPI
|
||||
replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI
|
||||
replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI
|
||||
optMpi=system
|
||||
adjusted=true
|
||||
;;
|
||||
|
||||
-openmpi-third)
|
||||
# Explicitly set WM_MPLIB=OPENMPI, using default setting for openmpi
|
||||
replace etc/bashrc WM_MPLIB OPENMPI
|
||||
replaceCsh etc/cshrc WM_MPLIB OPENMPI
|
||||
replaceEtc bashrc WM_MPLIB OPENMPI
|
||||
replaceEtcCsh cshrc WM_MPLIB OPENMPI
|
||||
optMpi=third
|
||||
adjusted=true
|
||||
;;
|
||||
@ -469,8 +551,8 @@ do
|
||||
-adios | -adios2)
|
||||
# Replace adios2_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/adios2 adios2_version "$optionValue"
|
||||
replace etc/config.csh/adios2 adios2_version "$optionValue"
|
||||
replaceEtc config.sh/adios2 adios2_version "$optionValue"
|
||||
replaceEtc config.csh/adios2 adios2_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -478,8 +560,8 @@ do
|
||||
-adios-path | -adios2-path)
|
||||
# Replace ADIOS2_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
|
||||
replaceCsh etc/config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -487,8 +569,8 @@ do
|
||||
-boost)
|
||||
# Replace boost_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/CGAL boost_version "$optionValue"
|
||||
replace etc/config.csh/CGAL boost_version "$optionValue"
|
||||
replaceEtc config.sh/CGAL boost_version "$optionValue"
|
||||
replaceEtc config.csh/CGAL boost_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -496,8 +578,8 @@ do
|
||||
-boost-path)
|
||||
# Replace BOOST_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
|
||||
replaceCsh etc/config.csh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtcCsh config.csh/CGAL BOOST_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -505,8 +587,8 @@ do
|
||||
-cgal)
|
||||
# Replace cgal_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/CGAL cgal_version "$optionValue"
|
||||
replace etc/config.csh/CGAL cgal_version "$optionValue"
|
||||
replaceEtc config.sh/CGAL cgal_version "$optionValue"
|
||||
replaceEtc config.csh/CGAL cgal_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -514,8 +596,8 @@ do
|
||||
-cgal-path)
|
||||
# Replace CGAL_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/CGAL CGAL_ARCH_PATH "$optionValue"
|
||||
replaceCsh etc/config.csh/CGAL CGAL_ARCH_PATH "$optionValue"
|
||||
replaceEtc config.sh/CGAL CGAL_ARCH_PATH "$optionValue"
|
||||
replaceEtcCsh config.csh/CGAL CGAL_ARCH_PATH "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -523,8 +605,8 @@ do
|
||||
-fftw)
|
||||
# Replace fftw_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/FFTW fftw_version "$optionValue"
|
||||
replace etc/config.csh/FFTW fftw_version "$optionValue"
|
||||
replaceEtc config.sh/FFTW fftw_version "$optionValue"
|
||||
replaceEtc config.csh/FFTW fftw_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -532,8 +614,8 @@ do
|
||||
-fftw-path)
|
||||
# Replace FFTW_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
|
||||
replaceCsh etc/config.csh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtcCsh config.csh/FFTW FFTW_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -541,8 +623,8 @@ do
|
||||
-cmake)
|
||||
# Replace cmake_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/paraview cmake_version "$optionValue"
|
||||
replace etc/config.csh/paraview cmake_version "$optionValue"
|
||||
replaceEtc config.sh/paraview cmake_version "$optionValue"
|
||||
replaceEtc config.csh/paraview cmake_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -550,7 +632,7 @@ do
|
||||
-kahip)
|
||||
# Replace KAHIP_VERSION=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/kahip KAHIP_VERSION "$optionValue"
|
||||
replaceEtc config.sh/kahip KAHIP_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -558,7 +640,7 @@ do
|
||||
-kahip-path)
|
||||
# Replace KAHIP_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -566,7 +648,7 @@ do
|
||||
-metis)
|
||||
# Replace METIS_VERSION=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/metis METIS_VERSION "$optionValue"
|
||||
replaceEtc config.sh/metis METIS_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -574,7 +656,7 @@ do
|
||||
-metis-path)
|
||||
# Replace METIS_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/metis METIS_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -582,7 +664,7 @@ do
|
||||
-scotch | -scotchVersion | --scotchVersion)
|
||||
# Replace SCOTCH_VERSION=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/scotch SCOTCH_VERSION "$optionValue"
|
||||
replaceEtc config.sh/scotch SCOTCH_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -590,7 +672,7 @@ do
|
||||
-scotch-path | -scotchArchPath | --scotchArchPath)
|
||||
# Replace SCOTCH_ARCH_PATH=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\""
|
||||
replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -605,8 +687,8 @@ do
|
||||
_matches "$optionValue" "$expected" || \
|
||||
[ "$optionValue" != "${optionValue%system}" ] || \
|
||||
die "'$1' has bad value: '$optionValue'"
|
||||
replace etc/config.sh/paraview ParaView_VERSION "$optionValue"
|
||||
replace etc/config.csh/paraview ParaView_VERSION "$optionValue"
|
||||
replaceEtc config.sh/paraview ParaView_VERSION "$optionValue"
|
||||
replaceEtc config.csh/paraview ParaView_VERSION "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -614,8 +696,8 @@ do
|
||||
-paraview-qt)
|
||||
# Replace ParaView_QT=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/paraview ParaView_QT "$optionValue"
|
||||
replace etc/config.csh/paraview ParaView_QT "$optionValue"
|
||||
replaceEtc config.sh/paraview ParaView_QT "$optionValue"
|
||||
replaceEtc config.csh/paraview ParaView_QT "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -623,8 +705,8 @@ do
|
||||
-paraview-path | -paraviewInstall | --paraviewInstall)
|
||||
# Replace ParaView_DIR=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/paraview ParaView_DIR \""$optionValue\""
|
||||
replaceCsh etc/config.csh/paraview ParaView_DIR \""$optionValue\""
|
||||
replaceEtc config.sh/paraview ParaView_DIR \""$optionValue\""
|
||||
replaceEtcCsh config.csh/paraview ParaView_DIR \""$optionValue\""
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -632,8 +714,8 @@ do
|
||||
-vtk)
|
||||
# Replace vtk_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/vtk vtk_version "$optionValue"
|
||||
replace etc/config.csh/vtk vtk_version "$optionValue"
|
||||
replaceEtc config.sh/vtk vtk_version "$optionValue"
|
||||
replaceEtc config.csh/vtk vtk_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
@ -641,8 +723,8 @@ do
|
||||
-mesa)
|
||||
# Replace mesa_version=...
|
||||
optionValue=$(getOptionValue "$@")
|
||||
replace etc/config.sh/vtk mesa_version "$optionValue"
|
||||
replace etc/config.csh/vtk mesa_version "$optionValue"
|
||||
replaceEtc config.sh/vtk mesa_version "$optionValue"
|
||||
replaceEtc config.csh/vtk mesa_version "$optionValue"
|
||||
adjusted=true
|
||||
shift
|
||||
;;
|
||||
|
||||
@ -7,23 +7,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2016-2017 CINECA
|
||||
# Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
#
|
||||
# OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# foamCreateModuleInclude
|
||||
@ -134,15 +121,24 @@ syspath() {
|
||||
# Frontend: do all basic sanity checks in the front-end only
|
||||
if [ -z "$optBackend" ]
|
||||
then
|
||||
# Check that it appears to be an OpenFOAM installation
|
||||
[ -d "$projectDir" -a -f "$projectDir/etc/bashrc" ] || \
|
||||
die "Incorrect projectDir? $projectDir"
|
||||
|
||||
# Check preloads
|
||||
for file in "$preloads"
|
||||
do
|
||||
[ -f "$file" ] || echo "No such file to preload: $file" 1>&2
|
||||
done
|
||||
if [ -n "$preloads" ]
|
||||
then
|
||||
for file in $preloads
|
||||
do
|
||||
[ -f "$file" ] || echo "No such file to preload: $file" 1>&2
|
||||
done
|
||||
fi
|
||||
|
||||
# Check that it appears to be an OpenFOAM installation
|
||||
# could also check [ -d "$projectDir/META-INFO" ]
|
||||
if [ -d "$projectDir" ] && [ -f "etc/bashrc" ]
|
||||
then
|
||||
echo "Appears to be an OpenFOAM installation" 1>&2
|
||||
else
|
||||
die "Incorrect OpenFOAM projectDir?" \
|
||||
" $projectDir"
|
||||
fi
|
||||
|
||||
# Call itself with clean environment.
|
||||
# Tag the start/end of the original PATH, MANPATH, LD_LIBRARY_PATH
|
||||
@ -234,6 +230,9 @@ unset FOAM_INST_DIR WM_PROJECT_INST_DIR
|
||||
unset WM_PROJECT_USER_DIR WM_THIRD_PARTY_DIR
|
||||
unset SCOTCH_VERSION
|
||||
|
||||
# Probably don't want these either
|
||||
unset FOAM_CONFIG_MODE
|
||||
|
||||
|
||||
# Also remove user directories as being unreliable
|
||||
|
||||
@ -283,7 +282,7 @@ unalias util 2>/dev/null
|
||||
#------------------------------------------------
|
||||
|
||||
# Generalize environment.
|
||||
# This needs rethinking since it largely duplicates logic from the etc/config.sh/settings
|
||||
# Needs rethinking, it largely duplicates logic from etc/config.sh/settings
|
||||
rewriteEnv()
|
||||
{
|
||||
sed \
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# tools/lib-dir [OPTION] DIR [LIBEXT]
|
||||
@ -135,7 +134,7 @@ then
|
||||
fi
|
||||
|
||||
# 2) Use fallback if the previous failed
|
||||
if [ -z "$resolved" -a -n "$alt" ]
|
||||
if [ -z "$resolved" ] && [ -n "$alt" ]
|
||||
then
|
||||
# Fallback
|
||||
case "$alt" in
|
||||
|
||||
10
etc/bashrc
10
etc/bashrc
@ -35,10 +35,16 @@
|
||||
# . /path/etc/bashrc WM_COMPILER=Clang WM_LABEL_SIZE=64
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
# FOAM_CONFIG_ETC
|
||||
# - alternative/additional location for OpenFOAM etc/ directory
|
||||
#
|
||||
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
|
||||
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
|
||||
# - no influence on OpenFOAM applications, just the config files
|
||||
#
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
#
|
||||
# WM_PROJECT_SITE (optional directory)
|
||||
# - local site-specific directory, uses WM_PROJECT_DIR/site if unset
|
||||
#
|
||||
|
||||
@ -8,9 +8,10 @@
|
||||
Description
|
||||
Solves a transport equation for a scalar field.
|
||||
|
||||
The name of the scalar field is specified in this file. A sample scalar
|
||||
field file, that must be initialised for the case, typically in the 0
|
||||
directory, is available in $FOAM_ETC/caseDicts/solvers/scalarTransport.
|
||||
The name of the scalar field is specified in this file.
|
||||
A sample scalar field file, that must be initialised for the case,
|
||||
typically in the 0 directory,
|
||||
is available in tetc/caseDicts/solvers/scalarTransport
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/functions
|
||||
@ -36,25 +35,13 @@ alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
|
||||
alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`'
|
||||
|
||||
# Echo values when FOAM_VERBOSE is on, no-op otherwise
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
alias _foamEcho 'echo \!*'
|
||||
else
|
||||
alias _foamEcho 'true'
|
||||
endif
|
||||
|
||||
# Source an etc file, possibly with some verbosity
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
if ($?FOAM_CONFIG_NOUSER) then
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose -mode=o \!*`'
|
||||
else
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
|
||||
endif
|
||||
alias _foamEcho 'echo \!*'
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`'
|
||||
else
|
||||
if ($?FOAM_CONFIG_NOUSER) then
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh -mode=o \!*`'
|
||||
else
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
|
||||
endif
|
||||
alias _foamEcho 'true'
|
||||
alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`'
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/settings
|
||||
|
||||
@ -18,10 +18,11 @@
|
||||
# Finalize setup of OpenFOAM environment for C-shell (csh, tcsh)
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
|
||||
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
|
||||
#
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -77,14 +78,21 @@ endif
|
||||
|
||||
|
||||
# Overrides via <prefs.csh>
|
||||
# 1. other (system) values
|
||||
# 1. Always use (O)ther values from the OpenFOAM project etc/ directory
|
||||
_foamEtc -mode=o prefs.csh
|
||||
|
||||
# 2. user or group values (unless disabled)
|
||||
if (! $?FOAM_CONFIG_NOUSER ) then
|
||||
_foamEtc -mode=ug prefs.csh
|
||||
# 2. (U)ser or (G)roup values (unless disabled). Could use some more work
|
||||
if ($?FOAM_CONFIG_MODE) then
|
||||
set configMode="${FOAM_CONFIG_MODE:s/o//}" # Already handled O(ther)
|
||||
else
|
||||
set configMode="ug"
|
||||
endif
|
||||
|
||||
# Is the remainder valid - has U(ser) or G(roup)?
|
||||
switch ("$configMode")
|
||||
case *[ug]*:
|
||||
_foamEtc -mode="$configMode" prefs.csh
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
# Capture and evaluate any command-line parameters
|
||||
# These can be used to set/unset values, specify additional files etc.
|
||||
@ -119,6 +127,16 @@ while ( $#argv > 0 )
|
||||
shift
|
||||
end
|
||||
|
||||
# The prefs may have injected a FOAM_CONFIG_ETC value.
|
||||
# Verify that it makes sense before continuing.
|
||||
if ( $?FOAM_CONFIG_ETC ) then
|
||||
if ( ! -d "$FOAM_CONFIG_ETC" ) then
|
||||
echo "Ignore invalid FOAM_CONFIG_ETC = $FOAM_CONFIG_ETC"
|
||||
else if ( "$FOAM_CONFIG_ETC" == "$WM_PROJECT_DIR/etc" ) then
|
||||
unsetenv FOAM_CONFIG_ETC
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -82,6 +82,8 @@ unsetenv FOAM_API
|
||||
unsetenv FOAM_APPBIN
|
||||
unsetenv FOAM_APP
|
||||
unsetenv FOAM_CODE_TEMPLATES
|
||||
unsetenv FOAM_CONFIG_ETC
|
||||
unsetenv FOAM_CONFIG_MODE
|
||||
unsetenv FOAM_ETC
|
||||
unsetenv FOAM_EXTRA_CXXFLAGS
|
||||
unsetenv FOAM_EXTRA_LDFLAGS
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/functions
|
||||
@ -39,32 +38,25 @@ then
|
||||
{
|
||||
foamVar_name="$1"
|
||||
shift
|
||||
eval "$($foamClean -sh-env=$foamVar_name $@)"
|
||||
eval "$($foamClean -sh-env="$foamVar_name" "$@")"
|
||||
unset "foamVar_name"
|
||||
}
|
||||
|
||||
# Echo values to stderr when FOAM_VERBOSE is on, no-op otherwise
|
||||
unset -f _foamEcho 2>/dev/null
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
_foamEcho() { echo "$@" 1>&2; }
|
||||
else
|
||||
_foamEcho() { true; }
|
||||
fi
|
||||
|
||||
# Source an etc file, possibly with some verbosity
|
||||
# - use eval to avoid intermediate variables (ksh doesn't have 'local')
|
||||
unset -f _foamEcho 2>/dev/null
|
||||
unset -f _foamEtc 2>/dev/null
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
_foamEtc()
|
||||
{
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh-verbose ${FOAM_CONFIG_NOUSER:+-mode=o} $@)";
|
||||
_foamEcho() { echo "$@" 1>&2; }
|
||||
_foamEtc() {
|
||||
eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh-verbose "$@")";
|
||||
}
|
||||
else
|
||||
_foamEtc()
|
||||
{
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} $@)";
|
||||
_foamEcho() { true; }
|
||||
_foamEtc() {
|
||||
eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh "$@")";
|
||||
}
|
||||
fi
|
||||
|
||||
@ -162,7 +154,7 @@ then
|
||||
# - use lib-dir script instead of rewriting
|
||||
_foamAddLibAuto()
|
||||
{
|
||||
eval "$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $@)";
|
||||
eval "$("$WM_PROJECT_DIR"/bin/tools/lib-dir -sh "$@")";
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/paraview
|
||||
@ -109,7 +108,7 @@ case "$ParaView_VERSION" in
|
||||
|
||||
(system)
|
||||
unset PV_PLUGIN_PATH
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} -config paraview-system)"
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh -config paraview-system)"
|
||||
;;
|
||||
|
||||
(*)
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/settings
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/setup
|
||||
@ -19,15 +18,16 @@
|
||||
# Finalize setup of OpenFOAM environment for POSIX shell.
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
|
||||
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
|
||||
#
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# [FOAM_API] - The API level for the project
|
||||
export FOAM_API="$($WM_PROJECT_DIR/bin/foamEtcFile -show-api)"
|
||||
export FOAM_API=$("$WM_PROJECT_DIR/bin/foamEtcFile" -show-api)
|
||||
|
||||
# The installation parent directory
|
||||
prefixDir="${WM_PROJECT_DIR%/*}"
|
||||
@ -83,11 +83,22 @@ fi
|
||||
|
||||
|
||||
# Overrides via <prefs.sh>
|
||||
# 1. other (system) values
|
||||
# 1. Always use O(ther) values from the OpenFOAM project etc/ directory
|
||||
_foamEtc -mode=o prefs.sh
|
||||
|
||||
# 2. user or group values (unless disabled)
|
||||
[ -z "$FOAM_CONFIG_NOUSER" ] && _foamEtc -mode=ug prefs.sh
|
||||
# 2. (U)ser or (G)roup values (unless disabled).
|
||||
unset configMode
|
||||
if [ -z "$FOAM_CONFIG_MODE" ]
|
||||
then
|
||||
configMode="ug"
|
||||
else
|
||||
case "$FOAM_CONFIG_MODE" in (*[u]*) configMode="${configMode}u" ;; esac
|
||||
case "$FOAM_CONFIG_MODE" in (*[g]*) configMode="${configMode}g" ;; esac
|
||||
fi
|
||||
if [ -n "$configMode" ]
|
||||
then
|
||||
_foamEtc -mode="$configMode" prefs.sh
|
||||
fi
|
||||
|
||||
|
||||
# Capture and evaluate any command-line parameters
|
||||
@ -104,6 +115,21 @@ else
|
||||
_foamEval "$@"
|
||||
fi
|
||||
|
||||
# The prefs may have injected a FOAM_CONFIG_ETC value.
|
||||
# Verify that it makes sense before continuing.
|
||||
if [ -n "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
if [ ! -d "$FOAM_CONFIG_ETC" ]
|
||||
then
|
||||
echo "Ignore invalid FOAM_CONFIG_ETC = $FOAM_CONFIG_ETC" 1>&2
|
||||
unset FOAM_CONFIG_ETC
|
||||
elif [ "$FOAM_CONFIG_ETC" = "$WM_PROJECT_DIR/etc" ]
|
||||
then
|
||||
# Redundant value
|
||||
unset FOAM_CONFIG_ETC
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -69,6 +69,8 @@ unset FOAM_API
|
||||
unset FOAM_APPBIN
|
||||
unset FOAM_APP
|
||||
unset FOAM_CODE_TEMPLATES
|
||||
unset FOAM_CONFIG_ETC
|
||||
unset FOAM_CONFIG_MODE
|
||||
unset FOAM_ETC
|
||||
unset FOAM_EXTRA_CXXFLAGS
|
||||
unset FOAM_EXTRA_LDFLAGS
|
||||
|
||||
10
etc/cshrc
10
etc/cshrc
@ -35,10 +35,16 @@
|
||||
# source /path/etc/cshrc WM_COMPILER=Clang WM_LABEL_SIZE=64
|
||||
#
|
||||
# Environment
|
||||
# FOAM_CONFIG_NOUSER (set/unset)
|
||||
# - suppress use of user/group configuration files
|
||||
# FOAM_CONFIG_ETC
|
||||
# - alternative/additional location for OpenFOAM etc/ directory
|
||||
#
|
||||
# FOAM_CONFIG_MODE (search mode for etc config files - see foamEtcFile)
|
||||
# - eg, FOAM_CONFIG_MODE="o" to only use OpenFOAM config files
|
||||
# - no influence on OpenFOAM applications, just the config files
|
||||
#
|
||||
# FOAM_VERBOSE (set/unset)
|
||||
# - add extra verbosity when sourcing files
|
||||
#
|
||||
# WM_PROJECT_SITE (optional directory)
|
||||
# - local site-specific directory, uses WM_PROJECT_DIR/site if unset
|
||||
#
|
||||
|
||||
16
etc/openfoam
16
etc/openfoam
@ -51,6 +51,7 @@ options:
|
||||
-dp Double precision
|
||||
-spdp Mixed single/double precision
|
||||
-int32 | -int64 The label-size
|
||||
-etc=DIR Additional project etc/ directory
|
||||
-prefix=DIR Alternative OpenFOAM project directory
|
||||
-show-api | -version Print META-INFO api value and exit
|
||||
-show-patch Print META-INFO patch value and exit
|
||||
@ -91,7 +92,7 @@ getApiInfo()
|
||||
|
||||
# No inheritance of FOAM_SETTINGS
|
||||
unset FOAM_SETTINGS
|
||||
unset _foamSettings _foamScriptCommand
|
||||
unset _foamEtcDir _foamSettings _foamScriptCommand
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
@ -142,6 +143,11 @@ do
|
||||
_foamSettings="$_foamSettings${_foamSettings:+ }WM_LABEL_SIZE=${1#-int}"
|
||||
;;
|
||||
|
||||
-etc=*)
|
||||
# Define FOAM_CONFIG_ETC for finding files
|
||||
_foamEtcDir="${1#*=}"
|
||||
;;
|
||||
|
||||
-prefix=*)
|
||||
projectDir="${1#*=}"
|
||||
;;
|
||||
@ -205,6 +211,14 @@ fi
|
||||
exit 2
|
||||
}
|
||||
|
||||
if [ -n "$_foamEtcDir" ] && [ -d "$_foamEtcDir" ]
|
||||
then
|
||||
# Additional etc directory
|
||||
export FOAM_CONFIG_ETC="$_foamEtcDir"
|
||||
else
|
||||
unset FOAM_CONFIG_ETC
|
||||
fi
|
||||
|
||||
if [ -n "$interactive" ]
|
||||
then
|
||||
# Interactive shell
|
||||
|
||||
@ -11,7 +11,7 @@ Overview
|
||||
Meshing
|
||||
=======
|
||||
+ Meshing is setup as in the inflowOutflow template
|
||||
+ See $FOAM_ETC/templates/inflowOutflow/README for details
|
||||
+ See etc/templates/inflowOutflow/README for details
|
||||
+ The setup includes an example for one named patch to be generated in the mesh
|
||||
+ In snappyHexMeshDict, replace <CADregionName> with the name of region in the
|
||||
trisurface; replace <patchName> with the name of the resulting mesh patch
|
||||
@ -21,4 +21,4 @@ Initialisation
|
||||
+ In the field files in the 0 directory, set initial values
|
||||
+ The template includes a fixedValue boundary condition on <patchName> in 0/T
|
||||
+ The user can replace <patchName> with a real mesh patch name and apply a
|
||||
fixed temperature on that patch
|
||||
fixed temperature on that patch
|
||||
|
||||
@ -286,7 +286,7 @@ Foam::fileOperations::collatedFileOperation::collatedFileOperation
|
||||
"enabled, deactivate" << nl
|
||||
<< " threading by setting maxThreadFileBufferSize "
|
||||
"to 0 in" << nl
|
||||
<< " $FOAM_ETC/controlDict"
|
||||
<< " OpenFOAM etc/controlDict"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ echo_adios2()
|
||||
}
|
||||
|
||||
|
||||
# Provide hint for enabling
|
||||
# Hint for enabling
|
||||
hint_adios2()
|
||||
{
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
@ -97,10 +97,10 @@ have_adios2()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -114,10 +114,9 @@ have_adios2()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -132,7 +131,7 @@ have_adios2()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_adios2
|
||||
|
||||
# Testing
|
||||
|
||||
@ -74,10 +74,10 @@ have_boost()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -91,10 +91,9 @@ have_boost()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -111,7 +110,7 @@ have_boost()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_boost
|
||||
|
||||
# Testing
|
||||
|
||||
@ -81,7 +81,7 @@ have_ccmio()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
else
|
||||
unset prefix
|
||||
fi
|
||||
@ -94,10 +94,9 @@ have_ccmio()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -137,7 +136,7 @@ have_ccmio()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_ccmio
|
||||
|
||||
# Testing
|
||||
|
||||
@ -74,10 +74,10 @@ have_cgal()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -91,10 +91,9 @@ have_cgal()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -111,7 +110,7 @@ have_cgal()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_cgal
|
||||
|
||||
# Testing
|
||||
|
||||
@ -74,10 +74,10 @@ have_fftw()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -91,10 +91,9 @@ have_fftw()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -109,7 +108,7 @@ have_fftw()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_fftw
|
||||
|
||||
# Testing
|
||||
|
||||
@ -84,10 +84,10 @@ have_hypre()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -101,10 +101,9 @@ have_hypre()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -119,7 +118,7 @@ have_hypre()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_hypre
|
||||
|
||||
# Testing
|
||||
|
||||
@ -82,10 +82,10 @@ have_kahip()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -99,10 +99,9 @@ have_kahip()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -120,7 +119,7 @@ have_kahip()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_kahip
|
||||
|
||||
# Testing
|
||||
|
||||
@ -82,10 +82,10 @@ have_metis()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -99,10 +99,9 @@ have_metis()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -127,7 +126,7 @@ have_metis()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_metis
|
||||
|
||||
# Testing
|
||||
|
||||
@ -83,10 +83,10 @@ have_mgridgen()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName $libName2)"
|
||||
library=$(findExtLib "$libName" "$libName2")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -100,12 +100,10 @@ have_mgridgen()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib/$libName2" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName2" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName2") \
|
||||
|| {
|
||||
#silent# [ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -165,7 +163,7 @@ have_mgridgen()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_mgridgen
|
||||
|
||||
# Testing
|
||||
|
||||
@ -42,7 +42,7 @@ no_petsc()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Report
|
||||
echo_petsc()
|
||||
{
|
||||
echo "petsc=${HAVE_PETSC:-false}"
|
||||
@ -52,7 +52,7 @@ echo_petsc()
|
||||
}
|
||||
|
||||
|
||||
# Provide hint for enabling
|
||||
# Hint for enabling
|
||||
hint_petsc()
|
||||
{
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
@ -101,10 +101,10 @@ have_petsc()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
|
||||
# No system header, attempt discovery with pkg-config
|
||||
@ -131,10 +131,9 @@ have_petsc()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -151,7 +150,7 @@ have_petsc()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_petsc
|
||||
|
||||
# Testing
|
||||
|
||||
@ -70,10 +70,10 @@ have_readline()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -87,10 +87,9 @@ have_readline()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -106,7 +105,7 @@ have_readline()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_readline
|
||||
|
||||
# Testing
|
||||
|
||||
@ -88,7 +88,7 @@ have_scotch()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile \
|
||||
@ -110,10 +110,9 @@ have_scotch()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -230,10 +229,9 @@ have_ptscotch()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -249,7 +247,7 @@ have_ptscotch()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_scotch
|
||||
|
||||
# Testing
|
||||
|
||||
@ -81,10 +81,10 @@ have_zoltan()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -98,10 +98,9 @@ have_zoltan()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -116,7 +115,7 @@ have_zoltan()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
# Reset variables
|
||||
no_zoltan
|
||||
|
||||
# Testing
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
@ -21,12 +21,18 @@
|
||||
# isNone, isSystem, isAbsdir, hasAbsdir
|
||||
# isDarwin, isWindows
|
||||
# findFirstFile
|
||||
# findSystemInclude
|
||||
# findLibrary
|
||||
# findExtLib
|
||||
#
|
||||
# Internal variables used
|
||||
# extLibraries
|
||||
#
|
||||
# External variables used
|
||||
# WM_OSTYPE (is set for Windows)
|
||||
# WM_COMPILER_LIB_ARCH
|
||||
# DEB_TARGET_MULTIARCH
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$WMAKE_SCRIPTS_SYSFUNCTIONS" ]
|
||||
@ -34,14 +40,19 @@ then
|
||||
# Load once, but do not rely on this variable elsewhere
|
||||
WMAKE_SCRIPTS_SYSFUNCTIONS=loaded
|
||||
|
||||
# Handle Debian multi-arch, ignore missing/bad dpkg-architecture.
|
||||
if [ -z "$DEB_TARGET_MULTIARCH" ]
|
||||
then
|
||||
DEB_TARGET_MULTIARCH=$(dpkg-architecture -qDEB_TARGET_MULTIARCH 2>/dev/null || true)
|
||||
fi
|
||||
|
||||
# True if OS is Darwin.
|
||||
isDarwin()
|
||||
{
|
||||
test Darwin = "$(uname -s 2>/dev/null)"
|
||||
test Darwin = "$(uname -s 2>/dev/null || true)"
|
||||
}
|
||||
|
||||
# True if target OS is Windows
|
||||
# Uses cached value from libso extension
|
||||
isWindows()
|
||||
{
|
||||
test MSwindows = "$WM_OSTYPE"
|
||||
@ -58,7 +69,6 @@ then
|
||||
extLibraries=".a .dll .dll.a" # including cross-compiling
|
||||
fi
|
||||
|
||||
|
||||
# True if '$1' begins with '/'
|
||||
isAbsdir()
|
||||
{
|
||||
@ -126,27 +136,114 @@ then
|
||||
return 2
|
||||
}
|
||||
|
||||
# Check system /usr/local/include /usr/include paths
|
||||
#
|
||||
# On success, echoes the resolved file and returns 0, otherwise returns 2
|
||||
#
|
||||
# Specify -name=incName to search for
|
||||
#
|
||||
findSystemInclude()
|
||||
{
|
||||
local searchName
|
||||
|
||||
case "$1" in
|
||||
-name=*)
|
||||
searchName="${1#*=}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$searchName" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
findFirstFile \
|
||||
"/usr/local/include/$searchName" \
|
||||
"/usr/include/$searchName" \
|
||||
;
|
||||
}
|
||||
|
||||
# Check existence of library with ending '.a', '.so' ...
|
||||
#
|
||||
# On success, echoes the resolved file and returns 0, otherwise returns 2
|
||||
#
|
||||
# This function has two modes of operation.
|
||||
#
|
||||
# 1) Automated search.
|
||||
# Specify -prefix=dirName -name=libName and search for
|
||||
# (lib, lib64, lib/x86_64..) etc.
|
||||
#
|
||||
# 2) Directed search.
|
||||
# specify the fully qualified names to search on the parameter list
|
||||
#
|
||||
findLibrary()
|
||||
{
|
||||
local prefixDir searchDir searchName
|
||||
local file ext
|
||||
|
||||
for file
|
||||
searchDir=true
|
||||
|
||||
while [ "$searchDir" = true ] && [ "$#" -gt 0 ]
|
||||
do
|
||||
[ -n "$file" ] || continue
|
||||
for ext in '' $extLibraries
|
||||
do
|
||||
if [ -f "$file$ext" ] && [ -r "$file$ext" ]
|
||||
then
|
||||
echo "$file$ext" # Found
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
case "$1" in
|
||||
-prefix=*)
|
||||
prefixDir="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
-name=*)
|
||||
searchName="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
(*)
|
||||
unset searchDir
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$searchName" ]
|
||||
then
|
||||
# Automated search
|
||||
# Eg, lib/ lib64/, lib/x86_64-linux-gnu
|
||||
|
||||
: "${prefixDir:=/usr}" # A reasonable default
|
||||
[ -d "$prefixDir" ] || return 2
|
||||
|
||||
for searchDir in \
|
||||
lib \
|
||||
"${WM_COMPILER_LIB_ARCH:+lib}$WM_COMPILER_LIB_ARCH" \
|
||||
"${DEB_TARGET_MULTIARCH:+lib/}${DEB_TARGET_MULTIARCH}" \
|
||||
;
|
||||
do
|
||||
for ext in '' $extLibraries
|
||||
do
|
||||
file="$prefixDir/$searchDir/$searchName$ext"
|
||||
if [ -f "$file" ] && [ -r "$file" ]
|
||||
then
|
||||
echo "$file" # Found
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
else
|
||||
# Directed search
|
||||
|
||||
for file
|
||||
do
|
||||
[ -n "$file" ] || continue
|
||||
for ext in '' $extLibraries
|
||||
do
|
||||
if [ -f "$file$ext" ] && [ -r "$file$ext" ]
|
||||
then
|
||||
echo "$file$ext" # Found
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user