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:
Mark Olesen
2020-02-24 14:41:00 +01:00
parent 083181cac4
commit 5ba2cbc54f
38 changed files with 575 additions and 356 deletions

View File

@ -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

View File

@ -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

View File

@ -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)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -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