diff --git a/Allclean b/Allclean index b87214f..16ab978 100755 --- a/Allclean +++ b/Allclean @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -28,94 +28,173 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { echo " Check your OpenFOAM environment and installation" exit 1 } -# . etc/tools/ThirdPartyFunctions +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printHelp() { cat<&2 ;; + esac + shift +done #------------------------------------------------------------------------------ +[ -n "$optCleanType" ] || die "No clean operation specified" -# Clean various packages via 'distclean' -for i in \ - openmpi-* metis-* adios-* ADIOS-* gperftools-* qt-* \ - gmp-* mpfr-* mpc-* gcc-* llvm-* \ -; -do - if [ -d "$i" ] - then - ( - echo - echo "${i%/*}" - echo " make distclean" - echo - cd $i && make distclean +# sources +case "$optCleanType" in (*full* | *source*) + + # Clean various packages via 'distclean' + for dir in \ + $(etc/list-available -dirs \ + gcc \ + gmp \ + gperftools \ + llvm \ + metis \ + mpc \ + mpfr \ + openmpi \ + qt \ ) - fi -done + do + if [ -n "$optDryRun" ] + then + echo "$dir : ${optDryRun}make distclean" + elif [ -d "$dir" ] + then + ( + cd "$dir" 2>/dev/null || exit + echo + echo "$dir : make distclean" + echo + make distclean || true + ) + fi + done + # Clean scotch (src) with 'realclean' + for dir in $(etc/list-available -dirs scotch) + do + dir="$dir/src" # Within the src directory! -# Clean various packages via 'realclean' -for i in scotch*/src -do - if [ -d "$i" ] + if [ -n "$optDryRun" ] + then + echo "$dir : ${optDryRun}make realclean" + elif [ -d "$dir" ] + then + ( + cd "$dir" 2>/dev/null || exit + echo + echo "$dir : make realclean" + echo + make realclean || true + ) + fi + done + + # Clean various packages via 'wclean' + for dir in $(etc/list-available -dirs ccmio libccmio) + do + if [ -n "$optDryRun" ] + then + echo "$dir : ${optDryRun}wclean" + elif [ -f "$dir/Make/files" ] + then + ( + cd "$dir" 2>/dev/null || exit + echo + echo "${dir}: wclean" + echo + wclean || true + ) + fi + done + + # Clean various packages via 'wclean' + for dir in $(etc/list-available -dirs kahip) + do + dir="$dir/lib" + if [ -n "$optDryRun" ] + then + echo "$dir : ${optDryRun}wclean" + elif [ -f "$dir/Make/files" ] + then + ( + cd "$dir" 2>/dev/null || exit + echo + echo "${dir}: wclean" + echo + wclean || true + ) + fi + done +esac + +# ----------------------------------------------------------------------------- + +# build +case "$optCleanType" in (*full* | *build*) + # Clean out-of-source build directories + if [ -d build ] then - ( echo - echo "${i%/*}" - echo " make realclean" - echo - cd $i && make realclean - ) + echo "${optDryRun}Remove build/ directory contents" + [ -z "$optDryRun" ] && rm -rf build/* fi -done +esac -# Clean various packages via 'wclean' -for i in libccmio*/Make kahip*/lib/Make -do - if [ -d "$i" ] - then - ( - echo - echo "${i%/Make}" - echo " wclean" - echo - cd ${i%/Make} && wclean - ) - fi -done - - -# Clean out-of-source build directories -if [ -d build ] -then - echo - echo "Clean build/ directory" - rm -rf build/* -fi - # ----------------------------------------------------------------------------- # @@ -127,42 +206,28 @@ removePlatform() if [ -n "$platform" ] && [ -d "platforms/$platform" ] then echo - echo "Cleaning platform '$platform'" - rm -rf "platforms/$platform" + echo "${optDryRun}Cleaning platform '$platform'" + [ -z "$optDryRun" ] && "platforms/$platform" else echo - echo "Platform '$platform' not built" + echo "${optDryRun}Platform '$platform' not built" fi } -if [ "$#" -ge 1 ] -then - echo - echo "Clean platforms/sub-directories" -fi -# Optionally cleanup platforms specified from the arguments -while [ "$#" -ge 1 ] -do - case "$1" in - -all) - echo - echo "Removing all platforms/sub-directories" - echo - rm -rf platforms/* - break - ;; +# ----------------------------------------------------------------------------- - -current) - echo "Current platform '$WM_OPTIONS'" - removePlatform "$WM_OPTIONS" - ;; +# current platform +case "$optCleanType" in (*full* | *current*) + echo "${optDryRun}Remove current platform: '$WM_OPTIONS'" + removePlatform "$WM_OPTIONS" +esac - *) - removePlatform "$1" - ;; - esac - shift -done + +# named platform +case "$optCleanType" in (*platform*) + echo "${optDryRun}Remove platform: '$optPlatformName'" + removePlatform "$optPlatformName" +esac #------------------------------------------------------------------------------ diff --git a/Allwmake b/Allwmake index 4a07b97..71557d5 100755 --- a/Allwmake +++ b/Allwmake @@ -28,7 +28,7 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { echo " Check your OpenFOAM environment and installation" exit 1 } -. etc/tools/ThirdPartyFunctions +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ exportCompiler true # Compiler info + flags for CMake/configure exportLinker # Linker flags for CMake/configure diff --git a/Environ.md b/Environ.md new file mode 100644 index 0000000..7297f3e --- /dev/null +++ b/Environ.md @@ -0,0 +1,77 @@ +## OpenFOAM® ThirdParty Environment Variables + +When using these scripts for building third-party libraries +various environment variables are required or expected. + +### Mandatory + +- **WM_THIRD_PARTY_DIR** : Location of third-party library sources etc +- **WM_PROJECT_DIR** : The OpenFOAM project directory.
+ Used for `wmake` information, config files, etc +- **WM_ARCH** : The target architecture (eg, Linux64) +- **WM_OSTYPE** : The operating system type (eg, POSIX, MSwindows)
+ Used as fallback for determining the ending for dynamic libraries. + Used for Windows-specific handling in scotch builds. +- **WM_COMPILER** : The compiler name (eg, Gcc, Clang) +- **WM_COMPILER_LIB_ARCH** : The target library ending (eg, 64).
+ Typically used as `lib$WM_COMPILER_LIB_ARCH` to generate the name + `lib64`, for example. +- **WM_LABEL_SIZE** : The OpenFOAM size for `label` (eg, 32 for int32) +- **WM_PRECISION_OPTION** : The OpenFOAM representation for `scalar` + (eg, DP for double-precision) +- **FOAM_EXT_LIBBIN** : Common _pool_ for the library targets. + + +### MPI-related + +- **FOAM_MPI** : The OpenFOAM MPI sub-directory name (eg, sys-openmpi) +- **WM_MPLIB** : The canonical OpenFOAM MPI name (eg, SYSTEMOPENMPI) +- **MPI_ARCH_PATH** : Location of the current MPI implementation. + Used for additional linkage, but primarily to set MPI_ROOT + for a cmake hint. + + +### Other + +- **WM_CONTINUE_ON_ERROR** : Ignore build errors. + Mostly set internally from `wmake -k`. +- **WM_NCOMPPROCS** : The number of build processes to launch. + Often set internally from `wmake -j`. +- **WM_COMPILER_TYPE** : Used internally for a few build scripts. + Has values of `system` or `ThirdParty`. + + +## Output + +Similar to OpenFOAM itself, the build and final output are separated +into different directories that contain a non-colliding hierarchy of +target names. However, in contrast to the OpenFOAM target names, +there are several different types of output targets: + +- *ARCH* : (eg, `linux64`)
+ Base infrastructure such as compiler and base libraries. +- *ARCH+COMPILER* : (eg, `linux64Gcc`)
+ Compiler-specific libraries and applications. +- *ARCH+COMPILER+SIZING* : (eg, `linux64GccDPInt32`)
+ Libraries and applications specific to a particular combination + of OpenFOAM scalar/label sizes. This is the same as the + ***WM_OPTIONS*** value. + +By default, the locations of the build and final targets are hard-coded +relative to the WM_THIRD_PARTY_DIR: + +- WM_THIRD_PARTY_DIR/build/ : intermediate build artifacts +- WM_THIRD_PARTY_DIR/platforms/ : installation root + +The expert user or sys-admin can influence these locations with the +following environment variables + +- **FOAM_THIRD_PARTY_BUILDROOT** : + Replaces WM_THIRD_PARTY_DIR as the root for build/ and platforms/.
+ ***!! The specified build-root directory must exist !!*** + +- **FOAM_THIRD_PARTY_SOURCES** : + Provide alternative location to WM_THIRD_PARTY_DIR/sources + for finding source bundles.
+ +--- diff --git a/etc/makeFiles/libccmio/files b/etc/makeFiles/libccmio/files index 57e04e3..42a95e6 100644 --- a/etc/makeFiles/libccmio/files +++ b/etc/makeFiles/libccmio/files @@ -1,4 +1,6 @@ -/* NOTE: make any changes to this file in etc/makeFiles/ */ +/* + * NOTE: make any changes to this file in ThirdParty etc/makeFiles/ +*/ libadf/ADF_interface.c libadf/ADF_internals.c @@ -19,4 +21,4 @@ libccmio/ccmioversion.c libcgns/cgnslib.c */ -LIB = $(FOAM_EXT_LIBBIN)/libccmio +LIB = $(CCMIO_LIB_DIR)/libccmio diff --git a/etc/makeFiles/libccmio/options b/etc/makeFiles/libccmio/options index de0cfc0..761a3ea 100644 --- a/etc/makeFiles/libccmio/options +++ b/etc/makeFiles/libccmio/options @@ -1,5 +1,10 @@ -/* NOTE: make any changes to this file in etc/makeFiles/ */ +/* NOTE: make any changes to this file in ThirdParty etc/wmakeFiles/ */ EXE_INC = -I. LIB_LIBS = PROJECT_LIBS = + +/* failsafe location */ +ifeq (,$(strip $(CCMIO_LIB_DIR))) +CCMIO_LIB_DIR = $(FOAM_EXT_LIBBIN) +endif diff --git a/etc/tools/ThirdPartyFunctions b/etc/tools/ThirdPartyFunctions index 843f8fb..8a1908b 100644 --- a/etc/tools/ThirdPartyFunctions +++ b/etc/tools/ThirdPartyFunctions @@ -38,6 +38,85 @@ installBASE="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER" # Synthetic value combining precision and label size (Eg, DPInt32) WM_SIZE_OPTIONS="${WM_PRECISION_OPTION}Int${WM_LABEL_SIZE}" +#------------------------------------------------------------------------------ +# Make adjustments for non-standard build locations + +# Specified a build-root +if [ -n "$FOAM_THIRD_PARTY_BUILDROOT" ] +then + if [ ! -d "$FOAM_THIRD_PARTY_BUILDROOT" ] + then + dir="$(dirname "$FOAM_THIRD_PARTY_BUILDROOT")" + if [ -d "$dir" ] && [ -w "$dir" ] + then + mkdir -m 0755 -p "$FOAM_THIRD_PARTY_BUILDROOT" + fi + # Also checks for failure of previous mkdir + if [ ! -d "$FOAM_THIRD_PARTY_BUILDROOT" ] + then + echo "Build-root: $FOAM_THIRD_PARTY_BUILDROOT" 1>&2 + echo "Has invalid parent: $dir" 1>&2 + exit 2 + fi + fi + echo "Using build-root: $FOAM_THIRD_PARTY_BUILDROOT" 1>&2 + + # build/ + _buildDir="${FOAM_THIRD_PARTY_BUILDROOT}/build" + mkdir -m 0755 -p "$_buildDir" + + # Fully resolved + dir="$(cd "$_buildDir" 2>/dev/null && pwd -L)" + if [ -n "$dir" ] + then + buildBASE="$dir/$WM_ARCH$WM_COMPILER" + echo "Using build-dir: $dir" 1>&2 + else + echo "Invalid build-dir: $_buildDir" 1>&2 + exit 2 + fi + + # platforms/ + _platformsDir="${FOAM_THIRD_PARTY_BUILDROOT}/platforms" + mkdir -m 0755 -p "$_platformsDir" + + # Fully resolved + dir="$(cd "$_platformsDir" 2>/dev/null && pwd -L)" + if [ -n "$dir" ] + then + installBASE="$dir/$WM_ARCH$WM_COMPILER" + echo "Using platforms-dir: $dir" 1>&2 + else + echo "Invalid platforms-dir: $_platformsDir" 1>&2 + exit 2 + fi + + # Installation with non-standard platforms location + nonStandardPlatforms() { true; } +else + # Installation with standard platforms location + nonStandardPlatforms() { false; } +fi + + +# sources/ +if [ -n "$FOAM_THIRD_PARTY_SOURCES" ] +then + # Fully resolved + dir="$(cd "$FOAM_THIRD_PARTY_SOURCES" 2>/dev/null && pwd -L)" + if [ -n "$dir" ] + then + sourceBASE="$dir" + echo "Using sources-dir: $dir" 1>&2 + else + echo "Invalid sources-dir: $FOAM_THIRD_PARTY_SOURCES" 1>&2 + exit 2 + fi +fi + + +#------------------------------------------------------------------------------ + # Dynamic library ending (default is .so) EXT_SO="$(wmake -show-ext-so 2>/dev/null)" if [ -z "$EXT_SO" ] @@ -53,6 +132,13 @@ then esac fi +# True if OS is . +# Test EXT_SO for ".dylib" - avoid repeated uname system call +isDarwin() +{ + [ "$EXT_SO" = .dylib ] +} + # Fallback values, needed for our scotch Makefile which uses # WM_CFLAGS and WM_LDFLAGS for arch information @@ -68,6 +154,7 @@ fi unset BUILD_SUFFIX + #------------------------------------------------------------------------------ # Check for existence of shared library (without .so extension) # @@ -237,15 +324,29 @@ useGccFlag() # Final fallback is whichCC() { + local fallback='gcc' local comp="$CC" + local warn if [ -z "$comp" ] then comp="$(wmake -show-c 2>/dev/null)" || comp="$WM_CC" - test -n "$comp" && command -v "$comp" >/dev/null || unset comp + if [ -n "$comp" ] + then + if ! command -v "$comp" >/dev/null + then + warn="C compiler '$comp' not found in path." + unset comp + fi + else + warn="No C compiler found via wmake." + fi + if [ -n "$warn" ] + then + echo "${warn} Defaulting to '${fallback}'" 1>&2 + fi fi - - echo "${comp:-gcc}" + echo "${comp:-$fallback}" } @@ -254,15 +355,29 @@ whichCC() # Final fallback is whichCXX() { + local fallback='g++' local comp="$CXX" + local warn if [ -z "$comp" ] then comp="$(wmake -show-cxx 2>/dev/null)" || comp="$WM_CXX" - test -n "$comp" && command -v "$comp" >/dev/null || unset comp + if [ -n "$comp" ] + then + if ! command -v "$comp" >/dev/null + then + warn="CXX compiler '$comp' not found in path." + unset comp + fi + else + warn="No CXX compiler found via wmake." + fi + if [ -n "$warn" ] + then + echo "${warn} Defaulting to '${fallback}'" 1>&2 + fi fi - - echo "${comp:-g++}" + echo "${comp:-$fallback}" } @@ -275,7 +390,8 @@ whichCXX() # NOTE: could further refine based on "wmake -show-c", but not yet needed whichMpicc() { - local comp="$(command -v mpicc)" + local fallback='mpicc' + local comp="$(command -v $fallback)" case "$WM_MPLIB" in (FJMPI) comp="$(command -v mpifcc)" # Fujitsu available? @@ -287,7 +403,7 @@ whichMpicc() : "${comp:=cc}" # Cray if there is no ;; esac - echo "${comp:-mpicc}" + echo "${comp:-$fallback}" } @@ -300,7 +416,8 @@ whichMpicc() # NOTE: could further refine based on "wmake -show-cxx", but not yet needed whichMpicxx() { - local comp="$(command -v mpicxx)" + local fallback='mpicxx' + local comp="$(command -v $fallback)" case "$WM_MPLIB" in (FJMPI) comp="$(command -v mpiFCC)" # Fujitsu available? @@ -309,10 +426,10 @@ whichMpicxx() comp="$(command -v mpiicpc)" # Intel available? ;; (CRAY-MPI*) - : "${comp:=CC}" # Cray if there is no + : "${comp:=CC}" # Cray if there is no ;; esac - echo "${comp:-mpicxx}" + echo "${comp:-$fallback}" } # Require wmkdepend etc when building with wmake @@ -426,6 +543,7 @@ findSourceDir() for check in \ "$package" \ + "$subdir/$package" \ "sources/$package" \ "sources/$subdir/$package" \ ; @@ -501,7 +619,7 @@ listPackageVersions() [ -n "$package" ] || continue - for dir in . sources sources/"$package" + for dir in . ./"$package" sources sources/"$package" do # Find package-version (ie, when it has separators) find "$dir" -maxdepth 1 \ diff --git a/makeAdios2 b/makeAdios2 index 0c25f0d..496f655 100755 --- a/makeAdios2 +++ b/makeAdios2 @@ -5,7 +5,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2018-2020 OpenCFD Ltd. +# Copyright (C) 2018-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -49,19 +49,21 @@ then exit 2 fi #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ -# ADIOS2 version from OpenFOAM etc/config.sh file: +# Obtain version from OpenFOAM etc/config.sh file: _foamConfig adios2 -adiosPACKAGE=${adios2_version:-adios-none} +PACKAGE="${adios2_version:-none}" # Hint for cmake findMPI if [ -d "$MPI_ARCH_PATH" ] @@ -70,25 +72,25 @@ then fi #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions adios; exit 0; } +printHelp() { cat</dev/null - mkdir -p $buildDIR + rm -rf "$PKG_PREFIX" + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" # May not work properly with FOAM_MPI = dummy if [ "$FOAM_MPI" != dummy ] @@ -203,19 +206,20 @@ else cmake=$(findCMake) - # Install into lib64/ - cd $buildDIR && $cmake \ - -DCMAKE_INSTALL_PREFIX=$ADIOS2_ARCH_PATH \ + # Installs into lib64/ + cd "$PKG_BUILD" && set -x && \ + ${cmake:?} \ + -DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \ -DCMAKE_BUILD_TYPE=Release \ -DADIOS2_USE_Fortran=FALSE \ -DADIOS2_BUILD_EXAMPLES=FALSE \ ${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \ - $ADIOS2_SOURCE_DIR \ + "$PKG_SOURCE" \ && make -j $WM_NCOMPPROCS all \ && make install \ - && echo "Built: $adiosPACKAGE" + && echo "Built: $PACKAGE" ) || { - echo "Error building: $adiosPACKAGE" + echo "Error building: $PACKAGE" exit 1 } fi diff --git a/makeCCMIO b/makeCCMIO index a3a2744..9e20c30 100755 --- a/makeCCMIO +++ b/makeCCMIO @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -21,49 +21,51 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ # libccmio version from OpenFOAM etc/config.sh file: _foamConfig ccmio -ccmioPACKAGE=${ccmio_version:-libccmio-2.6.1} +PACKAGE="${ccmio_version:-libccmio-2.6.1}" targetType=lib # Default is static linkage #------------------------------------------------------------------------------ -usage() -{ - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done - /bin/cat</dev/null - # Place static libraries in sub-directory: - if [ "$targetType" = lib ] + # Static libraries in sub-directory + export CCMIO_LIB_DIR="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" + + # Dynamic libraries directly into FOAM_EXT_LIBBIN + if [ "$targetType" = libso ] then - mkdir -m 0755 -p $libdir 2>/dev/null - export FOAM_EXT_LIBBIN=$libdir + CCMIO_LIB_DIR="$FOAM_EXT_LIBBIN" fi + mkdir -m 0755 -p "$CCMIO_LIB_DIR" 2>/dev/null wmake -j $WM_NCOMPPROCS -s $targetType \ - && echo "Built: ccmio" \ + && echo "Built: $PACKAGE" \ && install ) || { - echo "Error building: ccmio" + echo "Error building: $PACKAGE" exit 1 } diff --git a/makeCGAL b/makeCGAL index 6b46f91..0653ba2 100755 --- a/makeCGAL +++ b/makeCGAL @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2012-2016 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -60,34 +60,41 @@ then fi fi #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ unset BOOST_ARCH_PATH CGAL_ARCH_PATH GMP_ARCH_PATH MPFR_ARCH_PATH # Purge old +unset GMP_DIR MPFR_DIR # Purge hints used by CGAL cmake # CGAL, boost and gmp/mpfr versions from OpenFOAM etc/config.sh files. # Get compiler first and let CGAL config override GMP and MPFR _foamConfig compiler _foamConfig CGAL -boostPACKAGE=${boost_version:-boost-system} -gmpPACKAGE=${gmp_version:-gmp-system} -mpfrPACKAGE=${mpfr_version:-mpfr-system} -cgalPACKAGE=$cgal_version +BOOST_PACKAGE="${boost_version:-boost-system}" +GMP_PACKAGE="${gmp_version:-gmp-system}" +MPFR_PACKAGE="${mpfr_version:-mpfr-system}" +CGAL_PACKAGE="$cgal_version" + +if nonStandardPlatforms # Possibly unreliable inherited values +then + unset BOOST_ARCH_PATH CGAL_ARCH_PATH +fi #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions boost cgal; exit 0; } +printHelp() { cat</dev/null && pwd -P) + if BOOST_PREFIX=$(cd "$BOOST_PREFIX" 2>/dev/null && pwd -P) then - boostPACKAGE="${BOOST_ARCH_PATH##*/}" + BOOST_PACKAGE="$(basename "$BOOST_PREFIX")" else - echo "ERROR: bad path for BOOST_ARCH_PATH" + echo "ERROR: bad path for BOOST_PREFIX" echo "stopping build" exit 1 fi - libdir="$BOOST_ARCH_PATH/lib" + libdir="$BOOST_PREFIX/lib" else boostInc="/usr/include" boostLib="/usr/lib$WM_COMPILER_LIB_ARCH" @@ -252,22 +272,23 @@ then elif [ -z "$optForce" ] \ && [ -f "$boostInc/boost/version.hpp" ] then - echo "Using $boostPACKAGE" + echo "Using $BOOST_PACKAGE" - libdir="$BOOST_ARCH_PATH/lib" + libdir="$BOOST_PREFIX/lib" # Use lib when lib64 does not exist [ -d "$libdir" -a ! -d "$boostLib" ] && boostLib="$libdir" else - echo "Starting build: $boostPACKAGE" + echo "Starting build: $BOOST_PACKAGE" echo # Absolute path for --libdir ( # Write user-config.jam into source directory - cd "$BOOST_SOURCE_DIR" || exit - export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo + # this is not great, but project-config.jam is written there too + cd "$BOOST_SOURCE" || exit + export GIT_DIR="$PWD/.git" # Avoid seeing our own git-repo # Configuration options: unset buildOpt @@ -314,25 +335,26 @@ else # End of configuration options # ---------------------------- - rm -rf "$BOOST_ARCH_PATH" + rm -rf "$BOOST_PREFIX" ./bootstrap.sh \ - --prefix="$BOOST_ARCH_PATH" \ + --prefix="$BOOST_PREFIX" \ --libdir="$boostLib" \ --with-libraries=thread \ --with-libraries=system \ --with-toolset="$optToolset" \ && ./b2 $buildOpt -j $WM_NCOMPPROCS install \ - && echo "Built: boost" + && echo "Built: $BOOST_PACKAGE" ) || { - echo "Error building: boost" + echo "Error building: $BOOST_PACKAGE" exit 1 } + fi # Nothing left to build -if _foamIsSystem "$cgalPACKAGE" +if _foamIsSystem "$CGAL_PACKAGE" then echo "Using cgal-system (skip ThirdParty build of CGAL)" exit 0 @@ -360,23 +382,28 @@ fi # - use Third-Party 'lib64' for consistency. # CGAL-4.9 normally builds into 'lib64', older versions into 'lib'. # -# CGAL_SOURCE_DIR : location of the original sources -# CGAL_BUILD_DIR : location of the build -# CGAL_ARCH_PATH : installation directory +# *PACKAGE : name-version of the package +# *SOURCE : location of original sources +# *PREFIX : installation directory +# CGAL_ARCH_PATH : installation directory (as per config file) + +CGAL_SOURCE="$(findSourceDir "$CGAL_PACKAGE")" +CGAL_PACKAGE="$(basename "$CGAL_PACKAGE")" +CGAL_PREFIX="$installBASE$WM_SIZE_OPTIONS/$CGAL_PACKAGE" + +# Override as per config file (if any) +[ -n "$CGAL_ARCH_PATH" ] && CGAL_PREFIX="$CGAL_ARCH_PATH" -CGAL_SOURCE_DIR="$sourceBASE/$cgalPACKAGE" -CGAL_BUILD_DIR="$buildBASE/$cgalPACKAGE" -: "${CGAL_ARCH_PATH:=$installBASE/$cgalPACKAGE}" # gmp/mpfr are installed without compiler name -mpfrBASE="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH" +archBASE="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH" # Enable/disable gmp/mpfr together -if _foamIsNone "$gmpPACKAGE" || _foamIsNone "$mpfrPACKAGE" +if _foamIsNone "$GMP_PACKAGE" || _foamIsNone "$MPFR_PACKAGE" then GMP_ARCH_PATH=none MPFR_ARCH_PATH=none -elif _foamIsSystem "$gmpPACKAGE" || _foamIsSystem "$mpfrPACKAGE" +elif _foamIsSystem "$GMP_PACKAGE" || _foamIsSystem "$MPFR_PACKAGE" then # May really be system, but could also by a central installation # Ensure everything is accurately recorded. Resolve paths etc. @@ -385,7 +412,7 @@ then then if GMP_ARCH_PATH=$(cd "$GMP_ARCH_PATH" 2>/dev/null && pwd -P) then - gmpPACKAGE="${GMP_ARCH_PATH##*/}" + GMP_PACKAGE="${GMP_ARCH_PATH##*/}" else echo "ERROR: bad path for GMP_ARCH_PATH" echo "stopping build" @@ -399,7 +426,7 @@ then then if MPFR_ARCH_PATH=$(cd "$MPFR_ARCH_PATH" 2>/dev/null && pwd -P) then - mpfrPACKAGE="${MPFR_ARCH_PATH##*/}" + MPFR_PACKAGE="${MPFR_ARCH_PATH##*/}" else echo "ERROR: bad path for MPFR_ARCH_PATH" echo "stopping build" @@ -409,8 +436,10 @@ then MPFR_ARCH_PATH=system fi else - GMP_ARCH_PATH="$mpfrBASE/$gmpPACKAGE" - MPFR_ARCH_PATH="$mpfrBASE/$mpfrPACKAGE" + + # Respect the *ARCH_PATH if set + [ -d "$GMP_ARCH_PATH" ] || GMP_ARCH_PATH="$archBASE/$GMP_PACKAGE" + [ -d "$MPFR_ARCH_PATH" ] || MPFR_ARCH_PATH="$archBASE/$MPFR_PACKAGE" fi #------------------------------------------------------------------------------ @@ -418,27 +447,27 @@ fi cat</dev/null) + CGAL_VERSION=$(sed -ne 's/^ *# *define *CGAL_VERSION_NR *\([0-9][0-9]*\).*$/\1/p' $CGAL_PREFIX/include/CGAL/version.h 2>/dev/null) - cat< $buildInfoFile + cat< "$buildInfoFile" # Information from OpenFOAM build on '$(date)' # -CGAL=${CGAL_ARCH_PATH##*/} -BOOST=${BOOST_ARCH_PATH##*/} +CGAL=${CGAL_PREFIX##*/} +BOOST=${BOOST_PREFIX##*/} GMP=${GMP_ARCH_PATH##*/} MPFR=${MPFR_ARCH_PATH##*/} CGAL_VERSION=$CGAL_VERSION @@ -477,10 +506,10 @@ cgalIsCurrent() local libDirName="lib$WM_COMPILER_LIB_ARCH" echo "checking information from existing build ..." - echo " ${CGAL_ARCH_PATH}" + echo " ${CGAL_PREFIX}" - infoValueEq CGAL "${CGAL_ARCH_PATH##*/}" "$info" || return 1 - infoValueEq BOOST "${BOOST_ARCH_PATH##*/}" "$info" || return 1 + infoValueEq CGAL "${CGAL_PREFIX##*/}" "$info" || return 1 + infoValueEq BOOST "${BOOST_PREFIX##*/}" "$info" || return 1 infoValueEq GMP "${GMP_ARCH_PATH##*/}" "$info" || return 1 infoValueEq MPFR "${MPFR_ARCH_PATH##*/}" "$info" || return 1 infoValueEq BOOST_VERSION "${BOOST_VERSION}" "$info" || return 1 @@ -494,48 +523,44 @@ cgalIsCurrent() if [ -z "$optForce" ] \ && cgalIsCurrent then - echo " ${CGAL_ARCH_PATH##*/} build appears to be up-to-date - skipping" + echo " ${CGAL_PREFIX##*/} build appears to be up-to-date - skipping" echo exit 0 else ( - # Remove any existing build folder and recreate - if [ -d "$CGAL_BUILD_DIR" ] - then - echo "removing old build directory" - echo " $CGAL_BUILD_DIR" - rm -rf "$CGAL_BUILD_DIR" - fi - mkdir -p "$CGAL_BUILD_DIR" + export GIT_DIR="$CGAL_SOURCE/.git" + PKG_BUILD="$buildBASE/$CGAL_PACKAGE" - cd "$CGAL_BUILD_DIR" || exit - export GIT_DIR="$CGAL_SOURCE_DIR/.git" # Mask seeing our own git-repo + # Remove existing build + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" + cd "$PKG_BUILD" || exit unset configBoost configGmp configMpfr echo "----" - echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION" - echo " Source : $CGAL_SOURCE_DIR" - echo " Build : $CGAL_BUILD_DIR" - echo " Target : $CGAL_ARCH_PATH" + echo "Configuring $CGAL_PACKAGE with boost $BOOST_VERSION" + echo " Source : $CGAL_SOURCE" + echo " Build : $CGAL_BUILD" + echo " Target : $CGAL_PREFIX" # See http://doc.cgal.org/latest/Manual/installation.html - if _foamIsSystem "$boostPACKAGE" + if _foamIsSystem "$BOOST_PACKAGE" then # Tagged as 'system' but could actually point to a central location - if [ -d "$BOOST_ARCH_PATH/include" ] + if [ -d "$BOOST_PREFIX/include" ] then - echo " boost : ${BOOST_ARCH_PATH##*/}" - configBoost="-DBOOST_ROOT=$BOOST_ARCH_PATH" + echo " boost : ${BOOST_PREFIX##*/}" + configBoost="-DBOOST_ROOT=$BOOST_PREFIX" else echo " boost : system" fi ## For system - possible that /usr/lib64 not being found? ## configBoost="-DBoost_LIBRARY_DIRS=$boostLib" - elif [ -d "$BOOST_ARCH_PATH" ] + elif [ -d "$BOOST_PREFIX" ] then - echo " boost : $boostPACKAGE" + echo " boost : $BOOST_PACKAGE" configBoost=$(cat <> $CGAL_ARCH_PATH/share/files + \cp "$CGAL_SOURCE/src/CGAL/$i" "$CGAL_PREFIX"/share/src/ + echo "\${CGAL_PREFIX}/share/src/$i" >> "$CGAL_PREFIX"/share/files fi done + # Record our build-status recordCGALinfo diff --git a/makeCmake b/makeCmake index a998eaf..968dacb 100755 --- a/makeCmake +++ b/makeCmake @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -24,38 +24,40 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ -# Special purpose script - no default version. -unset cmakePACKAGE +# Special purpose script - no default version +unset PACKAGE #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions cmake; exit 0; } +printHelp() { cat</dev/null || true - cd "$CMAKE_SOURCE_DIR" || exit - export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo - make distclean 2>/dev/null + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" - rm -rf $buildDIR - mkdir -p $buildDIR - cd $buildDIR - - $CMAKE_SOURCE_DIR/bootstrap \ - --prefix=$CMAKE_ARCH_PATH \ + cd "$PKG_BUILD" && \ + "$PKG_SOURCE"/bootstrap \ + --prefix="$PKG_PREFIX" \ && time make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $cmakePACKAGE" + && echo "Built: $PACKAGE" ) || { - echo "Error building: $cmakePACKAGE" + echo "Error building: $PACKAGE" exit 1 } fi -if [ "$optLink" = true ] && [ -x "$CMAKE_ARCH_PATH/bin/cmake" ] +if [ "$optLink" = true ] && [ -x "$PKG_PREFIX/bin/cmake" ] then ( - cd "${CMAKE_ARCH_PATH%/*}" || exit + cd "${PKG_PREFIX%/*}" || exit if [ -L cmake-system ] then rm cmake-system @@ -138,7 +147,7 @@ then then exit 2 fi - ln -svf "$cmakePACKAGE" cmake-system + ln -svf "$PACKAGE" cmake-system ) fi diff --git a/makeFFTW b/makeFFTW index 2650403..6579c39 100755 --- a/makeFFTW +++ b/makeFFTW @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -47,39 +47,40 @@ then exit 2 fi #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ - -# FFTW version from OpenFOAM etc/config.sh file: +# Obtain version from OpenFOAM etc/config.sh file: _foamConfig FFTW -fftwPACKAGE="${fftw_version:-fftw-system}" +PACKAGE="${fftw_version:-none}" #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions fftw; exit 0; } +printHelp() { cat</dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ unset GMP_ARCH_PATH MPFR_ARCH_PATH # Purge old @@ -50,18 +52,17 @@ WM_COMPILER_TYPE=ThirdParty # Ensure we get the correct settings # Default GCC, mpfr, gmp and mpc versions from OpenFOAM etc/config.sh file: _foamConfig compiler -gmpPACKAGE=${gmp_version:-gmp-system} -mpfrPACKAGE=${mpfr_version:-mpfr-system} -mpcPACKAGE=${mpc_version:-mpc-system} -gccPACKAGE=$gcc_version +GMP_PACKAGE="${gmp_version:-gmp-system}" +MPFR_PACKAGE="${mpfr_version:-mpfr-system}" +MPC_PACKAGE="${mpc_version:-mpc-system}" +GCC_PACKAGE="$gcc_version" #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions gcc gmp mpfr mpc; exit 0; } +printHelp() { cat< to LD_LIBRARY_PATH, if it exists. 0 on success, 1 on failure addLib() { if [ -d "$1" ] then - export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH + export LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH" return 0 else return 1 @@ -186,47 +218,47 @@ addLib() # Build GMP # ================ echo "---------------" -if [ -d "$GMP_ARCH_PATH" ] +if [ -d "$GMP_PREFIX" ] then - echo "Already built: $gmpPACKAGE" -elif _foamIsSystem $GMP_ARCH_PATH + echo "Already built: $GMP_PREFIX" +elif _foamIsSystem "$GMP_PREFIX" then - echo "Using gmp-system" + echo "Using system gmp" else - echo "Starting build: $gmpPACKAGE" + echo "Starting build: $GMP_PACKAGE" echo ( - sourceDIR=$sourceBASE/$gmpPACKAGE - buildDIR=$buildBASE/$gmpPACKAGE + PKG_SOURCE="$GMP_SOURCE" + PKG_PREFIX="$GMP_PREFIX" + PKG_BUILD="$buildBASE/$GMP_PACKAGE" + export GIT_DIR="$PKG_SOURCE/.git" - cd "$sourceDIR" || exit - export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo - make distclean 2>/dev/null + cd "$PKG_SOURCE" || exit + make distclean 2>/dev/null || true - rm -rf $buildDIR - mkdir -p $buildDIR - cd $buildDIR + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" - set -x - $sourceDIR/configure ABI=$optArch \ - --prefix=$GMP_ARCH_PATH \ - --libdir=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure ABI="$optArch" \ + --prefix="$PKG_PREFIX" \ + --libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" \ --enable-cxx \ && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $gmpPACKAGE" + && echo "Built: $GMP_PACKAGE" ) || { - echo "Error building: $gmpPACKAGE" + echo "Error building: $GMP_PACKAGE" exit 1 } fi -if addLib "$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" +if addLib "$GMP_PREFIX/lib$WM_COMPILER_LIB_ARCH" then configGMP=$(cat </dev/null + cd "$PKG_SOURCE" || exit + make distclean 2>/dev/null || true - rm -rf $buildDIR - mkdir -p $buildDIR - cd $buildDIR + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" unset configOpt # explicitly enable/disable thread-safe [ -n "$optThreadSafe" ] && configOpt="--${optThreadSafe}-thread-safe" - set -x - $sourceDIR/configure ABI=$optArch \ - --prefix=$MPFR_ARCH_PATH \ - --libdir=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure ABI="$optArch" \ + --prefix="$PKG_PREFIX" \ + --libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" \ $configGMP $configOpt \ && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $mpfrPACKAGE" + && echo "Built: $MPFR_PACKAGE" ) || { - echo "Error building: $mpfrPACKAGE" + echo "Error building: $MPFR_PACKAGE" exit 1 } fi -if addLib "$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" +if addLib "$MPFR_PREFIX/lib$WM_COMPILER_LIB_ARCH" then configMPFR=$(cat </dev/null + cd "$PKG_SOURCE" || exit + make distclean 2>/dev/null || true - rm -rf $buildDIR - mkdir -p $buildDIR - cd $buildDIR + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" - set -x - $sourceDIR/configure ABI=$optArch \ - --prefix=$MPC_ARCH_PATH \ - --libdir=$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure ABI="$optArch" \ + --prefix="$PKG_PREFIX" \ + --libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" \ $configGMP $configMPFR \ && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $mpcPACKAGE" + && echo "Built: $MPC_PACKAGE" ) || { - echo "Error building: $mpcPACKAGE" + echo "Error building: $MPC_PACKAGE" exit 1 } fi -if addLib "$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" +if addLib "$MPC_PREFIX/lib$WM_COMPILER_LIB_ARCH" then configMPC=$(cat </dev/null + cd "$PKG_SOURCE" || exit + make distclean 2>/dev/null || true - rm -rf $buildDIR - mkdir -p $buildDIR - cd $buildDIR + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" unset configOpt # with/without multi-lib (32-bit support on 64-bit systems) [ -n "$optMultilib" ] && configOpt="--${optMultilib}-multilib" - set -x - $sourceDIR/configure \ - --prefix=$GCC_ARCH_PATH \ - --with-pkgversion=OpenFOAM \ + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure \ + --prefix="$PKG_PREFIX" \ + --with-pkgversion=www.openfoam.com \ --enable-languages=c,c++ \ --enable-__cxa_atexit \ --enable-libstdcxx-allocator=new \ @@ -388,9 +420,9 @@ else && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $gccPACKAGE" + && echo "Built: $GCC_PACKAGE" ) || { - echo "Error building: $gccPACKAGE" + echo "Error building: $GCC_PACKAGE" exit 1 } fi diff --git a/makeGperftools b/makeGperftools index 0e71df6..680d905 100755 --- a/makeGperftools +++ b/makeGperftools @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2012 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -21,52 +21,59 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ - -# Gperftools version from OpenFOAM etc/config.sh file: +# Obtain version from OpenFOAM etc/config.sh file: _foamConfig gperftools -gperftoolsPACKAGE=${gperftools_version:-gperftools-system} +PACKAGE="${gperftools_version:-none}" #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions gperf; exit 0; } +printHelp() { cat</dev/null + make distclean 2>/dev/null || true - rm -rf $GPERFTOOLS_ARCH_PATH - rm -rf $buildDIR - mkdir -p $buildDIR - cd $buildDIR + rm -rf "$PKG_PREFIX" + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" - set -x - $GPERFTOOLS_SOURCE_DIR/configure \ - --prefix=$GPERFTOOLS_ARCH_PATH \ + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure \ + --prefix="$PKG_PREFIX" \ && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $gperftoolsPACKAGE" \ + && echo "Built: $PACKAGE" \ ) || { - echo "Error building: $gperftoolsPACKAGE" + echo "Error building: $PACKAGE" exit 1 } + fi #------------------------------------------------------------------------------ diff --git a/makeHYPRE b/makeHYPRE index bb65e63..71e8003 100755 --- a/makeHYPRE +++ b/makeHYPRE @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2018-2020 OpenCFD Ltd. +# Copyright (C) 2018-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -20,39 +20,46 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ - -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ +# Obtain version from etc/config.sh file: _foamConfig hypre -hyprePACKAGE="${hypre_version:-hypre-system}" +PACKAGE="${hypre_version:-none}" targetType=libso +if nonStandardPlatforms # Possibly unreliable inherited values +then + unset HYPRE_ARCH_PATH +fi + #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions hypre; exit 0; } +printHelp() { cat</dev/null + rm -rf "$PKG_PREFIX" + make distclean 2>/dev/null || true + set -x && \ ./configure \ - --prefix="$HYPRE_ARCH_PATH" \ + --prefix="$PKG_PREFIX" \ --disable-fortran \ --enable-shared \ $configOpt \ && make -j $WM_NCOMPPROCS \ && echo "Built: hypre" \ && make install \ - && echo "Installed: hypre" + && echo "Installed: $PACKAGE" ) || { - echo "Error building: hypre" + echo "Error building: $PACKAGE" exit 1 } - #------------------------------------------------------------------------------ diff --git a/makeKAHIP b/makeKAHIP index fbe8d55..b7b945f 100755 --- a/makeKAHIP +++ b/makeKAHIP @@ -50,13 +50,15 @@ then exit 2 fi #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ # Obtain version from OpenFOAM etc/config.sh file: @@ -71,6 +73,11 @@ then export MPI_HOME="$MPI_ARCH_PATH" fi +if nonStandardPlatforms # Possibly unreliable inherited values +then + unset KAHIP_ARCH_PATH +fi + #------------------------------------------------------------------------------ printVersions() { listPackageVersions kahip; exit 0; } printHelp() { @@ -134,6 +141,7 @@ do targetType="$1" ;; + kahip/* | sources/kahip* | sources/KaHIP* |\ kahip-[0-9]* | kahip-git | KaHIP_* | KaHIP-[0-9]*) PACKAGE="${1%%/}" unset KAHIP_ARCH_PATH # Avoid inconsistency @@ -184,7 +192,7 @@ fi # *SOURCE : location of original sources # *PREFIX : installation directory -PKG_SOURCE="$sourceBASE/$PACKAGE" +PKG_SOURCE="$(findSourceDir "$PACKAGE")" PACKAGE="$(basename "$PACKAGE")" # Future: PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE" PKG_PREFIX="$installBASE/$PACKAGE" @@ -395,7 +403,6 @@ install_wmake() return 0 } - if [ "${useWmakeWorkaround:-false}" = false ] then ( @@ -418,13 +425,15 @@ then cmake=$(findCMake) - cd "$PKG_BUILD" && $cmake \ + cd "$PKG_BUILD" && set -x && \ + ${cmake:?} \ -B "$PKG_BUILD" \ -S "$PKG_SOURCE" \ -DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \ -DCMAKE_BUILD_TYPE=Release \ $buildOpt \ ${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \ + && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ && install \ @@ -458,7 +467,7 @@ then && echo "Built: $PACKAGE" \ && install_wmake ) || { - echo "Error building: kahip" + echo "Error building: $PACKAGE" exit 1 } fi diff --git a/makeLLVM b/makeLLVM index cd474a6..6359ea2 100755 --- a/makeLLVM +++ b/makeLLVM @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -39,14 +39,16 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ [ "${WM_COMPILER#Clang}" = "$WM_COMPILER" ] && WM_COMPILER=Clang # Force clang @@ -55,26 +57,26 @@ WM_COMPILER_TYPE=ThirdParty # Ensure we get the correct settings # LLVM/Clang version from OpenFOAM etc/config.sh file: _foamConfig compiler -llvmPACKAGE=$clang_version +PACKAGE="$clang_version" #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions llvm; exit 0; } +printHelp() { cat</dev/null 2>&1 + echo "Already built: $PACKAGE" +elif [ -z "$CMAKE_PATH" ] && "$PKG_SOURCE"/configure -help >/dev/null 2>&1 then # configure can be used prior to 3.9.0 # but use cmake if someone explicitly mentioned -cmake on the command-line - echo "Starting build: $llvmPACKAGE (using configure)" + echo "Starting build: $PACKAGE (using configure)" echo ( - cd "$LLVM_SOURCE_DIR" || exit - export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo - make distclean 2>/dev/null + PKG_BUILD="$buildBASE/$PACKAGE" + cd "$PKG_SOURCE" || exit + make distclean 2>/dev/null || true - rm -rf $LLVM_BUILD_DIR - mkdir -p $LLVM_BUILD_DIR - cd $LLVM_BUILD_DIR + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" - set -x - $LLVM_SOURCE_DIR/configure \ - --prefix=$LLVM_ARCH_PATH \ + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure \ + --prefix="$PKG_PREFIX" \ --with-gcc-toolchain="$(command -v gcc | sed 's%/bin/gcc%%')" \ --enable-optimized \ --enable-shared \ && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $llvmPACKAGE" + && echo "Built: $PACKAGE" ) || { - echo "Error building: $llvmPACKAGE" + echo "Error building: $PACKAGE" exit 1 } else # CMake used with 3.9.0 and later - echo "Starting build: $llvmPACKAGE (using cmake)" + echo "Starting build: $PACKAGE (using cmake)" echo ( + PKG_BUILD="$buildBASE/$PACKAGE" + cd "$PKG_SOURCE" || exit + # Configuration options: unset configOpt - - cd "$LLVM_SOURCE_DIR" || exit - export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo - if [ -f tools/openmp/CMakeLists.txt ] then configOpt="$configOpt -DLLVM_TOOL_OPENMP_BUILD=ON" fi - rm -rf $LLVM_BUILD_DIR - mkdir -p $LLVM_BUILD_DIR - cd $LLVM_BUILD_DIR + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" cmake=$(findCMake) - set -x - $cmake \ - -DCMAKE_INSTALL_PREFIX=$LLVM_ARCH_PATH \ + cd "$PKG_BUILD" && set -x && \ + ${cmake:?} \ + -DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=ON \ $configOpt \ - $LLVM_SOURCE_DIR \ + "$PKG_SOURCE" \ && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $llvmPACKAGE" + && echo "Built: $PACKAGE" ) || { - echo "Error building: $llvmPACKAGE" + echo "Error building: $PACKAGE" exit 1 } diff --git a/makeMETIS b/makeMETIS index 4059578..33bf9d0 100755 --- a/makeMETIS +++ b/makeMETIS @@ -50,13 +50,15 @@ then exit 2 fi #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ # Obtain version from OpenFOAM etc/config.sh file: @@ -65,6 +67,11 @@ _foamConfig metis PACKAGE="${METIS_VERSION:-system}" targetType=libso +if nonStandardPlatforms # Possibly unreliable inherited values +then + unset METIS_ARCH_PATH +fi + #------------------------------------------------------------------------------ printVersions() { listPackageVersions metis; exit 0; } printHelp() { @@ -114,6 +121,7 @@ do targetType="$1" ;; + metis/* | sources/metis* | \ metis-[0-9]*) PACKAGE="${1%%/}" unset METIS_ARCH_PATH # Avoid inconsistency @@ -161,7 +169,7 @@ fi # *SOURCE : location of original sources # *PREFIX : installation directory -PKG_SOURCE="$sourceBASE/$PACKAGE" +PKG_SOURCE="$(findSourceDir "$PACKAGE")" PACKAGE="$(basename "$PACKAGE")" PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE" export GIT_DIR="$PKG_SOURCE/.git" diff --git a/makeMGridGen b/makeMGridGen index 6121669..e024260 100755 --- a/makeMGridGen +++ b/makeMGridGen @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2017-2020 OpenCFD Ltd. +# Copyright (C) 2017-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -20,40 +20,40 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Run from ThirdParty directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { - echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR" - echo " The environment variables are inconsistent with the installation." - echo " Check the OpenFOAM entries in your dot-files and source them." - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ - -# mgridgen version from OpenFOAM etc/config.sh file: +# Obtain version from OpenFOAM etc/config.sh file: _foamConfig mgridgen -mgridgenPACKAGE=${MGRIDGEN_VERSION:-mgridgen-none} +PACKAGE="${MGRIDGEN_VERSION:-none}" #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions mgridgen parmgridgen; exit 0; } +printHelp() { cat</dev/null # Remove any existing build folder and recreate - rm -rf $MGRIDGEN_ARCH_PATH + rm -rf "$PKG_PREFIX" serial="$(whichCC)" # CC (serial compiler) default=gcc # parallel=$(whichMpicc) # PARCC (parallel compiler) default=mpicc @@ -169,9 +170,9 @@ else make=make \ serial \ && install \ - && echo "Built: $mgridgenPACKAGE" + && echo "Built: $PACKAGE" ) || { - echo "Error building: $mgridgenPACKAGE" + echo "Error building: $PACKAGE" exit 1 } fi diff --git a/makeMPICH b/makeMPICH index 47da3ea..14cf130 100755 --- a/makeMPICH +++ b/makeMPICH @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2017-2020 OpenCFD Ltd. +# Copyright (C) 2017-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -48,46 +48,45 @@ then exit 2 fi #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions # Transition -# ~~~~~~~~~~ _foamAddLib() { true; } _foamAddMan() { true; } _foamAddPath() { true; } #------------------------------------------------------------------------------ - -WM_MPLIB=MPICH # Ensure we get the correct MPI - -# mpich version from OpenFOAM etc/config.sh file: +# Obtain version from OpenFOAM etc/config.sh file: +WM_MPLIB=MPICH # Ensure we get the correct MPI _foamConfig mpi -mpiPACKAGE=${FOAM_MPI:-mpich-system} +PACKAGE="${FOAM_MPI:-system}" #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions mpich; exit 0; } +printHelp() { cat</dev/null + cd "$PKG_SOURCE" || exit + make distclean 2>/dev/null || true - rm -rf $MPI_ARCH_PATH - rm -rf $buildDIR - mkdir -p $buildDIR - cd $buildDIR + rm -rf "$PKG_PREFIX" + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" - set -x - $MPI_SOURCE_DIR/configure \ - --prefix=$MPI_ARCH_PATH \ + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure \ + --prefix="$PKG_PREFIX" \ + --libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" \ --disable-fortran --disable-g \ - --libdir=$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --enable-shared --disable-static \ $configOpt \ && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $mpiPACKAGE" \ - && pkgconfigAdjust $MPI_ARCH_PATH + && echo "Built: $PACKAGE" \ + && pkgconfigAdjust "$PKG_PREFIX" ) || { - echo "Error building: $mpiPACKAGE" + echo "Error building: $PACKAGE" exit 1 } + fi #------------------------------------------------------------------------------ diff --git a/makeMVAPICH b/makeMVAPICH index 4490179..31512c2 100755 --- a/makeMVAPICH +++ b/makeMVAPICH @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2019-2020 OpenCFD Ltd. +# Copyright (C) 2019-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -48,50 +48,49 @@ then exit 2 fi #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions # Transition -# ~~~~~~~~~~ _foamAddLib() { true; } _foamAddMan() { true; } _foamAddPath() { true; } #------------------------------------------------------------------------------ - -WM_MPLIB=MV2MPI # Ensure we get the correct MPI - -# mvapich2 version from OpenFOAM etc/config.sh file: +# Obtain version from OpenFOAM etc/config.sh file: +WM_MPLIB=MV2MPI # Ensure we get the correct MPI _foamConfig mpi -mpiPACKAGE=${FOAM_MPI:-mvapich2-system} +PACKAGE="${FOAM_MPI:-system}" #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions mvapich; exit 0; } +printHelp() { cat</dev/null + cd "$PKG_SOURCE" || exit + make distclean 2>/dev/null || true - rm -rf $MPI_ARCH_PATH - rm -rf $buildDIR - mkdir -p $buildDIR - cd $buildDIR + rm -rf "$PKG_PREFIX" + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" - set -x - $MPI_SOURCE_DIR/configure \ - --prefix=$MPI_ARCH_PATH \ + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure \ + --prefix="$PKG_PREFIX" \ + --libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" \ --disable-fortran --disable-g \ - --libdir=$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --enable-shared --disable-static \ $configOpt \ && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $mpiPACKAGE" \ - && pkgconfigAdjust $MPI_ARCH_PATH + && echo "Built: $PACKAGE" \ + && pkgconfigAdjust "$PKG_PREFIX" ) || { - echo "Error building: $mpiPACKAGE" + echo "Error building: $PACKAGE" exit 1 } fi diff --git a/makeMesa b/makeMesa index d60909b..3e85398 100755 --- a/makeMesa +++ b/makeMesa @@ -15,7 +15,7 @@ # makeMesa # # Description -# Build script for Mesa +# Build script for MESA # # Note # Building with mesa-12.x.x fails to create an include/GL directory and @@ -34,41 +34,41 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ - -unset vtk_version mesa_version mesa_llvm # Purge current values - -# mesa version from OpenFOAM etc/config.sh file: +# Obtain version from OpenFOAM etc/config.sh file: +unset vtk_version mesa_version mesa_llvm # Purge current values _foamConfig vtk -mesaPACKAGE=$mesa_version +PACKAGE="$mesa_version" #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions mesa; exit 0; } +printHelp() { cat< may mask the header adjustMESA() { - pkgconfigAdjust "$MESA_ARCH_PATH" + pkgconfigAdjust "$PKG_PREFIX" - \rm -rf "$MESA_ARCH_PATH"/include/GLES "$MESA_ARCH_PATH"/include/GLES1 + rm -rf "$PKG_PREFIX"/include/GLES "$PKG_PREFIX"/include/GLES1 echo "removed all gles1 includes" } # Old MESA with autoconfig -if [ -e "$MESA_SOURCE_DIR"/configure ] +if [ -e "$PKG_SOURCE"/configure ] then ( # Configuration options: @@ -230,21 +232,14 @@ then # End of configuration options # ---------------------------- - buildDIR="$buildBASE/$mesaPACKAGE" + PKG_BUILD="$buildBASE/$PACKAGE" - cd "$MESA_SOURCE_DIR" || exit - export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo - - # Remove any existing build - rm -rf "$MESA_ARCH_PATH" - rm -rf "$buildDIR" - mkdir -p "$buildDIR" - cd "$buildDIR" + cd "$PKG_SOURCE" || exit echo "----" - echo "Building $mesaPACKAGE" - echo " Source : $MESA_SOURCE_DIR" - echo " Target : $MESA_ARCH_PATH" + echo "Building $PACKAGE (with autoconf)" + echo " Source : $PKG_SOURCE" + echo " Target : $PKG_PREFIX" if [ -d "$LLVM_ARCH_PATH" ] then echo " llvm : $LLVM_ARCH_PATH" @@ -258,9 +253,14 @@ then fi ## autoreconf -fi - set -x - $MESA_SOURCE_DIR/configure \ - --prefix="$MESA_ARCH_PATH" \ + + rm -rf "$PKG_PREFIX" + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" + + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure \ + --prefix="$PKG_PREFIX" \ --disable-xvmc \ --disable-glx \ --disable-dri \ @@ -273,14 +273,14 @@ then && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built $mesaPACKAGE" \ + && echo "Built $PACKAGE" \ && adjustMESA ) || { echo "Error building: MESA" exit 1 } -elif [ -e "$MESA_SOURCE_DIR"/meson.build ] +elif [ -e "$PKG_SOURCE"/meson.build ] then ( # Configuration options: @@ -301,21 +301,13 @@ then # End of configuration options # ---------------------------- - buildDIR="$buildBASE/$mesaPACKAGE" - - cd "$MESA_SOURCE_DIR" || exit - export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo - - # Remove any existing build - rm -rf $MESA_ARCH_PATH - rm -rf $buildDIR - mkdir -p $buildDIR - cd $MESA_SOURCE_DIR + PKG_BUILD="$buildBASE/$PACKAGE" + cd "$PKG_SOURCE" || exit echo "----" - echo "Building $mesaPACKAGE" - echo " Source : $MESA_SOURCE_DIR" - echo " Target : $MESA_ARCH_PATH" + echo "Building $PACKAGE (with meson)" + echo " Source : $PKG_SOURCE" + echo " Target : $PKG_PREFIX" if [ -d "$LLVM_ARCH_PATH" ] then echo " llvm : $LLVM_ARCH_PATH" @@ -331,9 +323,13 @@ then # Needs c++14 not c++11 CXXFLAGS="$(echo "$CXXFLAGS" | sed 's/c++11/c++14/')" - set -x - meson "$buildDIR" \ - --prefix="$MESA_ARCH_PATH" \ + rm -rf "$PKG_PREFIX" + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" + + cd "$PKG_SOURCE" && set -x && \ + meson "$PKG_BUILD" \ + --prefix="$PKG_PREFIX" \ -Dplatforms=x11 \ -Dosmesa=gallium \ -Dgallium-drivers=swrast \ @@ -341,9 +337,9 @@ then -Dvulkan-drivers=[] \ $configOpt \ && set +x \ - && ninja -j $WM_NCOMPPROCS -C "$buildDIR" \ - && ninja -C "$buildDIR" install \ - && echo "Built $mesaPACKAGE" \ + && ninja -j $WM_NCOMPPROCS -C "$PKG_BUILD" \ + && ninja -C "$PKG_BUILD" install \ + && echo "Built $PACKAGE" \ && adjustMESA ) || { echo "Error building: MESA" diff --git a/makeOPENMPI b/makeOPENMPI index 568658b..0adca1f 100755 --- a/makeOPENMPI +++ b/makeOPENMPI @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2017-2020 OpenCFD Ltd. +# Copyright (C) 2017-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -48,49 +48,48 @@ then exit 2 fi #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions # Transition -# ~~~~~~~~~~ _foamAddLib() { true; } _foamAddMan() { true; } _foamAddPath() { true; } #------------------------------------------------------------------------------ - -WM_MPLIB=OPENMPI # Ensure we get the correct MPI - -# openmpi version from OpenFOAM etc/config.sh file: +# Obtain version from OpenFOAM etc/config.sh file: +WM_MPLIB=OPENMPI # Ensure we get the correct MPI _foamConfig mpi -mpiPACKAGE=${FOAM_MPI:-openmpi-system} +PACKAGE="${FOAM_MPI:-system}" #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions openmpi; exit 0; } +printHelp() { cat</dev/null + make distclean 2>/dev/null || true - rm -rf $MPI_ARCH_PATH - rm -rf $buildDIR - mkdir -p $buildDIR - cd $buildDIR + rm -rf "$PKG_PREFIX" + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" - set -x - $MPI_SOURCE_DIR/configure \ - --prefix=$MPI_ARCH_PATH \ - --libdir=$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ + cd "$PKG_BUILD" && set -x && \ + "$PKG_SOURCE"/configure \ + --prefix="$PKG_PREFIX" \ + --libdir="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH" \ --disable-orterun-prefix-by-default \ --enable-shared --disable-static \ --enable-mpi-fortran=none \ @@ -210,12 +207,13 @@ else && set +x \ && make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: $mpiPACKAGE" \ - && pkgconfigAdjust $MPI_ARCH_PATH + && echo "Built: $PACKAGE" \ + && pkgconfigAdjust "$PKG_PREFIX" ) || { - echo "Error building: $mpiPACKAGE" + echo "Error building: $PACKAGE" exit 1 } + fi #------------------------------------------------------------------------------ diff --git a/makePETSC b/makePETSC index 4992a88..99370f7 100755 --- a/makePETSC +++ b/makePETSC @@ -20,31 +20,36 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ - -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ _foamConfig petsc -petscPACKAGE="${petsc_version:-petsc-system}" +PETSC_PACKAGE="${petsc_version:-none}" targetType=libso -unset hyprePACKAGE +unset HYPRE_PACKAGE unset HYPRE_ARCH_PATH # Avoid inconsistency +if nonStandardPlatforms # Possibly unreliable inherited values +then + unset PETSC_ARCH_PATH +fi + #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions petsc; exit 0; } +printHelp() { cat</dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions -. etc/tools/ParaViewFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ParaViewFunctions #------------------------------------------------------------------------------ -unset ParaView_VERSION # Purge current values - # ParaView_VERSION from etc/config.sh file: +unset ParaView_VERSION # Purge current values _foamConfig paraview # Avoid any potential conflicts (especially if building from git) @@ -71,13 +72,12 @@ then fi #------------------------------------------------------------------------------ -usage() { - exec 1>&2 +printVersions() { listPackageVersions paraview; exit 0; } +printHelp() { : ${ParaView_VERSION:=none} # some dummy value for usage information - while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat</dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions -. etc/tools/QtFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/QtFunctions #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions qt; exit 0; } +printHelp() { cat</dev/null # Remove any existing build folder and recreate - rm -rf $QT_ARCH_DIR - rm -rf $buildDIR 2>/dev/null - mkdir -p $buildDIR + rm -rf "$PKG_PREFIX" + rm -rf "$PKG_BUILD" + mkdir -p "$PKG_BUILD" # Remove any remnants from a previous shadow build - rm -f "$QT_SOURCE_DIR/.qmake.cache" 2>/dev/null - rm -f "$QT_SOURCE_DIR/src/corelib/global/qconfig.h" 2>/dev/null - rm -f "$QT_SOURCE_DIR/src/corelib/global/qconfig.cpp" 2>/dev/null + rm -f "$PKG_SOURCE"/.qmake.cache + rm -f "$PKG_SOURCE"/src/corelib/global/qconfig.h + rm -f "$PKG_SOURCE"/src/corelib/global/qconfig.cpp - cd "$buildDIR" || exit + cd "$PKG_BUILD" || exit # Compile as opensource, accepting LGPL conditions (yes) - echo yes | $QT_SOURCE_DIR/configure \ - -prefix $QT_ARCH_PATH \ + echo yes | "$PKG_SOURCE"/configure \ + -prefix "$PKG_PREFIX" \ -opensource \ $configOpt \ && time make -j $WM_NCOMPPROCS \ && make install \ - && echo "Built: Qt-$qtVERSION" \ - && finalizeQt + && echo "Built: $PACKAGE" \ + && finalizeQt "$PKG_PREFIX" ) || { - echo "Error building: Qt-$qtVERSION" + echo "Error building: $PACKAGE" exit 1 } fi diff --git a/makeSCOTCH b/makeSCOTCH index b6eaf5d..b2d5e5a 100755 --- a/makeSCOTCH +++ b/makeSCOTCH @@ -20,13 +20,15 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi . "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ _foamConfig scotch # Get SCOTCH_ARCH_PATH, SCOTCH_VERSION @@ -36,6 +38,11 @@ PACKAGE="${SCOTCH_VERSION:-system}" unset withMPI case "$WM_MPLIB" in (*MPI*) [ "$FOAM_MPI" = dummy ] || withMPI=true ;; esac +if nonStandardPlatforms # Possibly unreliable inherited values +then + unset SCOTCH_ARCH_PATH +fi + #------------------------------------------------------------------------------ printVersions() { listPackageVersions scotch; exit 0; } printHelp() { @@ -82,7 +89,8 @@ do -no-mpi) unset withMPI ;; -no-extlib) optNoExtlib=true ;; # Hidden option - scotch-[0-9]* | scotch-git | scotch_* ) + scotch/ | sources/scotch* |\ + scotch-[0-9]* | scotch-v[0-9]* | scotch-git | scotch_* ) PACKAGE="${1%%/}" unset SCOTCH_ARCH_PATH # Avoid inconsistency ;; @@ -118,7 +126,7 @@ fi # *SOURCE : location of original sources # *PREFIX : installation directory -PKG_SOURCE="$sourceBASE/$PACKAGE" +PKG_SOURCE="$(findSourceDir "$PACKAGE")" PACKAGE="$(basename "$PACKAGE")" PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE" export GIT_DIR="$PKG_SOURCE/.git" diff --git a/makeVTK b/makeVTK index a056ef2..55cf191 100755 --- a/makeVTK +++ b/makeVTK @@ -27,21 +27,21 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Run from third-party directory only -cd "${0%/*}" || exit -wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { - echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" - echo " Check your OpenFOAM environment and installation" - exit 1 -} -. etc/tools/ThirdPartyFunctions -. etc/tools/ParaViewFunctions -. etc/tools/vtkFunctions +if : # Run from third-party directory +then + cd "${0%/*}" || exit + wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR" + echo " Check your OpenFOAM environment and installation" + exit 1 + } +fi +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ParaViewFunctions +. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/vtkFunctions #------------------------------------------------------------------------------ - -unset vtk_version mesa_version # Purge current values - -# vtk version from OpenFOAM etc/config.sh file: +# Obtain version from OpenFOAM etc/config.sh file: +unset vtk_version mesa_version # Purge current values _foamConfig vtk VTK_VERSION="$vtk_version" @@ -63,12 +63,11 @@ then fi #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printVersions() { listPackageVersions vtk; exit 0; } +printHelp() { cat< \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/VTK-$VTK_VERSION$BUILD_SUFFIX USAGE - # showDownloadHint VTK - exit 1 + # showDownloadHint vtk + exit 0 # Clean exit } #------------------------------------------------------------------------------ exportCompiler minimal # Minimal compiler info for CMake/configure @@ -124,11 +124,14 @@ while [ "$#" -gt 0 ] do case "$1" in '') ;; # Ignore empty - -h | -help) usage ;; + -h | -help*) printHelp;; + -list) printVersions;; -gcc) useGcc ;; - [0-9]* | vtk-[0-9]* | VTK-[0-9]*) # VTK version - setVtkVersion "${1%%/}" + # VTK version + paraview/* | vtk/* | sources/paraview* | sources/vtk* |\ + [0-9]* | vtk-[0-9]* | VTK-[0-9]*) + setVtkVersion "$(basename "$1")" ;; -D[A-Z]*=* | [A-Z]*=*) # cmake variables addCMakeVariable "$1" diff --git a/minCmake b/minCmake index 196d419..7e48843 100755 --- a/minCmake +++ b/minCmake @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -28,12 +28,10 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { exit 1 } #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printHelp() { cat<&2 + exit 1 ;; *) break @@ -62,22 +59,50 @@ do done # Nothing specified - use first level of unpacked directories -[ "$#" -gt 0 ] || set -- $(find -mindepth 1 -maxdepth 1 -type d) +if [ "$#" -eq 0 ] +then +set -- \ +$( + echo "searching..." 1>&2 + find . -mindepth 2 -maxdepth 2 -name CMakeLists.txt + for dir in sources/* + do + [ -d "$dir" ] || continue + ## echo "search <$dir>" 1>&2 + depth=1 + # Is sources/pkg/pkg-version ? + if [ "$(echo "$dir" | sed -e 's#.*/[a-z][a-z]*##' | wc -w)" = 0 ] + then + depth=2 + fi + find "$dir" -maxdepth "$depth" -name CMakeLists.txt + done +) +fi + +echo "processing..." 1>&2 for dir do dir="${dir#./}" # Remove leading "./" dir="${dir%/}" # Remove trailing "/" + case "$dir" in + (*/CMakeLists.txt) file="$dir" ;; + (*) file="$dir/CMakeLists.txt" ;; + esac + dir="$(dirname "$file")" + dir="$(basename "$dir")" + min=$(sed -n \ -e 's/^.*cmake_minimum.*VERSION *\([0-9.][0-9.]*\).*/\1/p' \ - "$dir/CMakeLists.txt" \ + "$file" \ 2>/dev/null | head -1) if [ -n "$min" ] then # Remove trailing ".0" from version - echo "${min%.0}" "${dir#sources/}" + echo "${min%.0}" "$dir" fi done \