diff --git a/bin/foamCleanPath b/bin/foamCleanPath index a5910cad1fbf54e689882446a115e7eadc98c359..1fcfcb196d19584f47b3184c4e1a91e31799c515 100755 --- a/bin/foamCleanPath +++ b/bin/foamCleanPath @@ -7,11 +7,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. # # Script # foamCleanPath @@ -41,7 +40,7 @@ # 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 "$PATH" dir1:dir2)" # eval "$(foamCleanPath -sh=PATH -env=PATH dir1:dir2)" # eval "$(foamCleanPath -sh-env=PATH dir1:dir2)" # @@ -49,16 +48,17 @@ # eval `foamCleanPath -csh-env=PATH dir1:dir2` # #------------------------------------------------------------------------------ -usage() { - cat <<USAGE 1>&2 +printHelp() { + cat<<USAGE + Usage: foamCleanPath [OPTION] path [filter] .. [filter] foamCleanPath [OPTION] -env=name [filter] .. [filter] options: + -env=NAME Evaluate NAME to obtain initial content -csh=NAME Produce 'setenv NAME ...' output for csh eval + -csh-env=NAME Like -csh=NAME, with -env for initial content -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 + -sh-env=NAME Like -sh=NAME, with -env for initial content -debug Print debug information to stderr -strip Remove inaccessible directories -verbose Report some progress (input, output, ...) @@ -75,7 +75,7 @@ Exit status 2 initial value of 'path' is empty USAGE - exit 1 + exit 0 # A clean exit } # Report error and exit @@ -86,7 +86,7 @@ die() echo "Error encountered:" while [ "$#" -ge 1 ]; do echo " $1"; shift; done echo - echo "See 'foamCleanPath -help' for usage" + echo "See '${0##*/} -help' for usage" echo exit 1 } @@ -95,41 +95,44 @@ die() # Input and outputs unset dirList shellOutput +unset optDebug optEnvName optStrip optVerbose # Parse options -unset optDebug optEnvName optStrip optVerbose while [ "$#" -gt 0 ] do case "$1" in -h | -help*) - usage + printHelp + ;; + + -env=*) + optEnvName="${1#*=}" + [ -n "$optEnvName" ] || die "Option '$1' missing an ENVNAME" ;; + -csh=* | -sh=* | -csh-env=* | -sh-env=*) name="${1#*=}" [ -n "$name" ] || die "Option '$1' missing an ENVNAME" - # Output prefix + # For (-csh-env | -sh-env) also use name for input evaluation case "$1" in - -csh*) - shellOutput="setenv $name " # eg, "setenv PATH xyz" - ;; - *) - shellOutput="$name=" # eg, "PATH=xyz" + *-env=*) + optEnvName="$name" + name="$optEnvName" ;; esac - # For (-csh-env | -sh-env) also use name for input evaluation + # Shell-specific output prefix ("setenv ENVNAME xyz" or "ENVNAME=xyz") case "$1" in - *-env=*) - optEnvName="$name" + -csh*) + shellOutput="setenv $name " + ;; + *) + shellOutput="$name=" ;; esac ;; - -env=*) - name="${1#*=}" - [ -n "$name" ] || die "Option '$1' missing an ENVNAME" - optEnvName="$name" - ;; + -debug) optDebug=true ;; diff --git a/bin/foamInstallationTest b/bin/foamInstallationTest index ce688b3ba2228482ae203a381b1f5018769b8554..9dede18ebb545c9d4bf5af8c0db6a1abfc5a3b48 100755 --- a/bin/foamInstallationTest +++ b/bin/foamInstallationTest @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2015 OpenFOAM Foundation -# Copyright (C) 2019 OpenCFD Ltd. +# Copyright (C) 2019-2020 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -354,13 +354,13 @@ checkHostName() checkOS() { case "$OSTYPE" in - Linux | LinuxAMD64 | SunOS ) + Linux* | Darwin* | SunOS ) echo "$(fixlen OS: $WIDTH) $OSTYPE version $(uname -r)" ;; *) echo "FATAL ERROR: Incompatible operating system \"$OSTYPE\"." echo " OpenFOAM ${FWM_PROJECT_VERSION} is currently " - echo " available for Linux and SunOS only." + echo " available for Linux, Darwin and SunOS only." echo fatalError="x${fatalError}" ;; diff --git a/bin/foamSystemCheck b/bin/foamSystemCheck index 2669bad9ebe28cbc22f58d2546be3a4d285ef125..b2d4e57ede33c1dc44645dbd45817a18d811bca8 100755 --- a/bin/foamSystemCheck +++ b/bin/foamSystemCheck @@ -7,6 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------- # Copyright (C) 2011 OpenFOAM Foundation +# Copyright (C) 2020 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -114,13 +115,13 @@ fi # check os OSTYPE=$(uname -s) case "$OSTYPE" in -Linux | LinuxAMD64 | SunOS ) +Linux* | Darwin* | SunOS ) echo "$(fixlen OS: $WIDTH) $OSTYPE version $(uname -r)" ;; *) echo "ERROR: Incompatible operating system \"$OSTYPE\"." echo " OpenFOAM $WM_PROJECT_VERSION is currently available for " - echo " Linux, LinuxAMD64 and SunOS only." + echo " Linux, Darwin and SunOS only." echo fatalError=true ;; diff --git a/bin/tools/change-sitedir.sh b/bin/tools/change-sitedir.sh index ec79ac0e5804dae275d527d65aeb0afeb9184011..ad3d31e2d0b0870db184dd17ba7006075c923bb6 100644 --- a/bin/tools/change-sitedir.sh +++ b/bin/tools/change-sitedir.sh @@ -5,23 +5,10 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# 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 # . change-sitedir.sh PREFIX [SUFFIX] @@ -59,7 +46,7 @@ then foamOldDirs="$FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN \ $WM_PROJECT_SITE $WM_PROJECT_DIR/site" - foamClean=$WM_PROJECT_DIR/bin/foamCleanPath + foamClean="$WM_PROJECT_DIR/bin/foamCleanPath" if [ -x "$foamClean" ] then cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned" diff --git a/bin/tools/change-userdir.sh b/bin/tools/change-userdir.sh index 16b584e2127023c5d2db07c66b07cadf166b5770..bb0dc25dd11a19446119f4af0bd4db4520b7133f 100644 --- a/bin/tools/change-userdir.sh +++ b/bin/tools/change-userdir.sh @@ -5,23 +5,10 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2017 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 # . change-userdir.sh PREFIX [SUFFIX] @@ -59,7 +46,7 @@ then suffix="$2" foamOldDirs="$FOAM_USER_APPBIN $FOAM_USER_LIBBIN" - foamClean=$WM_PROJECT_DIR/bin/foamCleanPath + foamClean="$WM_PROJECT_DIR/bin/foamCleanPath" if [ -x "$foamClean" ] then cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned" diff --git a/bin/tools/foamAllHC b/bin/tools/foamAllHC deleted file mode 100755 index 96b7c2e046cbfcabe5fbc185377e2a34cdb2c16c..0000000000000000000000000000000000000000 --- a/bin/tools/foamAllHC +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | -# \\ / A nd | www.openfoam.com -# \\/ M anipulation | -#------------------------------------------------------------------------------- -# Copyright (C) 2011 OpenFOAM Foundation -#------------------------------------------------------------------------------ -# 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/>. -# -# Script -# foamAllHC -# -# Description -# execute operation $1 on all C,H,L files -# -#------------------------------------------------------------------------------ - -if [ "$#" -gt 0 ] -then - find . -name "*.[CHL]" -type f -exec $1 {} \; -print -fi - -#------------------------------------------------------------------------------ diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index f2d400ab2ff2df0fa0eb8edd21a0ee23debd4dda..12ea3d36bcb412bd8daeb033466eaff6388c3816 100755 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -29,18 +29,49 @@ # #------------------------------------------------------------------------------ printHelp() { - cat<<USAGE + + case "$1" in + (*compat*) + cat<<HELP_COMPAT +Obsolete options: + -foamInstall DIR [obsolete] + -projectName NAME [obsolete] + -sigfpe|-no-sigfpe [obsolete - now under etc/controlDict] + -archOption 32|64 [obsolete setting of 'WM_ARCH_OPTION' - edit manually] + +Equivalent options: + -version -foamVersion --projectVersion + -archOption --archOption + -third -ThirdParty + -paraview --paraviewVersion | -paraviewVersion + -paraview-path --paraviewInstall | -paraviewInstall + -scotch --scotchVersion | -scotchVersion + -scotch-path --scotchArchPath | -scotchArchPath + -system-compiler -system + -third-compiler -third + +HELP_COMPAT + exit 0 # A clean exit + ;; + esac + + cat<<HELP_HEAD usage: $0 options +Options + -h | -help Display short help and exit + -help-compat Display compatibility options and exit + -help-full Display full help and exit + 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) -dp | -DP | -float64 double precision (WM_PRECISION_OPTION) - -spdp | -SPDP mixed single/double precision - -int32 | -int64 the 'WM_LABEL_SIZE' + -spdp | -SPDP mixed precision (WM_PRECISION_OPTION) + -int32 | -int64 label-size (WM_LABEL_SIZE) Compiler -system-compiler NAME The 'system' compiler to use (eg, Gcc, Clang, Icc,...) @@ -57,16 +88,21 @@ MPI -openmpi-system use system openmpi -openmpi-third use ThirdParty openmpi (using default version) -ThirdParty versions +Components versions (ThirdParty) -adios VER specify 'adios2_version' -boost VER specify 'boost_version' - -cgal ver specify 'cgal_version' + -cgal VER specify 'cgal_version' -cmake VER specify 'cmake_version' -fftw VER specify 'fffw_version' -kahip VER specify 'KAHIP_VERSION' - -metis ver specify 'METIS_VERSION' + -metis VER specify 'METIS_VERSION' -scotch VER specify 'SCOTCH_VERSION' (eg, scotch_6.0.4) +HELP_HEAD + + case "$1" in + (*full*) + cat<<HELP_FULL 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) @@ -80,32 +116,24 @@ Graphics -paraview VER specify 'ParaView_VERSION' (eg, 5.4.1 or system) -paraview-qt VER specify 'ParaView_QT' (eg, qt-system) -paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.4.1) - -vtk VER specify 'vtk_version' (eg, VTK-7.1.0) + -llvm VER specify 'mesa_llvm' -mesa VER specify 'mesa_version' (eg, mesa-13.0.1) + -vtk VER specify 'vtk_version' (eg, VTK-7.1.0) + -llvm-path DIR Path for 'LLVM_ARCH_PATH' (overrides -llvm) + -mesa-path DIR Path for 'MESA_ARCH_PATH' (overrides -mesa) + -vtk-path DIR Path for 'VTK_DIR' (overrides -vtk) -Misc - -foamInstall DIR [obsolete] - -projectName NAME [obsolete] - -sigfpe|-no-sigfpe [obsolete - now under etc/controlDict] - -archOption 32|64 [obsolete setting of 'WM_ARCH_OPTION' - edit manually] - +HELP_FULL + ;; + esac -Adjusts hardcoded versions and installation paths (POSIX and C-shell). + cat<<HELP_TAIL_COMMON +Adjusts hardcoded versions and installation paths (POSIX and C-shell) +for OpenFOAM. +HELP_TAIL_COMMON -Equivalent options: - -version -foamVersion --projectVersion - -archOption --archOption - -third -ThirdParty - -paraview --paraviewVersion | -paraviewVersion - -paraview-path --paraviewInstall | -paraviewInstall - -scotch --scotchVersion | -scotchVersion - -scotch-path --scotchArchPath | -scotchArchPath - -system-compiler -system - -third-compiler -third - -USAGE - exit 0 # clean exit + exit 0 # A clean exit } @@ -123,11 +151,12 @@ die() } # ----------------------------------------------------------------------------- +projectDir="$(\pwd -L)" # Project dir # Check that it appears to be an OpenFOAM installation if [ -f etc/bashrc ] && [ -d "META-INFO" ] then - echo "Configuring OpenFOAM" 1>&2 + echo "Configuring OpenFOAM ($projectDir)" 1>&2 else die "Please run from the OpenFOAM top-level installation directory" \ "No etc/bashrc or META-INFO/ found" @@ -172,18 +201,22 @@ _inlineSed() local replacement="$3" local msg="$4" local cmd='/^[^#]/s@'"$regexp"'@'"$replacement"'@' + local localFile [ -f "$file" ] || { echo "Missing file: $file" exit 2 # Fatal } + # Local filename (for reporting) + localFile="$(echo "$file" | sed -e "s#^$projectDir/##")" + grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file" || { \ - echo "Failed: ${msg:-replacement} in $file" + echo "Failed: ${msg:-replacement} in $localFile" return 1 } - [ -n "$msg" ] && echo " $msg ($file)" + [ -n "$msg" ] && echo " $msg ($localFile)" return 0 } @@ -209,7 +242,7 @@ replace() "$file" \ "$key=.*" \ "$key=$val" \ - "Replaced $key setting by '$val'" + "Replaced $key by '$val'" done } @@ -232,9 +265,9 @@ replaceCsh() _inlineSed \ "$file" \ - "setenv *$key [^ #]*" \ + "setenv [ ]*$key [^ #]*" \ "setenv $key $val" \ - "Replaced $key setenv by '$val'" + "Replaced $key by '$val'" done } @@ -323,7 +356,13 @@ unset adjusted optMpi while [ "$#" -gt 0 ] do case "$1" in - -h | -help* | --help*) + -help-c*) # Compat help + printHelp -compat + ;; + -help-f*) # Full help + printHelp -full + ;; + -h | -help*) # Short help printHelp ;; '') @@ -516,12 +555,12 @@ CONFIG_CSH _inlineSed $(_foamEtc config.sh/mpi) \ "FOAM_MPI=$expected" \ "FOAM_MPI=$optMpi" \ - "Replaced 'FOAM_MPI=$expected' setting by 'FOAM_MPI=$optMpi'" + "Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optMpi'" _inlineSed $(_foamEtc config.csh/mpi) \ "FOAM_MPI $expected" \ "FOAM_MPI $optMpi" \ - "Replaced 'FOAM_MPI $expected' setting by 'FOAM_MPI $optMpi'" + "Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optMpi'" replaceEtc bashrc WM_MPLIB OPENMPI replaceEtcCsh cshrc WM_MPLIB OPENMPI @@ -711,11 +750,11 @@ CONFIG_CSH shift ;; - -vtk) - # Replace vtk_version=... + -llvm) + # Replace mesa_llvm=... optionValue=$(getOptionValue "$@") - replaceEtc config.sh/vtk vtk_version "$optionValue" - replaceEtc config.csh/vtk vtk_version "$optionValue" + replaceEtc config.sh/vtk mesa_llvm "$optionValue" + replaceEtc config.csh/vtk mesa_llvm "$optionValue" adjusted=true shift ;; @@ -729,6 +768,42 @@ CONFIG_CSH shift ;; + -vtk) + # Replace vtk_version=... + optionValue=$(getOptionValue "$@") + replaceEtc config.sh/vtk vtk_version "$optionValue" + replaceEtc config.csh/vtk vtk_version "$optionValue" + adjusted=true + shift + ;; + + -llvm-path) + # Replace LLVM_ARCH_PATH=... + optionValue=$(getOptionValue "$@") + replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optionValue\"" + replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optionValue\"" + adjusted=true + shift + ;; + + -mesa-path) + # Replace MESA_ARCH_PATH... + optionValue=$(getOptionValue "$@") + replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optionValue\"" + replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optionValue\"" + adjusted=true + shift + ;; + + -vtk-path) + # Replace VTK_DIR... + optionValue=$(getOptionValue "$@") + replaceEtc config.sh/vtk VTK_DIR \""$optionValue\"" + replaceEtcCsh config.csh/vtk VTK_DIR \""$optionValue\"" + adjusted=true + shift + ;; + ## Misc ## diff --git a/bin/tools/foamCreateModuleInclude b/bin/tools/foamCreateModuleInclude index 7a955740575367048a3d47ce9a6eb64b439059a3..9fe28d98b900a17a48c492565ab44849694d900d 100755 --- a/bin/tools/foamCreateModuleInclude +++ b/bin/tools/foamCreateModuleInclude @@ -241,7 +241,7 @@ $MESA_ARCH_PATH $LLVM_ARCH_PATH \ $MPI_ARCH_PATH $SCOTCH_ARCH_PATH \ $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN $WM_PROJECT_SITE \ $FOAM_USER_APPBIN $FOAM_USER_LIBBIN" -foamClean=$WM_PROJECT_DIR/bin/foamCleanPath +foamClean="$WM_PROJECT_DIR/bin/foamCleanPath" if [ -x "$foamClean" ] then diff --git a/bin/tools/foamExec b/bin/tools/foamExec index 723ade68173cdd51e7ab5ca283b743be3ca46ad2..2e730980406db85534a1995087701880bb7a9356 100755 --- a/bin/tools/foamExec +++ b/bin/tools/foamExec @@ -6,23 +6,10 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2019 OpenCFD Ltd. +# Copyright (C) 2019-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 # foamExec <application> ... @@ -31,17 +18,20 @@ # Runs an application (with arguments) after first sourcing the OpenFOAM # etc/bashrc file from the project directory # -# This script must exist in $WM_PROJECT_DIR/bin/tools -# # Can useful for parallel runs. For example, # # mpirun -n <nProcs> \ # projectDir/bin/tools/foamExec <simpleFoam> ... -parallel # +# Note +# This script normally exists in the project 'bin/tools' directory. +# Do not copy/move/link to other locations unless you also edit it! +# #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +toolsDir="${0%/*}" # The bin/tools dir +projectDir="${toolsDir%/bin/tools}" # Project dir + +printHelp() { cat<<USAGE Usage: ${0##*/} [OPTION] <application> ... @@ -49,11 +39,12 @@ Usage: ${0##*/} [OPTION] <application> ... options: -help Print the usage -Runs an application (with arguments) after first sourcing the OpenFOAM -etc/bashrc file from the project directory +Run an application (with arguments) after first sourcing +the OpenFOAM etc/bashrc file from the project directory: +($projectDir) USAGE - exit 1 + exit 0 # A clean exit } # Report error and exit @@ -70,15 +61,13 @@ die() } #------------------------------------------------------------------------------- -toolsDir="${0%/*}" # The bin/tools dir -projectDir="${toolsDir%/bin/tools}" # Project dir # Parse options while [ "$#" -gt 0 ] do case "$1" in -h | -help*) - usage + printHelp ;; --) shift @@ -116,6 +105,7 @@ sourceBashrc() . "$projectDir/etc/bashrc" $FOAM_SETTINGS } + sourceBashrc exec "$@" diff --git a/bin/tools/help-filter b/bin/tools/help-filter new file mode 100755 index 0000000000000000000000000000000000000000..f9991129d7f129f1c80b599640bed0229079bb02 --- /dev/null +++ b/bin/tools/help-filter @@ -0,0 +1,36 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | www.openfoam.com +# \\/ M anipulation | +#------------------------------------------------------------------------------- +# Copyright (C) 2020 OpenCFD Ltd. +#------------------------------------------------------------------------------ +# License +# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. +# +# Script +# help-filter +# +# Description +# Feed with output from -help-full. +# +# For example, +# blockMesh -help-full | ./help-filter +# +#------------------------------------------------------------------------------ + +sed -ne '1,/^[Oo]ptions:/d' \ + -e '/^ \{8\}/d;' \ + -e 's/^ *//; /^$/d; /^[^-]/d; /^--/d; /^-help-man/d;' \ + -e '/^-hostRoots /d; /^-roots /d;' \ + -e '/^-lib /d;' \ + -e '/^-[a-z]*-switch /d;' \ + -e 'y/,/ /; s/=.*$/=/;' \ + -e '/^-[^ ]* </{ s/^\(-[^ ]* <\).*$/\1/; p; d }' \ + -e 's/^\(-[^ ]*\).*$/\1/; p; /^-help-full/q;' \ +- + +#------------------------------------------------------------------------------ diff --git a/bin/tools/lib-dir b/bin/tools/lib-dir index 12651b22b6b9a2f48a19a8e6f6d7dd7a80269681..f423411fa3bc1e9c8dd207b00c01679c98bb2630 100755 --- a/bin/tools/lib-dir +++ b/bin/tools/lib-dir @@ -22,8 +22,14 @@ # 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 +# output -make: -Ldir/lib +# +# Note +# LD_LIBRARY_PATH automatically changes to DYLD_LIBRARY_PATH for Darwin. +# +# Environment +# WM_COMPILER_LIB_ARCH # #------------------------------------------------------------------------------ printHelp() { @@ -34,9 +40,9 @@ Usage: ${0##*/} [OPTION] DIR [LIBEXT] options: -sh Emit POSIX shell syntax (default) -csh Emit C-shell shell syntax - -sh-verbose As per -sh, with additional verbosity - -csh-verbose As per -csh, with additional verbosity - -make Emit content for a makefile + -sh-verbose Like -sh, with additional verbosity + -csh-verbose Like -csh, with additional verbosity + -make Emit content for a Makefile -help Print the usage Resolves for the existence of DIR/lib64 and DIR/lib, or uses the fallback @@ -139,10 +145,10 @@ then # Fallback case "$alt" in /*) - resolved=$alt + resolved="$alt" ;; (*) - resolved=$dir/$alt + resolved="$dir/$alt" ;; esac exit 0 @@ -177,6 +183,7 @@ then fi ;; *) + # Default is -sh echo "LD_LIBRARY_PATH=$resolved:$LD_LIBRARY_PATH" if [ -n "$verboseOutput" ] then diff --git a/bin/tools/scanpackages b/bin/tools/scanpackages deleted file mode 100755 index ed30adb6778e65747443f731f76cd63beeee2607..0000000000000000000000000000000000000000 --- a/bin/tools/scanpackages +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# Generate Packages file on debian repositories. - -for D in `find . -mindepth 4 -type d` -do - dpkg-scanpackages $D | gzip -9c > ${D}/Packages.gz -done