From 07ec2b3abdebfb30c99a995a64eef45896a11230 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 23 Feb 2017 10:58:55 +0100 Subject: [PATCH] STYLE: eliminate most use of _foamSource outside of the etc/ hierarchy --- .../mesh/conversion/Optional/Allwmake | 23 +++++++++++++------ etc/config.sh/example/compiler | 11 +++++---- etc/config.sh/functions | 2 +- src/conversion/ccm/Allwmake | 19 +++++++++------ 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/applications/utilities/mesh/conversion/Optional/Allwmake b/applications/utilities/mesh/conversion/Optional/Allwmake index 6e64d2c834..428e8712a6 100755 --- a/applications/utilities/mesh/conversion/Optional/Allwmake +++ b/applications/utilities/mesh/conversion/Optional/Allwmake @@ -1,24 +1,33 @@ #!/bin/sh -# -# Build optional components (eg, may depend on third-party libraries) #------------------------------------------------------------------------------ cd ${0%/*} || exit 1 # Run from this directory +# Optional component: continue-on-error +# - may not have third-party installed +export WM_CONTINUE_ON_ERROR=true + # Parse arguments for compilation (at least for error catching) . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -# Get version info and arch-path -. $WM_PROJECT_DIR/etc/config.sh/functions -_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio) +warning="==> skip ccmio" +if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio) +then + . $settings +else + echo "$warning (no config.sh/ccmio settings)" + exit +fi -# Build libccmio (.a|.so) -$WM_THIRD_PARTY_DIR/makeCCMIO lib # libso +# Build libccmio (.a|.so) - use static linkage for fewer issues +$WM_THIRD_PARTY_DIR/makeCCMIO lib if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \ -a \( -e $CCMIO_ARCH_PATH/lib/libccmio.a -o $FOAM_EXT_LIBBIN/libccmio.so \) ] then wmake $targetType ccm26ToFoam +else + echo $warning fi #------------------------------------------------------------------------------ diff --git a/etc/config.sh/example/compiler b/etc/config.sh/example/compiler index 493cafb56e..96a9ba3382 100644 --- a/etc/config.sh/example/compiler +++ b/etc/config.sh/example/compiler @@ -3,7 +3,7 @@ # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation -# \\/ M anipulation | +# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -31,9 +31,10 @@ #------------------------------------------------------------------------------ # First load the standard versions, if necessary -foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config.sh/compiler \ - 2>/dev/null) -[ $? -eq 0 ] && _foamSource $foamFile +if foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config.sh/compiler) +then + . $foamFile +fi unset foamFile @@ -57,7 +58,7 @@ Gcc48u) export WM_CC='gcc-4.8' export WM_CXX='g++-4.8' ;; -Icc) +Icc*) # Example for ensuring that 3rd software uses the Icc compilers export WM_CC='icc' export WM_CXX='icpc' diff --git a/etc/config.sh/functions b/etc/config.sh/functions index 20b30f697d..cf025c4023 100644 --- a/etc/config.sh/functions +++ b/etc/config.sh/functions @@ -43,7 +43,7 @@ then do [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1" 1>&2 . $1 - shift + shift done } diff --git a/src/conversion/ccm/Allwmake b/src/conversion/ccm/Allwmake index 72914aaf4d..768101d601 100755 --- a/src/conversion/ccm/Allwmake +++ b/src/conversion/ccm/Allwmake @@ -1,18 +1,23 @@ #!/bin/sh -# Build optional components (eg, may depend on third-party libraries) -#------------------------------------------------------------------------------ cd ${0%/*} || exit 1 # Run from this directory +# Optional component: (eg, may depend on third-party libraries) + # Parse arguments for compilation (at least for error catching) . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -. $WM_PROJECT_DIR/etc/config.sh/functions -_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio) - -# Link with static libccmio only (possibly fewer issues) - warning="==> skip optional libccm adapter" +if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio) +then + . $settings +else + echo "$warning (no config.sh/ccmio settings)" + exit +fi + + +# Link with static libccmio only (possibly fewer issues) if [ -e $CCMIO_ARCH_PATH/include/libccmio/ccmio.h \ -a -e $CCMIO_ARCH_PATH/lib/libccmio.a ] then