mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +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:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user