diff --git a/Allclean b/Allclean
index 22792c189b87baa5752c20b41027db6b782a5103..2416e676cde77fdcd30e97f3bafe8f5a57a1e446 100755
--- a/Allclean
+++ b/Allclean
@@ -67,7 +67,7 @@ fi
 #------------------------------------------------------------------------------
 
 # Clean various packages via 'distclean'
-for i in openmpi-* ADIOS-*
+for i in openmpi-* ADIOS-* metis-*
 do
     [ -d "$i" ] && (
         echo
diff --git a/Allwmake b/Allwmake
index 9a8c3819055c9b6d86759059fb9f8551397d9d97..06642ef3e4a8f65363f950315a098b40b6fb9260 100755
--- a/Allwmake
+++ b/Allwmake
@@ -29,7 +29,7 @@
 #     Build script for ThirdParty
 #
 #------------------------------------------------------------------------------
-# run from third-party directory only
+# Run from third-party directory only
 cd ${0%/*} || exit 1
 wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
     echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
@@ -44,14 +44,32 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 }
 . etc/tools/ThirdPartyFunctions
 #------------------------------------------------------------------------------
-
-# export WM settings in a form that GNU configure recognizes
+# Export WM settings in a form that GNU configure recognizes
 [ -n "$WM_CC" ]         &&  export CC="$WM_CC"
 [ -n "$WM_CXX" ]        &&  export CXX="$WM_CXX"
 [ -n "$WM_CFLAGS" ]     &&  export CFLAGS="$WM_CFLAGS"
 [ -n "$WM_CXXFLAGS" ]   &&  export CXXFLAGS="$WM_CXXFLAGS"
 [ -n "$WM_LDFLAGS" ]    &&  export LDFLAGS="$WM_LDFLAGS"
 
+
+warnBuildIssues()
+{
+    echo
+    echo "    ---------------------------------------------------"
+    echo "    Optional component ($1) had build issues"
+    echo "    OpenFOAM will nonetheless remain largely functional"
+    echo "    ---------------------------------------------------"
+    echo
+}
+
+warnNotFound()
+{
+    echo "    Optional component ($1) was not found"
+    echo
+}
+
+#------------------------------------------------------------------------------
+
 echo
 echo ========================================
 echo Start ThirdParty Allwmake
@@ -89,7 +107,7 @@ OPENMPI)
         # end of configuration options
         # ----------------------------
         mpiPACKAGE="${MPI_ARCH_PATH##*/}"
-        sourceDIR=$WM_THIRD_PARTY_DIR/$mpiPACKAGE
+        sourceDIR=$sourceBASE/$mpiPACKAGE
         buildDIR=$buildBASE/$mpiPACKAGE
 
         cd $sourceDIR || exit 1
@@ -132,9 +150,11 @@ MPICH)
     (
         # WARNING: unmaintained build code:
         # ---------------------------------
-        set -x
-        cd $MPI_HOME || exit 1    # change to mpich-VERSION
+        mpiPACKAGE="${MPI_ARCH_PATH##*/}"
+        sourceDIR=$sourceBASE/$mpiPACKAGE
+        cd $sourceDIR || exit 1
 
+        set -x
         [ -e Makefile ] && make distclean 2>/dev/null
         rm -rf $MPI_ARCH_PATH
         rm -rf util/machines/machines.*
@@ -186,9 +206,9 @@ esac
 
 
 #------------------------------------------------------------------------------
-# building scotch is still a bit of a pain
+# Building scotch is still a bit of a pain
 
-# get SCOTCH_VERSION, SCOTCH_ARCH_PATH
+# Get SCOTCH_VERSION, SCOTCH_ARCH_PATH
 if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch)
 then
     . $settings
@@ -203,7 +223,9 @@ echo ========================================
 echo "Build Scotch decomposition library $SCOTCH_VERSION"
 echo "    $SCOTCH_ARCH_PATH"
 
-# this needs generalizing
+SCOTCH_SOURCE_DIR=$sourceBASE/$SCOTCH_VERSION
+
+# This needs generalizing, but works fairly well
 scotchMakefile=../../etc/wmakeFiles/scotch/Makefile.inc.i686_pc_linux2.shlib-OpenFOAM
 
 if [ -f $SCOTCH_ARCH_PATH/include/scotch.h \
@@ -212,10 +234,12 @@ if [ -f $SCOTCH_ARCH_PATH/include/scotch.h \
 then
     echo "    scotch header in $SCOTCH_ARCH_PATH/include"
     echo "    scotch libs   in $FOAM_EXT_LIBBIN"
-elif [ -d "$SCOTCH_VERSION" ]
+elif [ -d "$SCOTCH_SOURCE_DIR" ]
 then
 (
-    cd $SCOTCH_VERSION/src || exit 1
+    cd $SCOTCH_SOURCE_DIR/src || exit 1
+    rm -rf $SCOTCH_ARCH_PATH
+
     applyPatch $SCOTCH_VERSION ..       # patch at parent-level
 
     prefixDIR=$SCOTCH_ARCH_PATH
@@ -248,15 +272,16 @@ then
 
     # cleanup, could also remove Makefile.inc
     make realclean 2>/dev/null
-)
+) || warnBuildIssues SCOTCH
 else
-    echo "    Optional component (SCOTCH) was not found"
+    warnNotFound SCOTCH
 fi
 
-# build ptscotch if MPI (ThirdParty or system) is available
-# and there is a scotch include available (ie, normal scotch was built)
+# Build ptscotch if MPI (ThirdParty or system) is available
+# and normal scotch was build (has include and library)
 if [ "${FOAM_MPI:-dummy}" != dummy ] && \
-   [ -f $SCOTCH_ARCH_PATH/include/scotch.h ] || \
+   [ -f $SCOTCH_ARCH_PATH/include/scotch.h \
+  -a -r $FOAM_EXT_LIBBIN/libscotch.so ] || \
 {
     echo
     echo "    WARNING: skipping pt-scotch - 'scotch.h' include file not found!"
@@ -276,18 +301,17 @@ then
         echo "    ptscotch libs   in $FOAM_EXT_LIBBIN/$FOAM_MPI"
     else
     (
+        cd $SCOTCH_SOURCE_DIR/src || exit 1
         echo
-        set -x
-        cd $SCOTCH_VERSION/src || exit 1
 
         prefixDIR=$SCOTCH_ARCH_PATH
-        libDIR=$FOAM_EXT_LIBBIN/$FOAM_MPI
         incDIR=$SCOTCH_ARCH_PATH/include/$FOAM_MPI
+        libDIR=$FOAM_EXT_LIBBIN/$FOAM_MPI
 
         mkdir -p $prefixDIR 2>/dev/null
         mkdir -p $libDIR 2>/dev/null
 
-        configOpt="prefix=$prefixDIR libdir=$libDIR includedir=$incDIR"
+        configOpt="prefix=$prefixDIR includedir=$incDIR libdir=$libDIR"
 
         if [ -f $scotchMakefile ]
         then
@@ -314,7 +338,7 @@ then
     )
     fi
 
-    # verify existence of scotch include
+    # verify existence of ptscotch include
     [ -f $SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h ] || {
         echo
         echo "    WARNING: required include file 'ptscotch.h' not found!"
@@ -334,87 +358,61 @@ if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis)
 then
     . $settings
 fi
-if [ -d "$METIS_VERSION" ]
+
+METIS_SOURCE_DIR=$sourceBASE/$METIS_VERSION
+
+if [ -f $METIS_ARCH_PATH/include/metis.h \
+  -a -r $FOAM_EXT_LIBBIN/libmetis.so ]
+then
+    echo "    metis header in $METIS_ARCH_PATH/include"
+    echo "    metis libs   in $FOAM_EXT_LIBBIN"
+    echo
+elif [ -d "$METIS_SOURCE_DIR" ]
 then
+(
+    cd $METIS_SOURCE_DIR || exit 1
+    rm -rf $METIS_ARCH_PATH
 
-    if [ -f $METIS_ARCH_PATH/include/metis.h \
-      -a -r $FOAM_EXT_LIBBIN/libmetis.so ]
-    then
-        echo "    metis header in $METIS_ARCH_PATH/include"
-        echo "    metis libs   in $FOAM_EXT_LIBBIN"
-        echo
-    else
-    (
-        set -x
-        cd $METIS_VERSION  || exit 1
+    # Adjust metis integer size to match OpenFOAM label-size
+    sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '$WM_LABEL_SIZE'=' \
+        include/metis.h
 
-        if [ "$WM_PRECISION_OPTION" = "DP" ]
-        then
-            FLOAT_PRECISION=64
-        elif [ "$WM_PRECISION_OPTION" = "SP" ]
-        then
-            FLOAT_PRECISION=32
-        else
-            echo " Metis pre-configure error:"
-            echo "    WM_PRECISION_OPTION is neither DP nor SP"
-            exit 1
-        fi
+    # No config option for the library location.
+    # - build normally and use mv to relocate it
 
-        # Change user settings automatically
-        sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '$WM_LABEL_SIZE'=' \
-               -e 's=\(#define REALTYPEWIDTH\).*=\1 '$FLOAT_PRECISION'=' \
-            include/metis.h
+    make config shared=1 prefix=$METIS_ARCH_PATH \
+    && make -j $WM_NCOMPPROCS install \
+    && mv $METIS_ARCH_PATH/lib/libmetis.so $FOAM_EXT_LIBBIN
 
-        make config shared=1 prefix=$METIS_ARCH_PATH
-        make -j $WM_NCOMPPROCS install
-        cp $METIS_ARCH_PATH/lib/libmetis.so $FOAM_EXT_LIBBIN
-    )
-    fi
+    rmdir $METIS_ARCH_PATH/lib 2>/dev/null || true # failure is not critical
+) || warnBuildIssues METIS
 else
-    echo "    Optional component (METIS) was not found"
+    warnNotFound METIS
 fi
 
 
 #------------------------------------------------------------------------------
 
-warnBuildIssues()
-{
-    echo
-    echo "    ---------------------------------------------------"
-    echo "    Optional component ($1) had build issues"
-    echo "    OpenFOAM will nonetheless remain largely functional"
-    echo "    ---------------------------------------------------"
-    echo
-}
-
-warnNotFound()
-{
-    echo "    Optional component ($1) was not found"
-    echo
-}
-
-
 # CGAL is optional
 echo
 echo ========================================
 echo Build CGAL
 if [ -d "$CGAL_ARCH_PATH/include" \
-  -a -r "$CGAL_ARCH_PATH/lib/libCGAL.so" ]
+  -a -r "$CGAL_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libCGAL.so" ]
 then
     # first some information about boost
-    if [ -d "$BOOST_ARCH_PATH/include/boost" \
-      -a -r "$BOOST_ARCH_PATH/lib/libboost_system.so" ]
-    then
-        echo "    BOOST headers in $BOOST_ARCH_PATH/include"
-        echo "    BOOST libs    in $BOOST_ARCH_PATH/lib"
-    elif [ -d "/usr/include/boost" \
-        -a -r "/usr/lib${WM_COMPILER_LIB_ARCH}/libboost_system.so" ]
-    then
-        echo "    BOOST headers in /usr/include"
-        echo "    BOOST libs    in /usr/lib${WM_COMPILER_LIB_ARCH}"
-    fi
+    for root in "$BOOST_ARCH_PATH" /usr
+    do
+        if [ -d "$root/include/boost" \
+          -a -r "$root/lib$WM_COMPILER_LIB_ARCH/libboost_system.so" ]
+        then
+            echo "    BOOST headers in $root/include"
+            echo "    BOOST libs    in $root/lib$WM_COMPILER_LIB_ARCH"
+            break
+        fi
+    done
     echo "    CGAL  headers in $CGAL_ARCH_PATH/include"
-    echo "    CGAL  libs    in $CGAL_ARCH_PATH/lib"
+    echo "    CGAL  libs    in $CGAL_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
 elif [ -n "$CGAL_ARCH_PATH" ]
 then
     ./makeCGAL || warnBuildIssues CGAL
diff --git a/BUILD.md b/BUILD.md
index 54290dbf6b6013da3aad240507e855275a3e3fcc..d8f4a6a1dbc3bd5b18aef356425a2955ead58ab2 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -18,24 +18,33 @@ OpenFOAM depends to a certain extent on third-party libraries
 scripts for building third-party packages. It should normally only be used in
 conjunction with the corresponding OpenFOAM version.
 
+## Organization
 
-## Configuration of Third-Party Versions
+The ThirdParty directory contains a number of build scripts as well as
+some directories:
 
-The distributed make scripts can generally be used for a variety of
-versions of the third-party libraries, with the software version
-specified on the command-line. For example,
+| Directory         | Contains
+|-------------------|--------------------------------------------
+| etc/              | auxiliary scripts used for the build process
+| build/            | intermediate build objects
+| platforms/        | the installation directories
 
-    $ ./makeFFTW -help
-    usage: makeFFTW [OPTION] [fftw-VERSION]
 
-If a version is not explicitly specified on the command-line, it will
-use the version as specified by the appropriate OpenFOAM
-`etc/config.sh/...` entry.
+## Configuration of Third-Party Versions
 
+For most of the build scripts, the default software version
+is provided by an appropriate OpenFOAM `etc/config.sh/...` entry.
 This approach avoids duplicate entries for the default versions and
 ensures the best overall consistency between the OpenFOAM installation
 and its corresponding third-party installation.
 
+Nonethess, the distributed make scripts can generally be used for a
+variety of versions of the third-party libraries, with the software
+version specified on the command-line. For example,
+
+    $ ./makeFFTW -help
+    usage: makeFFTW [OPTION] [fftw-VERSION]
+
 ---
 
 ## Before Starting
@@ -169,13 +178,13 @@ and save some disk space.
   sources that are bundled with ParaView.
   For example, by using a symbolic link:
 
-      ln -s ParaView-5.2.0/VTK  VTK-7.1.0
+      ln -s ParaView-5.0.1/VTK  VTK-7.1.0
 
   The appropriate VTK version number can be found from the contents of
   the `vtkVersion.cmake` file.
   For example,
 
-      $ cat ParaView-5.2.0/VTK/CMake/vtkVersion.cmake
+      $ cat ParaView-5.0.1/VTK/CMake/vtkVersion.cmake
 
       # VTK version number components.
       set(VTK_MAJOR_VERSION 7)
@@ -183,19 +192,21 @@ and save some disk space.
       set(VTK_BUILD_VERSION 0)
 
 ### ParaView
+- **ParaView-5.0.1** is the last version for which the OpenFOAM reader
+  modules (eg, to visualize a `blockMeshDict`) work in their present form.
+
 - Building ParaView requires CMake, qmake and a `qt` development files.
   Use the `-cmake`, `-qmake` and `-qt-*` options for `makeParaView` as
   required.
   See additional notes below about [making Qt](#makeQt) if necessary.
 
-### ParaView
-- Both CMake and qmake are required when building ParaView.
-
 #### 5.2.0
-- Compiles without patching.
+- Compiles without patching, but the OpenFOAM reader modules
+  (eg, to visualize a `blockMeshDict`) have not yet been migrated
+  to this version.
 
 #### 4.4.0/5.0.0/5.0.1/5.1.2
-- If using `makeParaView`, the following patches will be automatically
+- When using `makeParaView`, the following patches will be automatically
   applied (see the `etc/patches` directory):
   - Bugfix for STL reader - affects 4.4.0 only.
   - Broken installation (ui_pqExportStateWizard.h) - affects 4.4.0/5.0.0/5.0.1/5.1.x
@@ -204,7 +215,6 @@ and save some disk space.
     the compilation of ParaView to halt. The easiest solution is to delete
     the ParaView-5.0.1/Plugins/SciberQuestToolKit directory.
 
-
 ### Making Qt <a name="makeQt"></a>
 - Building a third-party Qt installation (prior to building ParaView) requires
   some additional effort, but should nonetheless work smoothly.
@@ -217,7 +227,7 @@ and save some disk space.
 
 3. Build ParaView using this third-party QT. For example,
 
-       ./makeParaView -qt-4.8.7 5.2.0
+       ./makeParaView -qt-4.8.7 5.0.1
 
 - ParaView does not yet support QT5.
 
@@ -226,7 +236,6 @@ and save some disk space.
   central location), you will need to use the `etc/relocateQt` script
   afterwards.
 
-
 ---
 
 ## Versions
@@ -235,12 +244,12 @@ and save some disk space.
 
 The minimum version of gcc required is 4.8.0.
 
-| Name              | Location                                   |
-|-------------------|--------------------------------------------|
-| [gcc][page gcc]   | [releases][link gcc]                       |
-| [gmp][page gmp]   | system is often ok, otherwise [download][link gmp]  |
-| [mpfr][page mpfr] | system is often ok, otherwise [download][link mpfr] |
-| [mpc][page mpc]   | system is often ok, otherwise [download][link mpc]  |
+| Name              | Location
+|-------------------|--------------------------------------------
+| [gcc][page gcc]   | [releases][link gcc]
+| [gmp][page gmp]   | system is often ok, otherwise [download][link gmp]
+| [mpfr][page mpfr] | system is often ok, otherwise [download][link mpfr]
+| [mpc][page mpc]   | system is often ok, otherwise [download][link mpc]
 
 
 #### Potential MPFR conflicts
@@ -274,41 +283,41 @@ update your CMake beforehand.
 GNU *configure* can only be used prior to clang version 3.9.
 
 
-| Name                  | Location               |
-|-----------------------|------------------------|
-| [clang][page clang]   | [download][link clang]  |
-| [llvm][page llvm]     | [download][link llvm]   |
+| Name                  | Location
+|-----------------------|------------------------
+| [clang][page clang]   | [download][link clang]
+| [llvm][page llvm]     | [download][link llvm]
 
 
 ### Parallel Processing <a name="parallel"></a>
 
-| Name                  | Location               |
-|-----------------------|------------------------|
-| [adios][page adios]   | [repo][repo adios] or [github download][link adios] or [alt download][altlink adios] |
-| [scotch, ptscotch][page scotch] | [download][link scotch] |
-| [openmpi][page openmpi] | [download][link openmpi] |
+| Name                  | Location
+|-----------------------|------------------------
+| [adios][page adios]   | [repo][repo adios] or [github download][link adios] or [alt download][altlink adios]
+| [scotch, ptscotch][page scotch] | [download][link scotch]
+| [openmpi][page openmpi] | [download][link openmpi]
 
 
 ### General <a name="general-packages"></a>
 
-| Name                  | Location               |
-|-----------------------|------------------------|
-| [CMake][page cmake]   | [download][link cmake] |
-| [boost][page boost]   | [download][link boost] |
-| [CGAL][page CGAL]     | [download][link CGAL] or [newer][newer CGAL] |
-| [FFTW][page FFTW]     | [download][link FFTW]  |
-| [ADF/CGNS][page CGNS], ccm | [link ccmio][link ccmio] |
-| [tecio][page tecio]   | [link tecio][link tecio] |
-| gperftools            | [repo][repo gperftools] or [download][link gperftools] |
+| Name                  | Location
+|-----------------------|------------------------
+| [CMake][page cmake]   | [download][link cmake]
+| [boost][page boost]   | [download][link boost]
+| [CGAL][page CGAL]     | [download][link CGAL] or [older][older CGAL]
+| [FFTW][page FFTW]     | [download][link FFTW]
+| [ADF/CGNS][page CGNS], ccm | [link ccmio][link ccmio]
+| [tecio][page tecio]   | [link tecio][link tecio]
+| gperftools            | [repo][repo gperftools] or [download][link gperftools]
 
 
 ### Visualization <a name="viz-version"></a>
 
-| Name                  | Location               |
-|-----------------------|------------------------|
-| [MESA][page mesa]     | [download][link mesa] or [older][older mesa] |
-| [ParaView][page ParaView] | [download][link ParaView] or older [5.1][older ParaView-51], [5.0][older ParaView-50], [4.4][older ParaView-44] |
-| [Qt][page Qt]         | [repo][repo Qt] or [download][link Qt]. The newer [Qt5][newer Qt5] is **not** currently supported by ParaView. |
+| Name                  | Location
+|-----------------------|------------------------
+| [MESA][page mesa]     | [download][link mesa] or [older][older mesa]
+| [ParaView][page ParaView] | [download][link ParaView]. The reader modules do not yet work with the newest paraview versions.
+| [Qt][page Qt]         | [repo][repo Qt] or [download][link Qt]. The newer [Qt5][newer Qt5] is **not** currently supported by ParaView.
 
 
 ### CMake Minimum Requirements <a name="min-cmake"></a>
@@ -316,7 +325,9 @@ GNU *configure* can only be used prior to clang version 3.9.
 The minimum CMake requirements for building various components.
 
     2.8         llvm-3.4.2
+    2.8.8       ParaView-5.0.1
     2.8.11      CGAL-4.9
+    2.8.12.2    llvm-3.7.0
     2.8.12.2    llvm-3.8.0
     2.8.4       cmake-3.6.0
     3.3         ParaView-5.1.2
@@ -341,8 +352,11 @@ The minimum CMake requirements for building various components.
 [page clang]:     http://llvm.org/
 [page llvm]:      http://llvm.org/
 
-[link clang]:     http://llvm.org/releases/3.9.0/cfe-3.9.0.src.tar.xz
-[link llvm]:      http://llvm.org/releases/3.9.0/llvm-3.9.0.src.tar.xz
+[link clang]:     http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz
+[link llvm]:      http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
+
+[newer clang]:    http://llvm.org/releases/3.9.0/cfe-3.9.0.src.tar.xz
+[newer llvm]:     http://llvm.org/releases/3.9.0/llvm-3.9.0.src.tar.xz
 
 
 <!-- parallel -->
@@ -368,8 +382,8 @@ The minimum CMake requirements for building various components.
 [link boost]:     https://sourceforge.net/projects/boost/files/boost/1.62.0/boost_1_62_0.tar.bz2
 
 [page CGAL]:      http://cgal.org
-[link CGAL]:      https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.8.2/CGAL-4.8.2.tar.xz
-[newer CGAL]:     https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.9/CGAL-4.9.tar.xz
+[link CGAL]:      https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.9/CGAL-4.9.tar.xz
+[older CGAL]:     https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.8.2/CGAL-4.8.2.tar.xz
 
 [page FFTW]:      http://www.fftw.org/
 [link FFTW]:      http://www.fftw.org/fftw-3.3.5.tar.gz
@@ -387,11 +401,11 @@ The minimum CMake requirements for building various components.
 <!-- Visualization -->
 
 [page ParaView]:  http://www.paraview.org/
-[link ParaView]:  http://www.paraview.org/files/v5.2/ParaView-v5.2.0.tar.gz
+[link ParaView]:  http://www.paraview.org/files/v5.0/ParaView-v5.0.1-source.tar.gz
 
 [older ParaView-44]:  http://www.paraview.org/files/v4.4/ParaView-v4.4.0-source.tar.gz
-[older ParaView-50]:  http://www.paraview.org/files/v5.0/ParaView-v5.0.1-source.tar.gz
-[older ParaView-51]:  http://www.paraview.org/files/v5.1/ParaView-v5.1.2-source.tar.gz
+[newer ParaView-51]:  http://www.paraview.org/files/v5.1/ParaView-v5.1.2-source.tar.gz
+[newer ParaView-52]:  http://www.paraview.org/files/v5.2/ParaView-v5.2.0.tar.gz
 
 [page mesa]:  http://mesa3d.org/
 [link mesa]:  ftp://ftp.freedesktop.org/pub/mesa/13.0.1/mesa-13.0.1.tar.xz
@@ -406,7 +420,8 @@ The minimum CMake requirements for building various components.
 <!-- Standard Footer -->
 ## Additional OpenFOAM Links
 
-- [Download and installation instructions](http://www.openfoam.com/releases)
+- [Download](http://www.openfoam.com/releases) and
+  [installation instructions](http://www.openfoam.com/download/installation.php)
 - [Documentation](http://www.openfoam.com/documentation)
 - [Reporting bugs/issues (including bugs/suggestions/feature requests) in OpenFOAM+](http://www.openfoam.com/code/bug-reporting.php)
 - [Collaborative and Community-based Developments](http://www.openfoam.com/services/community-projects.php)
diff --git a/README.md b/README.md
index 41615cc64a670ee46ebaecc0420ecd2a30997d7c..975a68dd549bf6c7ded623850d0a7061fda81a41 100644
--- a/README.md
+++ b/README.md
@@ -18,24 +18,18 @@ OpenFOAM depends to a certain extent on third-party libraries
 scripts for building third-party packages. It should normally only be used in
 conjunction with the corresponding OpenFOAM version.
 
-
 ## Configuration of Third-Party Versions
 
-The distributed make scripts can generally be used for a variety of
-versions of the third-party libraries, with the software version
-specified on the command-line. For example,
-
-    $ ./makeFFTW -help
-    usage: makeFFTW [OPTION] [fftw-VERSION]
-
-If a version is not explicitly specified on the command-line, it will
-use the version as specified by the appropriate OpenFOAM
-`etc/config.sh/...` entry.
-
+For most of the build scripts, the default software version
+is provided by an appropriate OpenFOAM `etc/config.sh/...` entry.
 This approach avoids duplicate entries for the default versions and
 ensures the best overall consistency between the OpenFOAM installation
 and its corresponding third-party installation.
 
+Nonethess, the distributed make scripts can generally be used for a
+variety of versions of the third-party libraries, with the software
+version specified on the command-line.
+
 ---
 
 ## Before Starting
@@ -56,10 +50,10 @@ and its corresponding third-party installation.
 
 Many components of ThirdParty are *optional* or are invoked
 automatically as part of the top-level OpenFOAM `Allwmake`.
-Nonetheless it may be necessary or useful to build various
+Nonetheless it may be necessary or useful to build particular
 ThirdParty components prior to building OpenFOAM itself.
 
-## Build Sequence
+### Build Sequence
 
 1. `makeGcc` _or_ `makeLLVM` *(optional)*
 2. `makeCmake`  *(optional)*
@@ -77,7 +71,8 @@ More details can be found the ThirdParty ./BUILD.md information.
 <!-- Standard Footer -->
 ## Additional OpenFOAM Links
 
-- [Download and installation instructions](http://www.openfoam.com/releases)
+- [Download](http://www.openfoam.com/releases) and
+  [installation instructions](http://www.openfoam.com/download/installation.php)
 - [Documentation](http://www.openfoam.com/documentation)
 - [Reporting bugs/issues (including bugs/suggestions/feature requests) in OpenFOAM+](http://www.openfoam.com/code/bug-reporting.php)
 - [Collaborative and Community-based Developments](http://www.openfoam.com/services/community-projects.php)
diff --git a/README_scotch b/README_scotch
deleted file mode 100644
index f61dec93f47ac0e29ea9df37eaa65f6d0f74df59..0000000000000000000000000000000000000000
--- a/README_scotch
+++ /dev/null
@@ -1,543 +0,0 @@
-OpenFOAM uses shared object libraries from the Scotch/PT-Scotch software:
-https://www.labri.fr/perso/pelegrin/scotch/
-
-The software is licensed under the CeCILL-C Free Software Licence
-Agreement, a copy of which is reproduced below.
-
-Please note the limitation of both the Licensor's warranty and liability
-as set forth in Articles 8 and 9 of the Agreement.
-
-If only the object libraries of Scotch are provided, the full source code
-can be obtained from:
-
-http://gforge.inria.fr/projects/scotch/
-    Home page of the SCOTCH project repository.
-
-http://gforge.inria.fr/frs/?group_id=248
-    File download section of the SCOTCH project repository,
-    where source tarballs can be downloaded from.
-
-http://gforge.inria.fr/scm/?group_id=248
-    Source code repository of the SCOTCH project.
-
-http://gforge.inria.fr/docman/?group_id=248
-    Documentation regarding the SCOTCH project.
-
----
-
-CeCILL-C FREE SOFTWARE LICENSE AGREEMENT
-
-
-    Notice
-
-This Agreement is a Free Software license agreement that is the result
-of discussions between its authors in order to ensure compliance with
-the two main principles guiding its drafting:
-
-    * firstly, compliance with the principles governing the distribution
-      of Free Software: access to source code, broad rights granted to
-      users,
-    * secondly, the election of a governing law, French law, with which
-      it is conformant, both as regards the law of torts and
-      intellectual property law, and the protection that it offers to
-      both authors and holders of the economic rights over software.
-
-The authors of the CeCILL-C (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre])
-license are:
-
-Commissariat à l'Energie Atomique - CEA, a public scientific, technical
-and industrial research establishment, having its principal place of
-business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France.
-
-Centre National de la Recherche Scientifique - CNRS, a public scientific
-and technological establishment, having its principal place of business
-at 3 rue Michel-Ange, 75794 Paris cedex 16, France.
-
-Institut National de Recherche en Informatique et en Automatique -
-INRIA, a public scientific and technological establishment, having its
-principal place of business at Domaine de Voluceau, Rocquencourt, BP
-105, 78153 Le Chesnay cedex, France.
-
-
-    Preamble
-
-The purpose of this Free Software license agreement is to grant users
-the right to modify and re-use the software governed by this license.
-
-The exercising of this right is conditional upon the obligation to make
-available to the community the modifications made to the source code of
-the software so as to contribute to its evolution.
-
-In consideration of access to the source code and the rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty and the software's author, the holder of the
-economic rights, and the successive licensors only have limited liability.
-
-In this respect, the risks associated with loading, using, modifying
-and/or developing or reproducing the software by the user are brought to
-the user's attention, given its Free Software status, which may make it
-complicated to use, with the result that its use is reserved for
-developers and experienced professionals having in-depth computer
-knowledge. Users are therefore encouraged to load and test the
-suitability of the software as regards their requirements in conditions
-enabling the security of their systems and/or data to be ensured and,
-more generally, to use and operate it in the same conditions of
-security. This Agreement may be freely reproduced and published,
-provided it is not altered, and that no provisions are either added or
-removed herefrom.
-
-This Agreement may apply to any or all software for which the holder of
-the economic rights decides to submit the use thereof to its provisions.
-
-
-    Article 1 - DEFINITIONS
-
-For the purpose of this Agreement, when the following expressions
-commence with a capital letter, they shall have the following meaning:
-
-Agreement: means this license agreement, and its possible subsequent
-versions and annexes.
-
-Software: means the software in its Object Code and/or Source Code form
-and, where applicable, its documentation, "as is" when the Licensee
-accepts the Agreement.
-
-Initial Software: means the Software in its Source Code and possibly its
-Object Code form and, where applicable, its documentation, "as is" when
-it is first distributed under the terms and conditions of the Agreement.
-
-Modified Software: means the Software modified by at least one
-Integrated Contribution.
-
-Source Code: means all the Software's instructions and program lines to
-which access is required so as to modify the Software.
-
-Object Code: means the binary files originating from the compilation of
-the Source Code.
-
-Holder: means the holder(s) of the economic rights over the Initial
-Software.
-
-Licensee: means the Software user(s) having accepted the Agreement.
-
-Contributor: means a Licensee having made at least one Integrated
-Contribution.
-
-Licensor: means the Holder, or any other individual or legal entity, who
-distributes the Software under the Agreement.
-
-Integrated Contribution: means any or all modifications, corrections,
-translations, adaptations and/or new functions integrated into the
-Source Code by any or all Contributors.
-
-Related Module: means a set of sources files including their
-documentation that, without modification to the Source Code, enables
-supplementary functions or services in addition to those offered by the
-Software.
-
-Derivative Software: means any combination of the Software, modified or
-not, and of a Related Module.
-
-Parties: mean both the Licensee and the Licensor.
-
-These expressions may be used both in singular and plural form.
-
-
-    Article 2 - PURPOSE
-
-The purpose of the Agreement is the grant by the Licensor to the
-Licensee of a non-exclusive, transferable and worldwide license for the
-Software as set forth in Article 5 hereinafter for the whole term of the
-protection granted by the rights over said Software.
-
-
-    Article 3 - ACCEPTANCE
-
-3.1 The Licensee shall be deemed as having accepted the terms and
-conditions of this Agreement upon the occurrence of the first of the
-following events:
-
-    * (i) loading the Software by any or all means, notably, by
-      downloading from a remote server, or by loading from a physical
-      medium;
-    * (ii) the first time the Licensee exercises any of the rights
-      granted hereunder.
-
-3.2 One copy of the Agreement, containing a notice relating to the
-characteristics of the Software, to the limited warranty, and to the
-fact that its use is restricted to experienced users has been provided
-to the Licensee prior to its acceptance as set forth in Article 3.1
-hereinabove, and the Licensee hereby acknowledges that it has read and
-understood it.
-
-
-    Article 4 - EFFECTIVE DATE AND TERM
-
-
-      4.1 EFFECTIVE DATE
-
-The Agreement shall become effective on the date when it is accepted by
-the Licensee as set forth in Article 3.1.
-
-
-      4.2 TERM
-
-The Agreement shall remain in force for the entire legal term of
-protection of the economic rights over the Software.
-
-
-    Article 5 - SCOPE OF RIGHTS GRANTED
-
-The Licensor hereby grants to the Licensee, who accepts, the following
-rights over the Software for any or all use, and for the term of the
-Agreement, on the basis of the terms and conditions set forth hereinafter.
-
-Besides, if the Licensor owns or comes to own one or more patents
-protecting all or part of the functions of the Software or of its
-components, the Licensor undertakes not to enforce the rights granted by
-these patents against successive Licensees using, exploiting or
-modifying the Software. If these patents are transferred, the Licensor
-undertakes to have the transferees subscribe to the obligations set
-forth in this paragraph.
-
-
-      5.1 RIGHT OF USE
-
-The Licensee is authorized to use the Software, without any limitation
-as to its fields of application, with it being hereinafter specified
-that this comprises:
-
-   1. permanent or temporary reproduction of all or part of the Software
-      by any or all means and in any or all form.
-
-   2. loading, displaying, running, or storing the Software on any or
-      all medium.
-
-   3. entitlement to observe, study or test its operation so as to
-      determine the ideas and principles behind any or all constituent
-      elements of said Software. This shall apply when the Licensee
-      carries out any or all loading, displaying, running, transmission
-      or storage operation as regards the Software, that it is entitled
-      to carry out hereunder.
-
-
-      5.2 RIGHT OF MODIFICATION
-
-The right of modification includes the right to translate, adapt,
-arrange, or make any or all modifications to the Software, and the right
-to reproduce the resulting software. It includes, in particular, the
-right to create a Derivative Software.
-
-The Licensee is authorized to make any or all modification to the
-Software provided that it includes an explicit notice that it is the
-author of said modification and indicates the date of the creation thereof.
-
-
-      5.3 RIGHT OF DISTRIBUTION
-
-In particular, the right of distribution includes the right to publish,
-transmit and communicate the Software to the general public on any or
-all medium, and by any or all means, and the right to market, either in
-consideration of a fee, or free of charge, one or more copies of the
-Software by any means.
-
-The Licensee is further authorized to distribute copies of the modified
-or unmodified Software to third parties according to the terms and
-conditions set forth hereinafter.
-
-
-        5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
-
-The Licensee is authorized to distribute true copies of the Software in
-Source Code or Object Code form, provided that said distribution
-complies with all the provisions of the Agreement and is accompanied by:
-
-   1. a copy of the Agreement,
-
-   2. a notice relating to the limitation of both the Licensor's
-      warranty and liability as set forth in Articles 8 and 9,
-
-and that, in the event that only the Object Code of the Software is
-redistributed, the Licensee allows effective access to the full Source
-Code of the Software at a minimum during the entire period of its
-distribution of the Software, it being understood that the additional
-cost of acquiring the Source Code shall not exceed the cost of
-transferring the data.
-
-
-        5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE
-
-When the Licensee makes an Integrated Contribution to the Software, the
-terms and conditions for the distribution of the resulting Modified
-Software become subject to all the provisions of this Agreement.
-
-The Licensee is authorized to distribute the Modified Software, in
-source code or object code form, provided that said distribution
-complies with all the provisions of the Agreement and is accompanied by:
-
-   1. a copy of the Agreement,
-
-   2. a notice relating to the limitation of both the Licensor's
-      warranty and liability as set forth in Articles 8 and 9,
-
-and that, in the event that only the object code of the Modified
-Software is redistributed, the Licensee allows effective access to the
-full source code of the Modified Software at a minimum during the entire
-period of its distribution of the Modified Software, it being understood
-that the additional cost of acquiring the source code shall not exceed
-the cost of transferring the data.
-
-
-        5.3.3 DISTRIBUTION OF DERIVATIVE SOFTWARE
-
-When the Licensee creates Derivative Software, this Derivative Software
-may be distributed under a license agreement other than this Agreement,
-subject to compliance with the requirement to include a notice
-concerning the rights over the Software as defined in Article 6.4.
-In the event the creation of the Derivative Software required modification
-of the Source Code, the Licensee undertakes that:
-
-   1. the resulting Modified Software will be governed by this Agreement,
-   2. the Integrated Contributions in the resulting Modified Software
-      will be clearly identified and documented,
-   3. the Licensee will allow effective access to the source code of the
-      Modified Software, at a minimum during the entire period of
-      distribution of the Derivative Software, such that such
-      modifications may be carried over in a subsequent version of the
-      Software; it being understood that the additional cost of
-      purchasing the source code of the Modified Software shall not
-      exceed the cost of transferring the data.
-
-
-        5.3.4 COMPATIBILITY WITH THE CeCILL LICENSE
-
-When a Modified Software contains an Integrated Contribution subject to
-the CeCILL license agreement, or when a Derivative Software contains a
-Related Module subject to the CeCILL license agreement, the provisions
-set forth in the third item of Article 6.4 are optional.
-
-
-    Article 6 - INTELLECTUAL PROPERTY
-
-
-      6.1 OVER THE INITIAL SOFTWARE
-
-The Holder owns the economic rights over the Initial Software. Any or
-all use of the Initial Software is subject to compliance with the terms
-and conditions under which the Holder has elected to distribute its work
-and no one shall be entitled to modify the terms and conditions for the
-distribution of said Initial Software.
-
-The Holder undertakes that the Initial Software will remain ruled at
-least by this Agreement, for the duration set forth in Article 4.2.
-
-
-      6.2 OVER THE INTEGRATED CONTRIBUTIONS
-
-The Licensee who develops an Integrated Contribution is the owner of the
-intellectual property rights over this Contribution as defined by
-applicable law.
-
-
-      6.3 OVER THE RELATED MODULES
-
-The Licensee who develops a Related Module is the owner of the
-intellectual property rights over this Related Module as defined by
-applicable law and is free to choose the type of agreement that shall
-govern its distribution under the conditions defined in Article 5.3.3.
-
-
-      6.4 NOTICE OF RIGHTS
-
-The Licensee expressly undertakes:
-
-   1. not to remove, or modify, in any manner, the intellectual property
-      notices attached to the Software;
-
-   2. to reproduce said notices, in an identical manner, in the copies
-      of the Software modified or not;
-
-   3. to ensure that use of the Software, its intellectual property
-      notices and the fact that it is governed by the Agreement is
-      indicated in a text that is easily accessible, specifically from
-      the interface of any Derivative Software.
-
-The Licensee undertakes not to directly or indirectly infringe the
-intellectual property rights of the Holder and/or Contributors on the
-Software and to take, where applicable, vis-à-vis its staff, any and all
-measures required to ensure respect of said intellectual property rights
-of the Holder and/or Contributors.
-
-
-    Article 7 - RELATED SERVICES
-
-7.1 Under no circumstances shall the Agreement oblige the Licensor to
-provide technical assistance or maintenance services for the Software.
-
-However, the Licensor is entitled to offer this type of services. The
-terms and conditions of such technical assistance, and/or such
-maintenance, shall be set forth in a separate instrument. Only the
-Licensor offering said maintenance and/or technical assistance services
-shall incur liability therefor.
-
-7.2 Similarly, any Licensor is entitled to offer to its licensees, under
-its sole responsibility, a warranty, that shall only be binding upon
-itself, for the redistribution of the Software and/or the Modified
-Software, under terms and conditions that it is free to decide. Said
-warranty, and the financial terms and conditions of its application,
-shall be subject of a separate instrument executed between the Licensor
-and the Licensee.
-
-
-    Article 8 - LIABILITY
-
-8.1 Subject to the provisions of Article 8.2, the Licensee shall be
-entitled to claim compensation for any direct loss it may have suffered
-from the Software as a result of a fault on the part of the relevant
-Licensor, subject to providing evidence thereof.
-
-8.2 The Licensor's liability is limited to the commitments made under
-this Agreement and shall not be incurred as a result of in particular:
-(i) loss due the Licensee's total or partial failure to fulfill its
-obligations, (ii) direct or consequential loss that is suffered by the
-Licensee due to the use or performance of the Software, and (iii) more
-generally, any consequential loss. In particular the Parties expressly
-agree that any or all pecuniary or business loss (i.e. loss of data,
-loss of profits, operating loss, loss of customers or orders,
-opportunity cost, any disturbance to business activities) or any or all
-legal proceedings instituted against the Licensee by a third party,
-shall constitute consequential loss and shall not provide entitlement to
-any or all compensation from the Licensor.
-
-
-    Article 9 - WARRANTY
-
-9.1 The Licensee acknowledges that the scientific and technical
-state-of-the-art when the Software was distributed did not enable all
-possible uses to be tested and verified, nor for the presence of
-possible defects to be detected. In this respect, the Licensee's
-attention has been drawn to the risks associated with loading, using,
-modifying and/or developing and reproducing the Software which are
-reserved for experienced users.
-
-The Licensee shall be responsible for verifying, by any or all means,
-the suitability of the product for its requirements, its good working
-order, and for ensuring that it shall not cause damage to either persons
-or properties.
-
-9.2 The Licensor hereby represents, in good faith, that it is entitled
-to grant all the rights over the Software (including in particular the
-rights set forth in Article 5).
-
-9.3 The Licensee acknowledges that the Software is supplied "as is" by
-the Licensor without any other express or tacit warranty, other than
-that provided for in Article 9.2 and, in particular, without any warranty
-as to its commercial value, its secured, safe, innovative or relevant
-nature.
-
-Specifically, the Licensor does not warrant that the Software is free
-from any error, that it will operate without interruption, that it will
-be compatible with the Licensee's own equipment and software
-configuration, nor that it will meet the Licensee's requirements.
-
-9.4 The Licensor does not either expressly or tacitly warrant that the
-Software does not infringe any third party intellectual property right
-relating to a patent, software or any other property right. Therefore,
-the Licensor disclaims any and all liability towards the Licensee
-arising out of any or all proceedings for infringement that may be
-instituted in respect of the use, modification and redistribution of the
-Software. Nevertheless, should such proceedings be instituted against
-the Licensee, the Licensor shall provide it with technical and legal
-assistance for its defense. Such technical and legal assistance shall be
-decided on a case-by-case basis between the relevant Licensor and the
-Licensee pursuant to a memorandum of understanding. The Licensor
-disclaims any and all liability as regards the Licensee's use of the
-name of the Software. No warranty is given as regards the existence of
-prior rights over the name of the Software or as regards the existence
-of a trademark.
-
-
-    Article 10 - TERMINATION
-
-10.1 In the event of a breach by the Licensee of its obligations
-hereunder, the Licensor may automatically terminate this Agreement
-thirty (30) days after notice has been sent to the Licensee and has
-remained ineffective.
-
-10.2 A Licensee whose Agreement is terminated shall no longer be
-authorized to use, modify or distribute the Software. However, any
-licenses that it may have granted prior to termination of the Agreement
-shall remain valid subject to their having been granted in compliance
-with the terms and conditions hereof.
-
-
-    Article 11 - MISCELLANEOUS
-
-
-      11.1 EXCUSABLE EVENTS
-
-Neither Party shall be liable for any or all delay, or failure to
-perform the Agreement, that may be attributable to an event of force
-majeure, an act of God or an outside cause, such as defective
-functioning or interruptions of the electricity or telecommunications
-networks, network paralysis following a virus attack, intervention by
-government authorities, natural disasters, water damage, earthquakes,
-fire, explosions, strikes and labor unrest, war, etc.
-
-11.2 Any failure by either Party, on one or more occasions, to invoke
-one or more of the provisions hereof, shall under no circumstances be
-interpreted as being a waiver by the interested Party of its right to
-invoke said provision(s) subsequently.
-
-11.3 The Agreement cancels and replaces any or all previous agreements,
-whether written or oral, between the Parties and having the same
-purpose, and constitutes the entirety of the agreement between said
-Parties concerning said purpose. No supplement or modification to the
-terms and conditions hereof shall be effective as between the Parties
-unless it is made in writing and signed by their duly authorized
-representatives.
-
-11.4 In the event that one or more of the provisions hereof were to
-conflict with a current or future applicable act or legislative text,
-said act or legislative text shall prevail, and the Parties shall make
-the necessary amendments so as to comply with said act or legislative
-text. All other provisions shall remain effective. Similarly, invalidity
-of a provision of the Agreement, for any reason whatsoever, shall not
-cause the Agreement as a whole to be invalid.
-
-
-      11.5 LANGUAGE
-
-The Agreement is drafted in both French and English and both versions
-are deemed authentic.
-
-
-    Article 12 - NEW VERSIONS OF THE AGREEMENT
-
-12.1 Any person is authorized to duplicate and distribute copies of this
-Agreement.
-
-12.2 So as to ensure coherence, the wording of this Agreement is
-protected and may only be modified by the authors of the License, who
-reserve the right to periodically publish updates or new versions of the
-Agreement, each with a separate number. These subsequent versions may
-address new issues encountered by Free Software.
-
-12.3 Any Software distributed under a given version of the Agreement may
-only be subsequently distributed under the same version of the Agreement
-or a subsequent version.
-
-
-    Article 13 - GOVERNING LAW AND JURISDICTION
-
-13.1 The Agreement is governed by French law. The Parties agree to
-endeavor to seek an amicable solution to any disagreements or disputes
-that may arise during the performance of the Agreement.
-
-13.2 Failing an amicable solution within two (2) months as from their
-occurrence, and unless emergency proceedings are necessary, the
-disagreements or disputes shall be referred to the Paris Courts having
-jurisdiction, by the more diligent Party.
-
-
-Version 1.0 dated 2006-09-05.
diff --git a/etc/patches/ADIOS-1.11.0 b/etc/patches/ADIOS-1.11.0
new file mode 100644
index 0000000000000000000000000000000000000000..60ca0dde9fb225f4e43a76f609bb99c39edac5ae
--- /dev/null
+++ b/etc/patches/ADIOS-1.11.0
@@ -0,0 +1,12 @@
+--- ADIOS-1.11.0/src/core/adios_transform_methods.c.orig	2016-11-17 19:46:11.000000000 +0100
++++ ADIOS-1.11.0/src/core/adios_transform_methods.c	2016-12-14 15:19:39.870832445 +0100
+@@ -7,6 +7,9 @@
+
+ ADIOS_AVAILABLE_TRANSFORM_METHODS * adios_available_transform_methods()
+ {
++    /* Ensure the transforms are initialized before accessing */
++    adios_transform_read_init();
++
+     int i, n;
+     n = 0;
+     for (i = (int)adios_transform_none; i < num_adios_transform_types; i++) {
diff --git a/etc/patches/adios-1.11.0 b/etc/patches/adios-1.11.0
new file mode 120000
index 0000000000000000000000000000000000000000..ab6c15d82a0249fd67775d3b893bfa5296a81b88
--- /dev/null
+++ b/etc/patches/adios-1.11.0
@@ -0,0 +1 @@
+ADIOS-1.11.0
\ No newline at end of file
diff --git a/etc/patches/mkdiff-paraview-5.0.1 b/etc/patches/mkdiff-paraview-5.0.1
index c6a7343d5ac0ed8ca4cff2e5253e89ae164467bf..b727ef9f4653e9daf37cd755648c8a77ca775130 100644
--- a/etc/patches/mkdiff-paraview-5.0.1
+++ b/etc/patches/mkdiff-paraview-5.0.1
@@ -2,12 +2,26 @@
 
 # simple script to generate patches
 paraview=ParaView-5.0.1
+if [ "$#" -gt 0 ]
+then
+    paraview="${1%%/}"
+fi
+
+[ -d "$paraview" ] || {
+    echo "No directory '$paraview'" 1>&2
+    exit 2
+}
 
 for i in \
     $paraview/VTK/CMake/vtkCompilerExtras.cmake \
     $paraview/VTK/CMake/GenerateExportHeader.cmake \
     $paraview/Qt/Components/CMakeLists.txt \
+    $paraview/CMake/generate_qhp.cmake \
+    $paraview/CMake/ParaViewMacros.cmake \
+    $paraview/CMake/generate_proxydocumentation.cmake \
     ;
 do
     diff -uw $i.orig $i
 done
+
+# -----------------------------------------------------------------------------
diff --git a/etc/patches/paraview-4.4.0 b/etc/patches/paraview-4.4.0
index 2c34de3e48bdd963d507cb12b6aa60e9092848e2..92ff39ba0020db81b8315572d36e00ae12cfa920 100644
--- a/etc/patches/paraview-4.4.0
+++ b/etc/patches/paraview-4.4.0
@@ -16,7 +16,7 @@
      ERROR_VARIABLE _gcc_version_info)
 
 -  string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]*"
-+  string (REGEX MATCH "[3-6]\\.[0-9]\\.[0-9]*"
++  string (REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*"
      _gcc_version "${_gcc_version_info}")
    if(NOT _gcc_version)
      string (REGEX REPLACE ".*\\(GCC\\).*([34]\\.[0-9]).*" "\\1.0"
@@ -27,24 +27,18 @@
        OUTPUT_VARIABLE _gcc_version_info
        ERROR_VARIABLE _gcc_version_info)
 -    string(REGEX MATCH "[345]\\.[0-9]\\.[0-9]*"
-+    string(REGEX MATCH "[3-6]\\.[0-9]\\.[0-9]*"
++    string(REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*"
        _gcc_version "${_gcc_version_info}")
      # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the
      # patch level, handle this here:
 --- ParaView-5.0.1/Qt/Components/CMakeLists.txt.orig	2016-06-13 09:27:27.827849525 +0200
 +++ ParaView-5.0.1/Qt/Components/CMakeLists.txt	2016-06-13 09:29:28.599318445 +0200
-@@ -656,10 +656,10 @@
+@@ -640,7 +640,7 @@
  #the pqSGExportStateWizard has subclasses that directly access
  #the UI file, and currently we don't have a clean way to break this hard
  #dependency, so for no we install this ui file.
 -if(PARAVIEW_INSTALL_DEVELOPMENT_FILES)
--  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h"
--          DESTINATION "${VTK_INSTALL_INCLUDE_DIR}")
--endif()
-+#OPENFOAM patch#if(PARAVIEW_INSTALL_DEVELOPMENT_FILES)
-+#OPENFOAM patch#  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h"
-+#OPENFOAM patch#          DESTINATION "${VTK_INSTALL_INCLUDE_DIR}")
-+#OPENFOAM patch#endif()
-
- #IF (NOT PV_INSTALL_NO_DEVELOPMENT)
- #  # Headers
++if(PARAVIEW_INSTALL_DEVELOPMENT_FILES AND PARAVIEW_ENABLE_PYTHON)
+   install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h"
+           DESTINATION "${VTK_INSTALL_INCLUDE_DIR}")
+ endif()
diff --git a/etc/patches/paraview-5.0.0 b/etc/patches/paraview-5.0.0
new file mode 120000
index 0000000000000000000000000000000000000000..1f0fde93583019682b97c6e9a81280220825e6c1
--- /dev/null
+++ b/etc/patches/paraview-5.0.0
@@ -0,0 +1 @@
+paraview-5.0.1
\ No newline at end of file
diff --git a/etc/patches/paraview-5.0.1 b/etc/patches/paraview-5.0.1
index 24acebafefd5fc0b115ea4336c9c9d54761db7bd..4b00f663ab26b0a5bc85f2f55faf09a5b8ea7ced 100644
--- a/etc/patches/paraview-5.0.1
+++ b/etc/patches/paraview-5.0.1
@@ -1,39 +1,87 @@
 --- ParaView-5.0.1/VTK/CMake/vtkCompilerExtras.cmake.orig	2016-03-28 17:07:10.000000000 +0200
-+++ ParaView-5.0.1/VTK/CMake/vtkCompilerExtras.cmake	2016-06-11 15:10:14.820958942 +0200
++++ ParaView-5.0.1/VTK/CMake/vtkCompilerExtras.cmake	2016-12-13 17:21:25.382720945 +0100
 @@ -32,7 +32,7 @@
      OUTPUT_VARIABLE _gcc_version_info
      ERROR_VARIABLE _gcc_version_info)
 
 -  string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]*"
-+  string (REGEX MATCH "[3-6]\\.[0-9]\\.[0-9]*"
++  string (REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*"
      _gcc_version "${_gcc_version_info}")
    if(NOT _gcc_version)
      string (REGEX REPLACE ".*\\(GCC\\).*([34]\\.[0-9]).*" "\\1.0"
 --- ParaView-5.0.1/VTK/CMake/GenerateExportHeader.cmake.orig	2016-03-28 17:07:10.000000000 +0200
-+++ ParaView-5.0.1/VTK/CMake/GenerateExportHeader.cmake	2016-06-11 15:12:16.344357746 +0200
++++ ParaView-5.0.1/VTK/CMake/GenerateExportHeader.cmake	2016-12-13 17:21:25.382720945 +0100
 @@ -166,7 +166,7 @@
      execute_process(COMMAND ${CMAKE_C_COMPILER} ARGS --version
        OUTPUT_VARIABLE _gcc_version_info
        ERROR_VARIABLE _gcc_version_info)
 -    string(REGEX MATCH "[345]\\.[0-9]\\.[0-9]*"
-+    string(REGEX MATCH "[3-6]\\.[0-9]\\.[0-9]*"
++    string(REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*"
        _gcc_version "${_gcc_version_info}")
      # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the
      # patch level, handle this here:
---- ParaView-5.0.1/Qt/Components/CMakeLists.txt.orig	2016-06-13 09:27:27.827849525 +0200
-+++ ParaView-5.0.1/Qt/Components/CMakeLists.txt	2016-06-13 09:29:28.599318445 +0200
-@@ -656,10 +656,10 @@
+--- ParaView-5.0.1/Qt/Components/CMakeLists.txt.orig	2016-03-28 17:07:03.000000000 +0200
++++ ParaView-5.0.1/Qt/Components/CMakeLists.txt	2016-12-13 17:38:42.713553032 +0100
+@@ -656,7 +656,7 @@
  #the pqSGExportStateWizard has subclasses that directly access
  #the UI file, and currently we don't have a clean way to break this hard
  #dependency, so for no we install this ui file.
 -if(PARAVIEW_INSTALL_DEVELOPMENT_FILES)
--  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h"
--          DESTINATION "${VTK_INSTALL_INCLUDE_DIR}")
--endif()
-+#OPENFOAM patch#if(PARAVIEW_INSTALL_DEVELOPMENT_FILES)
-+#OPENFOAM patch#  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h"
-+#OPENFOAM patch#          DESTINATION "${VTK_INSTALL_INCLUDE_DIR}")
-+#OPENFOAM patch#endif()
-
- #IF (NOT PV_INSTALL_NO_DEVELOPMENT)
- #  # Headers
++if(PARAVIEW_INSTALL_DEVELOPMENT_FILES AND PARAVIEW_ENABLE_PYTHON)
+   install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h"
+           DESTINATION "${VTK_INSTALL_INCLUDE_DIR}")
+ endif()
+--- ParaView-5.0.1/CMake/generate_qhp.cmake.orig	2016-03-28 17:06:22.000000000 +0200
++++ ParaView-5.0.1/CMake/generate_qhp.cmake	2016-12-13 17:21:25.382720945 +0100
+@@ -44,7 +48,9 @@
+   message(FATAL_ERROR "Missing one of the required arguments!!")
+ endif ()
+
+-string (REPLACE "+" ";" file_patterns "${file_patterns}")
++# Recover original ';' separated list.
++string(REPLACE "_s" ";"  file_patterns "${file_patterns}")
++string(REPLACE "_u" "_"  file_patterns "${file_patterns}")
+
+ get_filename_component(working_dir "${output_file}" PATH)
+
+--- ParaView-5.0.1/CMake/ParaViewMacros.cmake.orig	2016-03-28 17:07:03.000000000 +0200
++++ ParaView-5.0.1/CMake/ParaViewMacros.cmake	2016-12-13 17:21:25.382720945 +0100
+@@ -219,15 +226,21 @@
+   set (xmls_string "")
+   foreach (xml ${xmls})
+     get_filename_component(xml "${xml}" ABSOLUTE)
+-    set (xmls_string "${xmls_string}${xml}+")
++    set (xmls_string "${xmls_string}${xml};")
+   endforeach()
+
+   set (gui_xmls_string "")
+   foreach (gui_xml ${gui_xmls})
+     get_filename_component(gui_xml "${gui_xml}" ABSOLUTE)
+-    set (gui_xmls_string "${gui_xmls_string}${gui_xml}+")
++    set (gui_xmls_string "${gui_xmls_string}${gui_xml};")
+   endforeach()
+
++  # Escape ';' in lists
++  string(REPLACE "_" "_u"  xmls_string "${xmls_string}")
++  string(REPLACE ";" "_s"  xmls_string "${xmls_string}")
++  string(REPLACE "_" "_u"  gui_xmls_string "${gui_xmls_string}")
++  string(REPLACE ";" "_s"  gui_xmls_string "${gui_xmls_string}")
++
+   set (all_xmls ${xmls} ${gui_xmls})
+   list (GET all_xmls 0 first_xml)
+   if (NOT first_xml)
+--- ParaView-5.0.1/CMake/generate_proxydocumentation.cmake.orig	2016-03-28 17:06:22.000000000 +0200
++++ ParaView-5.0.1/CMake/generate_proxydocumentation.cmake	2016-12-13 17:21:25.382720945 +0100
+@@ -21,8 +21,10 @@
+ endif()
+
+ # input_xmls is a pseudo-list. Convert it to a real CMake list.
+-string(REPLACE "+" ";" input_xmls "${input_xmls}")
+-string(REPLACE "+" ";" input_gui_xmls "${input_gui_xmls}")
++string(REPLACE "_s" ";"  input_xmls "${input_xmls}")
++string(REPLACE "_u" "_"  input_xmls "${input_xmls}")
++string(REPLACE "_s" ";"  input_gui_xmls "${input_gui_xmls}")
++string(REPLACE "_u" "_"  input_gui_xmls "${input_gui_xmls}")
+
+ set (xslt_xml)
+
diff --git a/etc/patches/paraview-5.1.0 b/etc/patches/paraview-5.1.0
deleted file mode 100644
index 534e698d993485e744ce0fd19b839af3fd5f87ee..0000000000000000000000000000000000000000
--- a/etc/patches/paraview-5.1.0
+++ /dev/null
@@ -1,17 +0,0 @@
---- ParaView-5.1.0/Qt/Components/CMakeLists.txt.orig	2016-06-13 09:27:27.827849525 +0200
-+++ ParaView-5.1.0/Qt/Components/CMakeLists.txt	2016-06-13 09:29:28.599318445 +0200
-@@ -656,10 +656,10 @@
- #the pqSGExportStateWizard has subclasses that directly access
- #the UI file, and currently we don't have a clean way to break this hard
- #dependency, so for no we install this ui file.
--if(PARAVIEW_INSTALL_DEVELOPMENT_FILES)
--  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h"
--          DESTINATION "${VTK_INSTALL_INCLUDE_DIR}")
--endif()
-+#OPENFOAM patch#if(PARAVIEW_INSTALL_DEVELOPMENT_FILES)
-+#OPENFOAM patch#  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h"
-+#OPENFOAM patch#          DESTINATION "${VTK_INSTALL_INCLUDE_DIR}")
-+#OPENFOAM patch#endif()
-
- #IF (NOT PV_INSTALL_NO_DEVELOPMENT)
- #  # Headers
diff --git a/etc/patches/paraview-5.1.0 b/etc/patches/paraview-5.1.0
new file mode 120000
index 0000000000000000000000000000000000000000..36a4164f0a04e0524b0d54971344fe407c71b6f2
--- /dev/null
+++ b/etc/patches/paraview-5.1.0
@@ -0,0 +1 @@
+paraview-5.1.2
\ No newline at end of file
diff --git a/etc/patches/paraview-5.1.2 b/etc/patches/paraview-5.1.2
new file mode 100644
index 0000000000000000000000000000000000000000..ccfc7c125d8f3116fb0f26cf99c6d0034d89a4ed
--- /dev/null
+++ b/etc/patches/paraview-5.1.2
@@ -0,0 +1,65 @@
+--- ParaView-5.1.2/Qt/Components/CMakeLists.txt.orig	2016-07-26 21:52:16.000000000 +0200
++++ ParaView-5.1.2/Qt/Components/CMakeLists.txt	2016-12-13 17:38:42.713553032 +0100
+@@ -591,7 +591,7 @@
+ #the pqSGExportStateWizard has subclasses that directly access
+ #the UI file, and currently we don't have a clean way to break this hard
+ #dependency, so for no we install this ui file.
+-if(PARAVIEW_INSTALL_DEVELOPMENT_FILES)
++if(PARAVIEW_INSTALL_DEVELOPMENT_FILES AND PARAVIEW_ENABLE_PYTHON)
+   install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ui_pqExportStateWizard.h"
+           DESTINATION "${VTK_INSTALL_INCLUDE_DIR}")
+ endif()
+--- ParaView-5.1.2/CMake/generate_qhp.cmake.orig	2016-03-28 17:06:22.000000000 +0200
++++ ParaView-5.1.2/CMake/generate_qhp.cmake	2016-12-13 17:21:25.382720945 +0100
+@@ -44,7 +48,9 @@
+   message(FATAL_ERROR "Missing one of the required arguments!!")
+ endif ()
+
+-string (REPLACE "+" ";" file_patterns "${file_patterns}")
++# Recover original ';' separated list.
++string(REPLACE "_s" ";"  file_patterns "${file_patterns}")
++string(REPLACE "_u" "_"  file_patterns "${file_patterns}")
+
+ get_filename_component(working_dir "${output_file}" PATH)
+
+--- ParaView-5.1.2/CMake/ParaViewMacros.cmake.orig	2016-03-28 17:07:03.000000000 +0200
++++ ParaView-5.1.2/CMake/ParaViewMacros.cmake	2016-12-13 17:21:25.382720945 +0100
+@@ -219,15 +226,21 @@
+   set (xmls_string "")
+   foreach (xml ${xmls})
+     get_filename_component(xml "${xml}" ABSOLUTE)
+-    set (xmls_string "${xmls_string}${xml}+")
++    set (xmls_string "${xmls_string}${xml};")
+   endforeach()
+
+   set (gui_xmls_string "")
+   foreach (gui_xml ${gui_xmls})
+     get_filename_component(gui_xml "${gui_xml}" ABSOLUTE)
+-    set (gui_xmls_string "${gui_xmls_string}${gui_xml}+")
++    set (gui_xmls_string "${gui_xmls_string}${gui_xml};")
+   endforeach()
+
++  # Escape ';' in lists
++  string(REPLACE "_" "_u"  xmls_string "${xmls_string}")
++  string(REPLACE ";" "_s"  xmls_string "${xmls_string}")
++  string(REPLACE "_" "_u"  gui_xmls_string "${gui_xmls_string}")
++  string(REPLACE ";" "_s"  gui_xmls_string "${gui_xmls_string}")
++
+   set (all_xmls ${xmls} ${gui_xmls})
+   list (GET all_xmls 0 first_xml)
+   if (NOT first_xml)
+--- ParaView-5.1.2/CMake/generate_proxydocumentation.cmake.orig	2016-03-28 17:06:22.000000000 +0200
++++ ParaView-5.1.2/CMake/generate_proxydocumentation.cmake	2016-12-13 17:21:25.382720945 +0100
+@@ -21,8 +21,10 @@
+ endif()
+
+ # input_xmls is a pseudo-list. Convert it to a real CMake list.
+-string(REPLACE "+" ";" input_xmls "${input_xmls}")
+-string(REPLACE "+" ";" input_gui_xmls "${input_gui_xmls}")
++string(REPLACE "_s" ";"  input_xmls "${input_xmls}")
++string(REPLACE "_u" "_"  input_xmls "${input_xmls}")
++string(REPLACE "_s" ";"  input_gui_xmls "${input_gui_xmls}")
++string(REPLACE "_u" "_"  input_gui_xmls "${input_gui_xmls}")
+
+ set (xslt_xml)
+
diff --git a/etc/tools/ParaView3Functions b/etc/tools/ParaView3Functions
deleted file mode 100644
index 7a3cd28e631cebd463a126ab1d714ae632f10fdc..0000000000000000000000000000000000000000
--- a/etc/tools/ParaView3Functions
+++ /dev/null
@@ -1,426 +0,0 @@
-#---------------------------------*- sh -*-------------------------------------
-# =========                 |
-# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-#  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2016 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/>.
-#
-# File
-#     etc/tools/ParaViewFunctions
-#
-# Description
-#     ParaView make/install helper functions
-#
-#------------------------------------------------------------------------------
-
-# buildBASE, installBASE defined from tools/ThirdPartyFunctions
-
-#
-# Where things are or should be put
-#   ParaView_VERSION and ParaView_MAJOR should already have been set
-#
-#   ParaView_SOURCE_DIR : location of the original sources
-#   ParaView_BINARY_DIR : location of the build
-#   ParaView_DIR        : location of the installed program
-#
-setParaViewDirs()
-{
-    ParaView_SOURCE_DIR=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
-
-    [ -d "$ParaView_SOURCE_DIR" ] || {
-        echo "did not find ParaView-$ParaView_VERSION in these directories:"
-        echo "  WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
-        echo
-        echo "abort build"
-        exit 1
-    }
-
-    # ParaView_BINARY_DIR=$buildBASE/ParaView-$ParaView_VERSION${OBJ_ADD:+-$OBJ_ADD}
-    ParaView_BINARY_DIR=$buildBASE/ParaView-$ParaView_VERSION
-
-    # ParaView_DIR=$installBASE/ParaView-$ParaView_VERSION${OBJ_ADD:+-$OBJ_ADD}
-    ParaView_DIR=$installBASE/ParaView-$ParaView_VERSION
-
-    export ParaView_SOURCE_DIR ParaView_BINARY_DIR ParaView_DIR
-
-    echo
-    echo "ParaView_SOURCE_DIR=$ParaView_SOURCE_DIR"
-    echo "ParaView_BINARY_DIR=$ParaView_BINARY_DIR"
-    echo "ParaView_DIR=$ParaView_DIR"
-
-    # Forcefully override the .git path for the ParaView source code directory
-    export GIT_DIR=$ParaView_SOURCE_DIR/.git
-}
-
-
-#
-# Set ParaView_VERSION and adjust ParaView_MAJOR accordingly
-#
-# $1 can contain something something like 4.4.0, paraview-4.4.0, ParaView-4.0.0
-#
-setParaViewVersion()
-{
-    [ $# -gt 0 ] || {
-        echo "Error: function setParaViewVersion() called without an argument"
-        exit 1
-    }
-
-    ParaView_VERSION="${1##*-}"
-
-    # The major version is "<digits>.<digits>"
-    ParaView_MAJOR=$(echo $ParaView_VERSION | \
-        sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/')
-
-    export ParaView_VERSION ParaView_MAJOR
-}
-
-
-#------------------------------------------------------------------------------
-
-#
-# Compare version information (specified vs what is found in CMakeLists.txt)
-# Parse this type of content:
-#   set (PARAVIEW_VERSION_FULL "3.98.1")
-#
-checkVersion()
-{
-    local ver=$(
-        sed -ne 's/^ *set *( *PARAVIEW_VERSION_FULL[ "]*\([.0-9]*\).*$/\1/ip' \
-        $ParaView_SOURCE_DIR/CMakeLists.txt
-    )
-
-    if [ "$ParaView_VERSION" != "$ver" ]
-    then
-        echo "MISMATCH!"
-        echo "    specified $ParaView_VERSION"
-        echo "    found     ${ver:-NONE}"
-    fi
-}
-
-#
-# Set CMake cache variables
-#
-addCMakeVariable()
-{
-    while [ -n "$1" ]
-    do
-        CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
-        shift
-    done
-}
-
-
-#
-# Verbose makefiles
-#
-addVerbosity()
-{
-    if [ "${withVERBOSE:=false}" = true ]
-    then
-        addCMakeVariable  "CMAKE_VERBOSE_MAKEFILE=TRUE"
-    fi
-}
-
-
-#
-# Define options for mpi support
-#
-addMpiSupport()
-{
-    if [ "${withMPI:=false}" != true ]
-    then
-        return
-    fi
-
-    OBJ_ADD="$OBJ_ADD-mpi"
-
-    addCMakeVariable  "PARAVIEW_USE_MPI=ON VTK_USE_MPI=ON"
-    addCMakeVariable  "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
-}
-
-
-#
-# Define options for python support
-#
-addPythonSupport()
-{
-    if [ "${withPYTHON:=false}" != true ]
-    then
-        return
-    fi
-
-    OBJ_ADD="$OBJ_ADD-py"
-
-    if pythonBin=$(which python 2>/dev/null)
-    then
-        if [ -n "$PYTHON_LIBRARY" ]
-        then
-            # Check $PYTHON_LIBRARY if it has been set
-            if [ ! -e "$PYTHON_LIBRARY" ]
-            then
-                echo "*** Error: libpython not found at location specified " \
-                     "by -pythnon-lib input: PYTHON_LIBRARY=$PYTHON_LIBRARY"
-            fi
-        else
-            # Try to get $PYTHON_LIBRARY from dynamically linked binary
-            PYTHON_LIBRARY=$(ldd $pythonBin | \
-                sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p')
-
-            [ -e "$PYTHON_LIBRARY" ] || {
-                echo "*** Error: Unable to determine path to python library."
-            }
-        fi
-
-        [ -e "$PYTHON_LIBRARY" ] || {
-            echo "    Please set the full path to the python library "
-            echo "    (including libpython) using the -python-lib option, "
-            echo "    or deactivate python support by not using the -python "
-            echo "    option"
-            exit 1
-        }
-
-        pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/')
-        pythonInclude=/usr/include/python$pythonMajor
-
-        # Note - we could also allow for a PYTHON_INCLUDE variable ...
-        [ -d "$pythonInclude" ] || {
-            echo "    No python headers found in $pythonInclude/"
-            echo "    Please install python headers or deactivate "
-            echo "    python support by not using the -python option"
-            exit 1
-        }
-
-        addCMakeVariable  "PARAVIEW_ENABLE_PYTHON=ON"
-        addCMakeVariable  "PYTHON_INCLUDE_PATH=$pythonInclude"
-        addCMakeVariable  "PYTHON_LIBRARY=$PYTHON_LIBRARY"
-
-        echo "----"
-        echo "Python information:"
-        echo "    executable     : $pythonBin"
-        echo "    version        : $pythonMajor"
-        echo "    include path   : $pythonInclude"
-        echo "    library        : $PYTHON_LIBRARY"
-
-        unset pythonBin pythonInclude pythonMajor
-    else
-        echo "*** Error: python not found"
-        echo "***        Deactivate python support by not using the -python "
-        echo "***        option"
-        exit 1
-    fi
-}
-
-
-#
-# Define options for mesa support
-#
-addMesaSupport()
-{
-    if [ "${withMESA:=false}" != true ]
-    then
-        return
-    fi
-
-    if [ -d "$MESA_INCLUDE" -a -f "$MESA_LIBRARY" ]
-    then
-        OBJ_ADD="$OBJ_ADD-mesa"
-
-        addCMakeVariable  "VTK_OPENGL_HAS_OSMESA:BOOL=ON"
-        addCMakeVariable  "OSMESA_INCLUDE_DIR=$MESA_INCLUDE"
-        addCMakeVariable  "OSMESA_LIBRARY=$MESA_LIBRARY"
-
-    else
-       echo "*** Error: no MESA information found"
-       echo "***        Deactivate MESA support by not using the -mesa option, "
-       echo "***        or set the correct paths for:"
-       echo "***        -mesa-include ($MESA_INCLUDE)"
-       echo "***        -mesa-lib ($MESA_LIBRARY)"
-       exit 1
-    fi
-}
-
-
-addQtSupport()
-{
-    QtVersion=none
-
-    if [ "${withQT:=false}" != true ]
-    then
-        return
-    fi
-
-    addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON"
-
-    local qmake=$(findQtMake)
-
-    # Check qmake can be found
-    if type $qmake >/dev/null 2>&1
-    then
-        # Check the Qt version selected
-        # parse -> "Using Qt version X.Y.Z in ..."
-        QtVersion=$($qmake -query QT_VERSION)
-
-        # Split Major.Minor.Revision - could also use IFS hacking
-        set -- $(echo "$QtVersion" | sed -e 's/\./ /g')
-
-        QtMajor=$1
-        QtMinor=$2
-
-        if [ $QtMajor -ne 4 -o $QtMajor -eq 4 -a $QtMinor -lt 5 ]
-        then
-            echo "*** Error: Qt version provided < 4.5"
-            echo "***     Please use the -qmake option to specify the location of a version of Qt >= 4.5 and < 5.0"
-            echo "***     e.g."
-            echo "***         -qmake /usr/local/qt-4.6.2/bin/qmake"
-            echo "***         -qmake $installBASE/qt-4.6.2/bin/qmake"
-            exit 1
-        fi
-    else
-        echo "*** Error: cannot find qmake either at \$QMAKE_PATH or in current \$PATH"
-        exit 1
-    fi
-}
-
-
-#
-# Configure via cmake, but don't actually build anything
-#
-configParaView()
-{
-    local cmake=$(findCMake)
-
-    # Remove any existing build folder and recreate
-    if [ -d $ParaView_BINARY_DIR ]
-    then
-        echo "removing old build directory"
-        echo "    $ParaView_BINARY_DIR"
-        rm -rf $ParaView_BINARY_DIR
-    fi
-    mkdir -p $ParaView_BINARY_DIR
-
-    cd $ParaView_BINARY_DIR || exit 1  # Change to build folder
-
-    echo "----"
-    echo "Configuring paraview-$ParaView_VERSION (major version: $ParaView_MAJOR)"
-    echo "    MPI    support : ${withMPI:-false}"
-    echo "    Python support : ${withPYTHON:-false}"
-    echo "    MESA   support : ${withMESA:-false}"
-    echo "    GL2  rendering : false"
-    echo "    Qt dev support : ${withQT:-false}"
-    echo "    Source         : $ParaView_SOURCE_DIR"
-    echo "    Build          : $ParaView_BINARY_DIR"
-    echo "    Target         : $ParaView_DIR"
-    echo "    Cmake          : $cmake"
-    echo "----"
-    echo
-    echo "$cmake" \
-        -DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
-        $CMAKE_VARIABLES \
-        $ParaView_SOURCE_DIR
-    echo
-    echo "----"
-    echo
-
-    # Run cmake to create Makefiles
-    $cmake -Wno-dev \
-        -DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
-        $CMAKE_VARIABLES \
-        $ParaView_SOURCE_DIR
-}
-
-
-#
-# Invoke make
-# also link bin/ to lib/paraview-* for development without installation
-#
-makeParaView()
-{
-    cd $ParaView_BINARY_DIR || exit 1  # Change to build folder
-    echo "    Starting make"
-    time make -j $WM_NCOMPPROCS
-    echo "    Done make"
-
-    # Remove lib if it is a link
-    # (how this was previously handled before 'make install' worked)
-    if [ -L lib ]
-    then
-        rm lib 2>/dev/null
-    fi
-}
-
-
-#
-# Install the program
-#
-installParaView()
-{
-    cd $ParaView_BINARY_DIR || exit 1  # Change to build folder
-    echo "    Installing ParaView to $ParaView_DIR"
-
-    make install
-
-# hack for missing files after install of version 3.14.1
-    echo "Copying missing files to install folder"
-    CMAKE_SRC_DIR=$ParaView_SOURCE_DIR/CMake
-    CMAKE_INSTALL_DIR=$ParaView_DIR/lib/paraview-$ParaView_MAJOR/CMake
-    cp -f $ParaView_SOURCE_DIR/ParaViewUse.cmake $CMAKE_INSTALL_DIR
-    cp -f $CMAKE_SRC_DIR/generate_proxydocumentation.cmake $CMAKE_INSTALL_DIR
-    cp -f $CMAKE_SRC_DIR/smxml_to_xml.xsl $CMAKE_INSTALL_DIR
-    cp -f $CMAKE_SRC_DIR/xml_to_html.xsl $CMAKE_INSTALL_DIR
-    cp -f $CMAKE_SRC_DIR/xml_to_wiki.xsl.in $CMAKE_INSTALL_DIR
-    cp -f $CMAKE_SRC_DIR/generate_qhp.cmake $CMAKE_INSTALL_DIR
-    unset CMAKE_SRC_DIR CMAKE_INSTALL_DIR
-# --- end hack
-
-cat<< INFO
-    ---
-    Installation complete for paraview-$ParaView_VERSION
-    Now update the environment by running:
-        wmREFRESH
-    ---
-INFO
-}
-
-
-#------------------------------------------------------------------------------
-
-# Clear the referenced variables before using any of the functions
-unset withMPI  withVERBOSE
-unset withQT      QMAKE_PATH
-unset withMESA    MESA_INCLUDE    MESA_LIBRARY
-unset withPYTHON  PYTHON_INCLUDE  PYTHON_LIBRARY
-unset CMAKE_VARIABLES
-unset OBJ_ADD
-
-
-# Start with these general settings
-addCMakeVariable  "VTK_USE_TK:BOOL=OFF"
-addCMakeVariable  "BUILD_SHARED_LIBS:BOOL=ON  VTK_USE_RPATH:BOOL=OFF"
-addCMakeVariable  "CMAKE_BUILD_TYPE:STRING=Release"
-
-# Include development files in "make install"
-addCMakeVariable  "PARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON"
-
-# Don't build test tree
-addCMakeVariable  "BUILD_TESTING:BOOL=OFF"
-
-# remove dependency on WebKit
-# addCMakeVariable  VTK_QT_USE_WEBKIT:BOOL=OFF
-
-#------------------------------------------------------------------------------
diff --git a/etc/tools/ParaViewFunctions b/etc/tools/ParaViewFunctions
index c989264885c5d837b95c8868e57593940dba0cdb..2d428b48fdfbcd2820844e8681bf669dd8f9c7f7 100644
--- a/etc/tools/ParaViewFunctions
+++ b/etc/tools/ParaViewFunctions
@@ -29,7 +29,7 @@
 #
 #------------------------------------------------------------------------------
 
-# buildBASE, installBASE defined from tools/ThirdPartyFunctions
+# sourceBASE, buildBASE, installBASE defined in tools/ThirdPartyFunctions
 
 #
 # Where things are or should be put
@@ -41,11 +41,21 @@
 #
 setParaViewDirs()
 {
-    ParaView_SOURCE_DIR=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
+    set -- "ParaView-$ParaView_VERSION" "ParaView-v$ParaView_VERSION"
+
+    unset ParaView_SOURCE_DIR
+    for i
+    do
+        ParaView_SOURCE_DIR="$sourceBASE/$i"
+        [ -d "$ParaView_SOURCE_DIR" ] && break
+    done
 
     [ -d "$ParaView_SOURCE_DIR" ] || {
-        echo "did not find ParaView-$ParaView_VERSION in these directories:"
-        echo "  WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
+        echo "Did not locate ParaView version:"
+        while [ "$#" -ge 1 ]; do echo "    $1"; shift; done
+        echo
+        echo "In the directory:"
+        echo "    $sourceBASE"
         echo
         echo "abort build"
         exit 1
@@ -107,9 +117,9 @@ checkVersion()
 
     if [ "$ParaView_VERSION" != "$ver" ]
     then
-        echo "MISMATCH!"
-        echo "    specified $ParaView_VERSION"
-        echo "    found     ${ver:-NONE}"
+        echo "(${ver:-none}) mismatch?"
+    else
+        echo "(${ver:-none})"
     fi
 }
 
@@ -297,23 +307,31 @@ addQtSupport()
         # parse -> "Using Qt version X.Y.Z in ..."
         QtVersion=$($qmake -query QT_VERSION)
 
-        # Split Major.Minor.Revision - could also use IFS hacking
-        set -- $(echo "$QtVersion" | sed -e 's/\./ /g')
-
-        QtMajor=$1
-        QtMinor=$2
-
-        if [ $QtMajor -lt 4 -o $QtMajor -eq 4 -a $QtMinor -lt 5 ]
-        then
-            echo "*** Error: Qt version provided < 4.5"
-            echo "***     Please use the -qmake option to specify the location of a version of Qt >= 4.5"
-            echo "***     e.g."
-            echo "***         -qmake /usr/local/qt-4.6.2/bin/qmake"
-            echo "***         -qmake $installBASE/qt-4.6.2/bin/qmake"
+        case "$QtVersion" in
+        3.* | 4.[0-4]*)
+            # QT is too old
+            cat <<ERROR
+----
+Error: ${0##*/}
+
+QT version ($QtVersion) provided < 4.5
+Please use the -qmake option to specify the location of a newer QT version
+For example,
+    ... -qmake /usr/local/qt-4.6.2/bin/qmake
+    ... -qmake $installBASE/qt-4.6.2/bin/qmake
+----
+ERROR
             exit 1
-        fi
+            ;;
+
+        5.*)
+            # QT4 is the default, must specify QT5 explicitly
+            addCMakeVariable "PARAVIEW_QT_VERSION:STRING=5"
+            ;;
+        esac
     else
-        echo "*** Error: cannot find qmake either at \$QMAKE_PATH or in current \$PATH"
+        echo "Error: cannot find qmake either at \$QMAKE_PATH or in current \$PATH"
+        echo
         exit 1
     fi
 }
@@ -415,7 +433,7 @@ cat<< INFO
     ParaView_DIR=$ParaView_DIR
 
     You may need to update the OpenFOAM environment by running:
-        wmREFRESH
+        wmRefresh
     ---
 INFO
 }
diff --git a/etc/tools/ThirdPartyFunctions b/etc/tools/ThirdPartyFunctions
index 03ec0f63b3c48f7c356c4f6ca36ed64b9c0bb346..e2fd20188a2b2d54d278aca8def3b28b187a9286 100644
--- a/etc/tools/ThirdPartyFunctions
+++ b/etc/tools/ThirdPartyFunctions
@@ -31,11 +31,11 @@
 #     Define WM_NCOMPPROCS always.
 #------------------------------------------------------------------------------
 
-# Define the normal build and prefix directories
+# The normal locations for source, build and installation (prefix-dir)
+sourceBASE=$WM_THIRD_PARTY_DIR
 buildBASE=$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER
 installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
 
-
 #
 # Mostly building without wmake
 # - disable wmakeScheduler variables
@@ -89,6 +89,7 @@ _foamIsSystem()
 # try to locate cmake according to the CMAKE_PATH
 # or just use what is found in the path
 #
+unset CMAKE_PATH # clear when first loaded
 findCMake()
 {
     local candidate
@@ -150,7 +151,7 @@ NOT_FOUND
     fi
 
     # Default to use the path, try resolving (so we know what we are using)
-    foundExe=$(command -v cmake 2> /dev/null) || foundExe=qmake
+    foundExe=$(command -v cmake 2> /dev/null) || foundExe=cmake
     echo "Using cmake=${foundExe:-NotFound}"  1>&2
     echo "${foundExe:-cmake}"
 }
@@ -160,6 +161,7 @@ NOT_FOUND
 # try to locate qmake according to the QMAKE_PATH
 # or just use what is found in the path
 #
+unset QMAKE_PATH # clear when first loaded
 findQtMake()
 {
     local candidate
@@ -323,7 +325,7 @@ applyPatch()
         else
             echo "apply patch for $pkg"
             touch "$sentinel"
-            patch -p1 < $patch 2>&1 | tee $sentinel
+            patch -b -l -p1 < $patch 2>&1 | tee $sentinel
         fi
     )
     else
diff --git a/etc/tools/vtkFunctions b/etc/tools/vtkFunctions
index a87e4e0a7e4494a80a4dbcf74946f31cfaadaaea..3d2a4cb7fa495a0c3c6d5c091f6452dc0ad52802 100644
--- a/etc/tools/vtkFunctions
+++ b/etc/tools/vtkFunctions
@@ -30,7 +30,7 @@
 #
 #------------------------------------------------------------------------------
 
-# buildBASE, installBASE defined from tools/ThirdPartyFunctions
+# sourceBASE, buildBASE, installBASE defined in tools/ThirdPartyFunctions
 
 #
 # Where things are or should be put
@@ -42,11 +42,21 @@
 #
 setVtkDirs()
 {
-    VTK_SOURCE_DIR=$WM_THIRD_PARTY_DIR/VTK-$VTK_VERSION
+    set -- "VTK-$VTK_VERSION" "VTK-v$VTK_VERSION"
+    unset VTK_SOURCE_DIR
+
+    for i
+    do
+        VTK_SOURCE_DIR="$sourceBASE/$i"
+        [ -d "$VTK_SOURCE_DIR" ] && break
+    done
 
     [ -d "$VTK_SOURCE_DIR" ] || {
-        echo "did not find VTK-$VTK_VERSION in these directories:"
-        echo "  WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
+        echo "Did not locate VTK version:"
+        while [ "$#" -ge 1 ]; do echo "    $1"; shift; done
+        echo
+        echo "In the directory:"
+        echo "    $sourceBASE"
         echo
         echo "abort build"
         exit 1
diff --git a/makeADIOS b/makeADIOS
index a731185dc005e825f99de1051a0bc826a3c74039..0c8d4d7e22a0090beed93b11368d4ae39e0ad79a 100755
--- a/makeADIOS
+++ b/makeADIOS
@@ -26,14 +26,18 @@
 #     makeADIOS
 #
 # Description
-#     Build script for ADIOS (and MXML)
+#     Build script for ADIOS
 #
 #------------------------------------------------------------------------------
-adiosPACKAGE=adios-git
-mxmlPACKAGE=mxml-2.9
+# Get version info
+. $WM_PROJECT_DIR/etc/config.sh/functions
+unset -f _foamAddPath _foamAddLib _foamAddMan # get settings only
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS)
+
+adiosPACKAGE=${adios_version:-adios-none}
 
 #------------------------------------------------------------------------------
-# run from third-party directory only
+# Run from third-party directory only
 wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
     echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
     echo "    The environment variables are inconsistent with the installation."
@@ -42,32 +46,31 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 }
 . etc/tools/ThirdPartyFunctions
 #------------------------------------------------------------------------------
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 
-usage: ${0##*/} [OPTION] [adios-VERSION] [mxml-VERSION]
+usage: ${0##*/} [OPTION] [adios-VERSION]
 options:
+  -cmake PATH       With cmake from the path given
   -gcc              Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
   -help
 
-* Build ADIOS+MXML
+* Build ADIOS
       $adiosPACKAGE
-      $mxmlPACKAGE
 
 USAGE
     exit 1
 }
-
 #------------------------------------------------------------------------------
-# ensure configure gets the correct C/C++ compiler
-[ -n "$WM_CC" ]  && export CC="$WM_CC"
-[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
+# Export WM settings in a form that GNU configure recognizes
+[ -n "$WM_CC" ]         &&  export CC="$WM_CC"
+[ -n "$WM_CXX" ]        &&  export CXX="$WM_CXX"
+[ -n "$WM_CFLAGS" ]     &&  export CFLAGS="$WM_CFLAGS"
+[ -n "$WM_CXXFLAGS" ]   &&  export CXXFLAGS="$WM_CXXFLAGS"
 
-
-# parse options
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
@@ -78,11 +81,13 @@ do
         export CC=gcc    # use gcc/g++
         export CXX=g++
         ;;
-    adios-[1-9]* | adios-git)
-        adiosPACKAGE="${1%%/}"
+    -cmake)
+        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
+        CMAKE_PATH="${2%%/}"
+        shift
         ;;
-    mxml-[1-9]*)
-        mxmlPACKAGE="${1%%/}"
+    ADIOS-[1-9]* | adios-[1-9]* | ADIOS-git* | adios-git*)
+        adiosPACKAGE="${1%%/}"
         ;;
     *)
         die "unknown option/argument: '$1'"
@@ -91,127 +96,273 @@ do
     shift
 done
 
+[ -n "$adiosPACKAGE" ] || die "The adios-VERSION was not specified"
+
+# nothing to build
+if _foamIsNone "$adiosPACKAGE"
+then
+    echo "Using adios-none (skip ThirdParty build of ADIOS)"
+    exit 0
+elif _foamIsSystem "$adiosPACKAGE"
+then
+    echo "Using adios-system"
+    exit 0
+fi
+
 #------------------------------------------------------------------------------
+#
+# Build ADIOS
+#   ADIOS_SOURCE_DIR : location of the original sources
+#   ADIOS_ARCH_PATH  : installation directory
 
-MXML_ARCH_PATH=$installBASE/$mxmlPACKAGE
+ADIOS_SOURCE_DIR=$sourceBASE/$adiosPACKAGE
 ADIOS_ARCH_PATH=$installBASE/$adiosPACKAGE
 
-# build MXML - not needed with more recent ADIOS
-if false
-then
-    echo
-    echo ========================================
-    echo "Build mxml library $mxmlPACKAGE"
-    echo
+: ${FOAM_MPI:=dummy}
 
-    if [ -f $MXML_ARCH_PATH/include/mxml.h \
-      -a -r $FOAM_EXT_LIBBIN/libmxml.so ]
-    then
-        echo "    MXML header in $MXML_ARCH_PATH/include"
-        echo "    MXML libs   in $FOAM_EXT_LIBBIN"
-        echo
-    else
+echo
+echo ========================================
+echo "Build adios library $adiosPACKAGE for $FOAM_MPI"
+echo
+
+
+#
+# Manual adjustments to adios config
+#
+adjustADIOS()
+{
+    # Rename libraries according to FOAM_MPI
     (
-        # use mxml packaged with adios (if possible)
-        # or revert to top-level
-        sourceDIR=$WM_THIRD_PARTY_DIR/$adiosPACKAGE/src/mxml/$mxmlPACKAGE
-        [ -d "$sourceDIR" ] || sourceDIR=$WM_THIRD_PARTY_DIR/$mxmlPACKAGE
+        cd $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH || exit 1
 
-        cd $sourceDIR || exit 1
+        if [ "$FOAM_MPI" != dummy ]
+        then
+            \mv -f libadios.a       libadios_$FOAM_MPI.a
+            \mv -f libadiosread.a   libadiosread_$FOAM_MPI.a
+        fi
+        \mv -f libadios_nompi.a     libadios_dummy.a
+        \mv -f libadiosread_nompi.a libadiosread_dummy.a
 
-        # Remove any existing build folder and recreate
-        \rm -rf $buildDIR 2>/dev/null
-        mkdir -p $buildDIR
+        echo
+        echo "ADIOS library renamed to libadios_$FOAM_MPI"
+        echo
+    )
 
-        [ -e Makefile ] && make clean 2>/dev/null # for safety
-        mkdir -p $FOAM_EXT_LIBBIN  2>/dev/null
+    # We don't need/use XML things
+    \rm -f $ADIOS_ARCH_PATH/bin/adios_lint
 
-        # handle non-gcc compilers
-        unset configEnv
-        if [ "${WM_CC:-gcc}" != gcc ]
+    # Replace resolved paths with variables
+    echo "Adjust prefix for ADIOS"
+    for i in \
+        $ADIOS_ARCH_PATH/bin/adios_config \
+        $ADIOS_ARCH_PATH/etc/adios_config.flags \
+    ;
+    do
+        [ -f "$i" ] || {
+            echo "    no such file - '$i'"
+            continue
+        }
+        if sed -i -e 's|'"$WM_THIRD_PARTY_DIR"'|$WM_THIRD_PARTY_DIR|g' $i
         then
-            export CC=$WM_CC
-            export CCS=$WM_CC
+            echo "    '$i'"
+        else
+            echo "    problems with '$i'"
         fi
+    done
 
-        # installs into lib64/
-        cd $buildDIR && \
-        $sourceDIR/configure --prefix=$MXML_ARCH_PATH \
-        && make -j $WM_NCOMPPROCS all \
-        && make install \
-        && echo "Built: $mxmlPACKAGE" \
-        && rsync -a $MXML_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/*.so* $FOAM_EXT_LIBBIN/
-    ) || {
-        echo "Error building: $mxmlPACKAGE"
+    # Adjust the config flags file:
+    # * Remove references to Fortran libraries (disabled in configure)
+    # * Remove references to deprecated version 1 API
+    # * Cleanup excessive whitespace
+    # * Handle renamed libraries:
+    #   - libadios       -> libadios_$FOAM_MPI
+    #   - libadios_nompi -> libadios_dummy
+    #
+    echo "Adjust library names for ADIOS"
+    for i in \
+        $ADIOS_ARCH_PATH/etc/adios_config.flags \
+    ;
+    do
+        [ -f "$i" ] || {
+            echo "    no such file - '$i'"
+            continue
+        }
+
+        if sed -i \
+            -e '/_FLIB=/d' \
+            -e '/_V1_INC=/d' \
+            -e 's|  *| |g' \
+            -e 's|\(-ladios[a-z]*_\)nompi |\1dummy |g' \
+            $i
+        then
+            echo "    '$i'"
+        else
+            echo "    problems with '$i'"
+        fi
+
+        if [ "$FOAM_MPI" != dummy ]
+        then
+            sed -i -e 's|\(-ladios[a-z]*\) |\1_'"$FOAM_MPI |g" $i || \
+            echo "    problems with '$i'"
+        fi
+    done
+}
+
+#
+# List ADIOS methods/configuration
+#
+listMethods()
+{
+    [ -f $ADIOS_ARCH_PATH/bin/adios_config ] || {
+        echo "Warning: no adios_config"
+        return 1
     }
-    fi
-fi
 
-# build ADIOS
-echo
-echo ========================================
-echo "Build adios library $adiosPACKAGE"
-echo
+    echo "==============="
+
+    # May have problems listing parallel methods (eg, transport key missing)
+    if $ADIOS_ARCH_PATH/bin/adios_config -m >/dev/null 2>&1
+    then
+        $ADIOS_ARCH_PATH/bin/adios_config -m 2>/dev/null
+    else
+        echo "Warning: could not list parallel methods"
+        # Fallback to serial methods
+        $ADIOS_ARCH_PATH/bin/adios_config -s -m 2>/dev/null
+    fi || echo "Warning: could not list configured methods"
+    echo "==============="
+
+}
 
-# Needs future adjustment for shared library, for mpi-specific library location
+
+# Needs future adjustment
+# - for shared library
+# - for mpi-specific library locations
 if [ -f $ADIOS_ARCH_PATH/include/adios.h \
-  -a -r $FOAM_EXT_LIBBIN/$FOAM_MPI/libadios.so ]
+  -a -r $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libadios_${FOAM_MPI}.a ]
 then
     echo "    ADIOS header in $ADIOS_ARCH_PATH/include"
-    echo "    ADIOS libs   in $FOAM_EXT_LIBBIN"
+    ### echo "    ADIOS libs   in $FOAM_EXT_LIBBIN"           # dynamic
+    echo "    ADIOS libs   in $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" # static
+    listMethods
+elif [ -z "$CMAKE_PATH" ]
+then
+    echo "Starting build: $adiosPACKAGE (using configure)"
     echo
-else
-(
-    # configuration options:
-    # Start with GridEngine support - builds without external libraries
-    unset configOpt
-
-    # Add InfiniBand support
-    ibDir=/usr/local/ofed
-    if [ -d "$ibDir/include" ]
-    then
-        configOpt="$configOpt --with-infiniband=$ibDir"
-    fi
-    ## $configOpt="$configOpt --with-hdf5=..."
+    (
+        # configuration options:
+        unset configOpt
 
-    # for externally compiled MXML
-    # configOpt="$configOpt --with-mxml=$MXML_ARCH_PATH"
+        # Add InfiniBand support
+        ibDir=/usr/local/ofed
+        if [ -d "$ibDir" -a "$FOAM_MPI" != dummy ]
+        then
+            configOpt="$configOpt --with-infiniband=$ibDir"
+        fi
+
+        # Transport layers
+        if [ -f "/usr/include/bzlib.h" ]
+        then
+            configOpt="$configOpt --with-bzip2"
+        fi
 
-    # end of configuration options
-    # ----------------------------
+        if [ -f "/usr/include/zlib.h" ]
+        then
+            configOpt="$configOpt --with-zlib"
+        fi
 
-    sourceDIR=$WM_THIRD_PARTY_DIR/$adiosPACKAGE
-    buildDIR=$buildBASE/$adiosPACKAGE
+        # Other types of support
+        ## $configOpt="$configOpt --with-hdf5=..."
+        ## $configOpt="$configOpt --with-lustre=..."
+        ## configOpt="$configOpt --enable-research-transports"
 
-    cd $sourceDIR || exit 1
-    export GIT_DIR=$sourceDIR/.git
+        # end of configuration options
+        # ----------------------------
+        buildDIR=$buildBASE/$adiosPACKAGE
+
+        cd $ADIOS_SOURCE_DIR || exit 1
+        [ -e Makefile ] && make distclean 2>/dev/null
+
+        export GIT_DIR=$ADIOS_SOURCE_DIR/.git
+
+        applyPatch $adiosPACKAGE $ADIOS_SOURCE_DIR
+
+        # Remove any existing build folder and recreate
+        rm -rf $ADIOS_ARCH_DIR
+        rm -rf $buildDIR 2>/dev/null
+        mkdir -p $buildDIR
 
-    # Remove any existing build folder and recreate
-    \rm -rf $buildDIR 2>/dev/null
-    mkdir -p $buildDIR
+        [ -f configure ] || {
+            echo "no configure for $adiosPACKAGE ... trying autogen"
+            ./autogen.sh
+        }
 
-    [ -e Makefile ] && make clean 2>/dev/null # for safety
+        # May not work properly with FOAM_MPI = dummy
+        if [ "$FOAM_MPI" = dummy ]
+        then
+            configOpt="$configOpt --without-mpi"
+        else
+            CC=mpicc
+            CXX=mpicxx
+        fi
 
-    [ -f configure ] || {
-        echo "no configure for $adiosPACKAGE ... trying autogen"
-        ./autogen.sh
+        # Install into lib64/
+        cd $buildDIR && $ADIOS_SOURCE_DIR/configure \
+            --prefix=$ADIOS_ARCH_PATH \
+            --libdir=$ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
+            --disable-fortran \
+            --with-pic \
+            --without-fastbit \
+            $configOpt \
+        && make -j $WM_NCOMPPROCS all \
+        && make install \
+        && echo "Built: $adiosPACKAGE" \
+        && adjustADIOS \
+        && listMethods
+    ) || {
+        echo "Error building: $adiosPACKAGE"
     }
+else
+    # CMake options often lag the configure ones
+    echo "Starting build: $adiosPACKAGE (using cmake)"
+    echo
+    (
+        buildDIR=$buildBASE/$adiosPACKAGE
+        cd $ADIOS_SOURCE_DIR || exit 1
 
-    # installs into lib64/
-    cd $buildDIR && \
-    CC=mpicc CXX=mpicxx CFLAGS="-fPIC" $sourceDIR/configure \
-        --prefix=$ADIOS_ARCH_PATH \
-        --disable-fortran \
-        --with-pic \
-        --without-fastbit \
-        $configOpt \
-    && make -j $WM_NCOMPPROCS all \
-    && make install \
-    && echo "Built: $adiosPACKAGE" \
-    && rsync -a --no-r $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/ $FOAM_EXT_LIBBIN/$FOAM_MPI/
-) || {
-    echo "Error building: $adiosPACKAGE"
-}
+        export GIT_DIR=$ADIOS_SOURCE_DIR/.git
+
+        applyPatch $adiosPACKAGE $ADIOS_SOURCE_DIR
+
+        # Remove any existing build folder and recreate
+        rm -rf $ADIOS_ARCH_DIR
+        rm -rf $buildDIR 2>/dev/null
+        mkdir -p $buildDIR
+
+        # May not work properly with FOAM_MPI = dummy
+        if [ "$FOAM_MPI" = dummy ]
+        then
+            configOpt="$configOpt --without-mpi"
+        else
+            CC=mpicc
+            CXX=mpicxx
+        fi
+
+        cmake=$(findCMake)
+
+        # Install into lib64/
+        cd $buildDIR && $cmake \
+            -DCMAKE_INSTALL_PREFIX=$ADIOS_ARCH_PATH \
+            -DCMAKE_BUILD_TYPE=Release \
+            -DBUILD_FORTRAN:BOOL=FALSE \
+            $ADIOS_SOURCE_DIR \
+        && make -j $WM_NCOMPPROCS all \
+        && make install \
+        && echo "Built: $adiosPACKAGE" \
+        && adjustADIOS \
+        && listMethods
+    ) || {
+        echo "Error building: $adiosPACKAGE"
+    }
 fi
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/makeCCMIO b/makeCCMIO
index 5d1beb6910799a6eb9edae94afbc1a231c42865c..8b7282cdf448327b62c45df62b9cd1a27dbf5edb 100755
--- a/makeCCMIO
+++ b/makeCCMIO
@@ -29,7 +29,6 @@
 #     Build CD-adapco's ccmio library
 #
 #------------------------------------------------------------------------------
-
 # Get version info
 . $WM_PROJECT_DIR/etc/config.sh/functions
 _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
@@ -38,7 +37,7 @@ ccmioPACKAGE=${ccmio_version:-libccmio-2.6.1}
 targetType=lib
 
 #------------------------------------------------------------------------------
-# run from third-party directory only
+# Run from third-party directory only
 cd ${0%/*} || exit 1
 wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
     echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
@@ -53,7 +52,6 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 }
 . etc/tools/ThirdPartyFunctions
 #------------------------------------------------------------------------------
-
 usage()
 {
     exec 1>&2
@@ -79,6 +77,7 @@ options:
 USAGE
     exit 1
 }
+#------------------------------------------------------------------------------
 
 
 # Parse options
@@ -102,10 +101,10 @@ do
 done
 
 # assert: directory must be available
-[ -d "${ccmioPACKAGE}" ] || die "missing source directory '$ccmioPACKAGE'"
-
+[ -d "$ccmioPACKAGE" ] || die "missing source directory '$ccmioPACKAGE'"
 
 #------------------------------------------------------------------------------
+CCMIO_SOURCE_DIR=$sourceBASE/$ccmioPACKAGE
 CCMIO_ARCH_PATH=$installBASE/$ccmioPACKAGE
 
 #
@@ -113,7 +112,7 @@ CCMIO_ARCH_PATH=$installBASE/$ccmioPACKAGE
 #
 echo "---------------"
 (
-    cd $ccmioPACKAGE || exit 1
+    cd $CCMIO_SOURCE_DIR || exit 1
     incDIR=$CCMIO_ARCH_PATH/include/libccmio
     libDIR=$CCMIO_ARCH_PATH/lib
 
@@ -135,5 +134,4 @@ echo "---------------"
     fi
 )
 
-
 #------------------------------------------------------------------------------
diff --git a/makeCGAL b/makeCGAL
index c8f6796a66e0b2b929501bd9c51dac9de9af2869..1d5178e333591dab387eec9572de1f0678ee00bf 100755
--- a/makeCGAL
+++ b/makeCGAL
@@ -35,13 +35,14 @@
 #         makeCGAL boost-system gmp-system
 #
 #------------------------------------------------------------------------------
-
 # Get CGAL, boost and gmp/mpfr versions
 . $WM_PROJECT_DIR/etc/config.sh/functions
-unset -f _foamAddPath _foamAddLib _foamAddMan # get settings only
+unset -f _foamAddPath _foamAddLib _foamAddMan   # get settings only
+unset BOOST_ARCH_PATH CGAL_ARCH_PATH            # purge current values
 
-_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL)
+# compiler first, let CGAL config override GMP (eg, when there is no GMP)
 _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler)
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL)
 
 boostPACKAGE=${boost_version:-boost-system}
 gmpPACKAGE=${gmp_version:-gmp-system}
@@ -59,7 +60,6 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 . etc/tools/ThirdPartyFunctions
 #------------------------------------------------------------------------------
 Script="${0##*/}"
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
@@ -67,7 +67,9 @@ usage() {
 
 usage: $Script [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERSION]
 options:
+  -cmake PATH       with cmake from the path given
   -gcc              force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
+  -no-lib           compile CGAL for use in headers only mode (since CGAL 4.9)
   -system           use system versions for boost/gmp/mpfr
   -help
 
@@ -82,15 +84,18 @@ To override this behaviour (and use the system boost and/or gmp/mpfr),
 simply specify a 'system' version. For example,
     $Script boost-system gmp-system
 
+Use gmp-none to disable use of gmp/mpfr (eg, not available)
+
 USAGE
     exit 1
 }
 #------------------------------------------------------------------------------
-
 # Ensure CMake gets the correct C/C++ compiler
 [ -n "$WM_CC" ]  && export CC="$WM_CCX"
 [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
+unset optHeadersOnly
+
 # Parse options
 while [ "$#" -gt 0 ]
 do
@@ -105,22 +110,33 @@ do
         export CC=gcc    # use gcc/g++
         export CXX=g++
         ;;
+    -cmake)
+        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
+        CMAKE_PATH="${2%%/}"
+        shift
+        ;;
     -sys*)
         gmpPACKAGE="gmp-system"
         mpfrPACKAGE="mpfr-system"
         boostPACKAGE="boost-system"
+        unset BOOST_ARCH_PATH           # avoid inconsistency
+        ;;
+    -no-lib)
+        optHeadersOnly=true
         ;;
-    gmp-[4-9]* | gmp-system)
+    gmp-[4-9]* | gmp-system | gmp-none)
         gmpPACKAGE="${1%%/}"
         ;;
-    mpfr-[2-9]* | mpfr-system)
+    mpfr-[2-9]* | mpfr-system | mpfr-none)
         mpfrPACKAGE="${1%%/}"
         ;;
     CGAL-[0-9]*)
         cgalPACKAGE="${1%%/}"
+        unset CGAL_ARCH_PATH            # avoid inconsistency
         ;;
     boost-[0-9]* | boost_[0-9]* | boost-system )
         boostPACKAGE="${1%%/}"
+        unset BOOST_ARCH_PATH           # avoid inconsistency
         ;;
     *)
         die "unknown option/argument: '$1'"
@@ -131,13 +147,13 @@ done
 
 [ -n "$cgalPACKAGE" ] || die "The cgal-VERSION was not specified"
 
-# nothing to build
-if _foamIsNone "$boostPACKAGE"
+# Nothing to build
+if _foamIsNone $boostPACKAGE
 then
     echo "Using boost-none (skip ThirdParty build of BOOST/CGAL)"
     exit 0
 fi
-if _foamIsNone "$cgalPACKAGE"
+if _foamIsNone $cgalPACKAGE
 then
     echo "Using cgal-none (skip ThirdParty build of CGAL)"
     exit 0
@@ -146,31 +162,37 @@ fi
 #------------------------------------------------------------------------------
 #
 # Build Boost
-# For 64-bit
-# - Third-Party builds into 'lib'
+# For 64-bit:
 # - system is normally built into 'lib64'
+# - use Third-Party 'lib64' for consistency.
+# Boost 1_62_0 and older normally build into 'lib'.
 #
+#   BOOST_ARCH_PATH  : installation directory
 #   BOOST_SOURCE_DIR : location of the original sources
 
-BOOST_ARCH_PATH=$installBASE/$boostPACKAGE
-BOOST_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$boostPACKAGE
+BOOST_SOURCE_DIR=$sourceBASE/$boostPACKAGE
+: ${BOOST_ARCH_PATH:=$installBASE/$boostPACKAGE}    # Fallback
 
-if [ -d "$BOOST_ARCH_PATH" ]
-then
-    boostInc="$BOOST_ARCH_PATH/include"
-    boostLib="$BOOST_ARCH_PATH/lib"
-elif _foamIsSystem $BOOST_ARCH_PATH
+boostInc="$BOOST_ARCH_PATH/include"
+boostLib="$BOOST_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
+
+if _foamIsSystem $boostPACKAGE
 then
     echo "Using boost-system (skip ThirdParty build of BOOST)"
 
-    boostInc="/usr/include"
-    boostLib="/usr/lib$WM_COMPILER_LIB_ARCH"
+    # Tagged as 'system' but could actually point to a central location
+    [ -d "$BOOST_ARCH_PATH/include" ] || {
+        boostInc="/usr/include"
+        boostLib="/usr/lib$WM_COMPILER_LIB_ARCH"
+    }
+
+elif [ -f "$boostInc/boost/version.hpp" ]
+then
+    echo "Using $boostPACKAGE"
 else
-    echo "Starting build: boost"
+    echo "Starting build: $boostPACKAGE"
     echo
-
-    boostInc="$BOOST_ARCH_PATH/include"
-    boostLib="$BOOST_ARCH_PATH/lib"
+    # Absolute path for --libdir
 
     (
         cd $BOOST_SOURCE_DIR || exit 1
@@ -179,6 +201,7 @@ else
 
         ./bootstrap.sh \
             --prefix=$BOOST_ARCH_PATH \
+            --libdir=$boostLib \
             --with-libraries=thread \
             --with-libraries=system \
         && ./bjam toolset=$WM_CC -j $WM_NCOMPPROCS install \
@@ -190,7 +213,7 @@ else
 fi
 
 # nothing left to build
-if _foamIsSystem "$cgalPACKAGE"
+if _foamIsSystem $cgalPACKAGE
 then
     echo "Using cgal-system (skip ThirdParty build of CGAL)"
     exit 0
@@ -225,26 +248,37 @@ SUMMARY
 #------------------------------------------------------------------------------
 #
 # Build CGAL
-# For 64-bit
-# - Third-Party builds into 'lib'
+# For 64-bit:
 # - system is normally built into 'lib64'
+# - 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_BINARY_DIR : location of the build
-#   CGAL_DIR        : location of the installed program
+#   CGAL_ARCH_PATH  : installation directory
 
-CGAL_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$cgalPACKAGE
+CGAL_SOURCE_DIR=$sourceBASE/$cgalPACKAGE
 CGAL_BINARY_DIR=$buildBASE/$cgalPACKAGE
-CGAL_ARCH_PATH=$installBASE/$cgalPACKAGE
-CGAL_DIR=$CGAL_ARCH_PATH
+: ${CGAL_ARCH_PATH:=$installBASE/$cgalPACKAGE}      # Fallback
 
-#
-# gmp/mpfr installed without compiler name
+# gmp/mpfr are installed without compiler name
 installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
 
 GMP_ARCH_PATH=$installBASE/$gmpPACKAGE
 MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
 
+# Enable/disable gmp/mpfr together
+if _foamIsNone $gmpPACKAGE || _foamIsNone $mpfrPACKAGE
+then
+    GMP_ARCH_PATH=none
+    MPFR_ARCH_PATH=none
+elif _foamIsSystem $GMP_ARCH_PATH || _foamIsSystem $MPFR_ARCH_PATH
+then
+    GMP_ARCH_PATH=system    # for an accurate record
+    MPFR_ARCH_PATH=system
+fi
+
+
 #
 # build information recorded for later use
 #
@@ -255,12 +289,18 @@ recordCGALinfo()
     CGAL_VERSION=$(sed -ne 's/^ *# *define *CGAL_VERSION_NR *\([0-9][0-9]*\).*$/\1/p' $CGAL_ARCH_PATH/include/CGAL/version.h 2>/dev/null)
 
     cat<<BUILD_INFO > $buildInfoFile
+# Information from OpenFOAM build on '$(date)'
+#
 CGAL=${CGAL_ARCH_PATH##*/}
 BOOST=${BOOST_ARCH_PATH##*/}
 GMP=${GMP_ARCH_PATH##*/}
 MPFR=${MPFR_ARCH_PATH##*/}
 CGAL_VERSION=$CGAL_VERSION
 BOOST_VERSION=$BOOST_VERSION
+
+CGAL_lib=lib$WM_COMPILER_LIB_ARCH
+BOOST_lib=lib$WM_COMPILER_LIB_ARCH
+CGAL_HEADER_ONLY=${optHeadersOnly:-false}
 BUILD_INFO
 }
 
@@ -287,6 +327,8 @@ cgalIsCurrent()
     local info=$(cat $buildInfoFile 2>/dev/null)
     [ -n "$info" ] || return 1
 
+    local libDirName="lib$WM_COMPILER_LIB_ARCH"
+
     echo "checking information from existing build ..."
     echo "  ${CGAL_ARCH_PATH}"
 
@@ -295,10 +337,13 @@ cgalIsCurrent()
     infoValueEq GMP   "${GMP_ARCH_PATH##*/}"      "$info" || return 1
     infoValueEq MPFR  "${MPFR_ARCH_PATH##*/}"     "$info" || return 1
     infoValueEq BOOST_VERSION "${BOOST_VERSION}"  "$info" || return 1
+    infoValueEq CGAL_lib  "$libDirName"           "$info" || return 1
+    infoValueEq BOOST_lib "$libDirName"           "$info" || return 1
 
     return 0
 }
 
+
 if cgalIsCurrent
 then
     echo "    ${CGAL_ARCH_PATH##*/} build appears to be up-to-date - skipping"
@@ -323,10 +368,21 @@ fi
     echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION"
     echo "    Source         : $CGAL_SOURCE_DIR"
     echo "    Build          : $CGAL_BINARY_DIR"
-    echo "    Target         : $CGAL_DIR"
+    echo "    Target         : $CGAL_ARCH_PATH"
 
 
-    if [ -d "$BOOST_ARCH_PATH" ]
+    # See http://doc.cgal.org/latest/Manual/installation.html
+    if _foamIsSystem $boostPACKAGE
+    then
+        echo "    system         : boost"
+        # Tagged as 'system' but could actually point to a central location
+        if [ -d "$BOOST_ARCH_PATH/include" ]
+        then
+            configBoost="-DBOOST_ROOT=$BOOST_ARCH_PATH"
+        fi
+        ## For system - possible that /usr/lib64 not being found?
+        ## configBoost="-DBoost_LIBRARY_DIRS=$boostLib"
+    elif [ -d "$BOOST_ARCH_PATH" ]
     then
         echo "    ThirdParty     : boost"
         configBoost=$(cat <<CMAKE_OPTIONS
@@ -338,16 +394,17 @@ fi
  -DBoost_SYSTEM_LIBRARY_RELEASE=$boostLib/libboost_system.so
  -DBoost_VERSION=$BOOST_VERSION
 CMAKE_OPTIONS
-)
-    else
-        echo "    system         : boost"
-        configBoost=$(cat <<CMAKE_OPTIONS
- -DBOOST_LIBRARYDIR=$boostLib
-CMAKE_OPTIONS
 )
     fi
 
-    if [ -d "$GMP_ARCH_PATH" ]
+    if _foamIsSystem $GMP_ARCH_PATH
+    then
+        echo "    system         : gmp"
+    elif _foamIsNone $GMP_ARCH_PATH
+    then
+        echo "    disabled       : gmp"
+        configGmp="-DCGAL_DISABLE_GMP:BOOL=TRUE"  # Also used for mpfr
+    elif [ -d "$GMP_ARCH_PATH" ]
     then
         echo "    ThirdParty     : gmp"
         configGmp=$(cat <<CMAKE_OPTIONS
@@ -359,10 +416,17 @@ CMAKE_OPTIONS
 CMAKE_OPTIONS
 )
     else
-        echo "    system         : gmp"
+        echo "    system         : gmp (did not find $GMP_ARCH_PATH)"
     fi
 
-    if [ -d "$MPFR_ARCH_PATH" ]
+    if _foamIsSystem $MPFR_ARCH_PATH
+    then
+        echo "    system         : mpfr"
+    elif _foamIsNone $MPFR_ARCH_PATH
+    then
+        echo "    disabled       : mpfr"
+        configGmp="-DCGAL_DISABLE_GMP:BOOL=TRUE"  # Also used for mpfr
+    elif [ -d "$MPFR_ARCH_PATH" ]
     then
         echo "    ThirdParty     : mpfr"
         configMpfr=$(cat <<CMAKE_OPTIONS
@@ -372,19 +436,26 @@ CMAKE_OPTIONS
 CMAKE_OPTIONS
 )
     else
-        echo "    system         : mpfr"
+        echo "    system         : mpfr (did not find $MPFR_ARCH_PATH)"
     fi
 
+    cmake=$(findCMake)
+
+    # For CGAL < 4.9, for installation into lib64/, not lib/
+    # Name only (not path) for CGAL_INSTALL_LIB_DIR
     echo "----"
     set -x
-    cmake \
+    $cmake \
         -DCMAKE_INSTALL_PREFIX=$CGAL_ARCH_PATH \
+        -DCGAL_INSTALL_LIB_DIR=lib$WM_COMPILER_LIB_ARCH \
         -DCMAKE_BUILD_TYPE=Release \
         -DWITH_CGAL_Qt5=OFF \
+        ${optHeadersOnly:+-DCGAL_HEADER_ONLY=TRUE} \
         $configBoost $configGmp $configMpfr \
         $CGAL_SOURCE_DIR \
     && make -j $WM_NCOMPPROCS \
     && make install || exit 1
+    set +x
 
     echo "----"
     echo "create '\$CGAL_ARCH_PATH/share/files'"
diff --git a/makeCmake b/makeCmake
index bdd906c99460e968e4f57e81a8106859e0c2649b..b60bef542174c0ebd30b3b4548987a85af5e9d93 100755
--- a/makeCmake
+++ b/makeCmake
@@ -29,11 +29,11 @@
 #     Build script for cmake
 #
 #------------------------------------------------------------------------------
-# Special purpose script, no default cmake version.
+# Special purpose script, no default version.
 unset cmakePACKAGE
 
 #------------------------------------------------------------------------------
-# run from third-party directory only
+# Run from third-party directory only
 wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
     echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
     echo "    The environment variables are inconsistent with the installation."
@@ -42,13 +42,12 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 }
 . etc/tools/ThirdPartyFunctions
 #------------------------------------------------------------------------------
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 
-usage: ${0##*/} [OPTION] [cmake-VERSION]
+usage: ${0##*/} [OPTION] cmake-VERSION
 options:
   -gcc              Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
   -help
@@ -60,12 +59,11 @@ USAGE
     exit 1
 }
 #------------------------------------------------------------------------------
-
-# ensure CMake gets the correct C/CC++ compiler
+# Ensure CMake gets the correct C/CC++ compiler
 [ -n "$WM_CC" ]  && export CC="$WM_CC"
 [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
-# parse options
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
@@ -89,36 +87,38 @@ done
 [ -n "$cmakePACKAGE" ] || die "The cmake-VERSION was not specified"
 
 #------------------------------------------------------------------------------
-CMAKE_ARCH_PATH=$installBASE/$cmakePACKAGE
-
 #
 # Build CMAKE
-#
-echo "---------------"
+#   CMAKE_SOURCE_DIR : location of the original sources
+#   CMAKE_ARCH_PATH  : installation directory
+
+CMAKE_SOURCE_DIR=$sourceBASE/$cmakePACKAGE
+CMAKE_ARCH_PATH=$installBASE/$cmakePACKAGE
+
 if [ -d "$CMAKE_ARCH_PATH" -a -r "$CMAKE_ARCH_PATH/bin/cmake" ]
 then
     echo "Already built: $cmakePACKAGE"
 else
     echo "Starting build: $cmakePACKAGE"
-(
-    sourceDIR=$WM_THIRD_PARTY_DIR/$cmakePACKAGE
-    buildDIR=$buildBASE/$cmakePACKAGE
+    (
+        buildDIR=$buildBASE/$cmakePACKAGE
 
-    cd $sourceDIR || exit 1
-    make distclean 2>/dev/null
+        cd $CMAKE_SOURCE_DIR || exit 1
+        make distclean 2>/dev/null
 
-    rm -rf $buildDIR
-    mkdir -p $buildDIR
-    cd $buildDIR
+        rm -rf $buildDIR
+        mkdir -p $buildDIR
+        cd $buildDIR
 
-    $sourceDIR/bootstrap --prefix=$CMAKE_ARCH_PATH \
-    && time make -j $WM_NCOMPPROCS \
-    && make install \
-    && echo "Built: $cmakePACKAGE"
-) || {
-    echo "Error building: $cmakePACKAGE"
-    exit 1
-}
+        $CMAKE_SOURCE_DIR/bootstrap \
+            --prefix=$CMAKE_ARCH_PATH \
+        && time make -j $WM_NCOMPPROCS \
+        && make install \
+        && echo "Built: $cmakePACKAGE"
+    ) || {
+        echo "Error building: $cmakePACKAGE"
+        exit 1
+    }
 fi
 
 #------------------------------------------------------------------------------
diff --git a/makeFFTW b/makeFFTW
index 07e46d38d46d938a857f594f3d09738df027dd70..27647e20850f4d2b207dfe7408b537fdff658ff7 100755
--- a/makeFFTW
+++ b/makeFFTW
@@ -29,7 +29,6 @@
 #     Build script for FFTW
 #
 #------------------------------------------------------------------------------
-
 # Get FFTW versions
 . $WM_PROJECT_DIR/etc/config.sh/functions
 unset -f _foamAddPath _foamAddLib _foamAddMan # get settings only
@@ -48,14 +47,12 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 }
 . etc/tools/ThirdPartyFunctions
 #------------------------------------------------------------------------------
-Script="${0##*/}"
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 
-usage: $Script [OPTION] [fftw-VERSION]
+usage: ${0##*/} [OPTION] [fftw-VERSION]
 options:
   -gcc              Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
   -help
@@ -67,8 +64,7 @@ USAGE
     exit 1
 }
 #------------------------------------------------------------------------------
-
-# ensure configure gets the correct C/C++ compiler
+# Ensure configure gets the correct C/C++ compiler
 [ -n "$WM_CC" ]  && export CC="$WM_CC"
 [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
@@ -98,14 +94,12 @@ done
 
 [ -n "$fftwPACKAGE" ] || die "The fftw-VERSION was not specified"
 
-# nothing to build
+# Nothing to build
 if _foamIsNone "$fftwPACKAGE"
 then
     echo "Using fftw-none (skip ThirdParty build of FFTW)"
     exit 0
-fi
-
-if _foamIsSystem "$fftwPACKAGE"
+elif _foamIsSystem "$fftwPACKAGE"
 then
     echo "Using fftw-system (skip ThirdParty build of FFTW)"
     exit 0
@@ -121,9 +115,10 @@ fi
 # - system is normally built into 'lib64'
 #
 #   FFTW_SOURCE_DIR : location of the original sources
+#   FFTW_ARCH_PATH  : installation directory
 
+FFTW_SOURCE_DIR=$sourceBASE/$fftwPACKAGE
 FFTW_ARCH_PATH=$installBASE/$fftwPACKAGE
-FFTW_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$fftwPACKAGE
 
 if [ -r "$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libfftw3.so" ]
 then
@@ -169,5 +164,4 @@ else
     }
 fi
 
-
 #------------------------------------------------------------------------------
diff --git a/makeGcc b/makeGcc
index a4223e21bb336fd926608b3e1f717ac73ee8e3bb..b5f10ae0f1227d9537fa0a2be58f3bb9bf88c5bc 100755
--- a/makeGcc
+++ b/makeGcc
@@ -88,8 +88,7 @@ USAGE
     exit 1
 }
 #------------------------------------------------------------------------------
-
-# build 32-bit libraries on 64-bit systems (normally not needed)
+# Build 32-bit libraries on 64-bit systems (normally not needed)
 optMultilib=disable
 unset optThreadSafe # unset=auto
 
@@ -181,7 +180,7 @@ else
     echo "Starting build: $gmpPACKAGE"
     echo
 (
-    sourceDIR=$WM_THIRD_PARTY_DIR/$gmpPACKAGE
+    sourceDIR=$sourceBASE/$gmpPACKAGE
     buildDIR=$buildBASE/$gmpPACKAGE
 
     cd $sourceDIR || exit 1
@@ -233,7 +232,7 @@ else
     echo "Starting build: $mpfrPACKAGE"
     echo
 (
-    sourceDIR=$WM_THIRD_PARTY_DIR/$mpfrPACKAGE
+    sourceDIR=$sourceBASE/$mpfrPACKAGE
     buildDIR=$buildBASE/$mpfrPACKAGE
 
     cd $sourceDIR || exit 1
@@ -289,7 +288,7 @@ else
     echo "Starting build: $mpcPACKAGE"
     echo
 (
-    sourceDIR=$WM_THIRD_PARTY_DIR/$mpcPACKAGE
+    sourceDIR=$sourceBASE/$mpcPACKAGE
     buildDIR=$buildBASE/$mpcPACKAGE
 
     cd $sourceDIR || exit 1
@@ -345,7 +344,7 @@ else
     echo "Starting build: $gccPACKAGE"
     echo
 (
-    sourceDIR=$WM_THIRD_PARTY_DIR/$gccPACKAGE
+    sourceDIR=$sourceBASE/$gccPACKAGE
     buildDIR=$buildBASE/$gccPACKAGE
 
     cd $sourceDIR || exit 1
diff --git a/makeGperftools b/makeGperftools
index 31bf03673d611b8f502840d2634f4cddd3f8b933..e12efd576ce44a904330b2fa1840a4891541f62c 100755
--- a/makeGperftools
+++ b/makeGperftools
@@ -4,7 +4,7 @@
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
-#    \\/     M anipulation  |
+#    \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
@@ -28,14 +28,17 @@
 # Description
 #     Build script for gperftools
 #
-# Note
-#
 #------------------------------------------------------------------------------
+# Get gperftools version
+. $WM_PROJECT_DIR/etc/config.sh/functions
+unset -f _foamAddPath _foamAddLib _foamAddMan # get settings only
+
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools)
 
-gperftoolsPACKAGE=gperftools-svn
+gperftoolsPACKAGE=${gperftools_version:-gperftools-system}
 
 #------------------------------------------------------------------------------
-# run from third-party directory only
+# Run from third-party directory only
 wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
     echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
     echo "    The environment variables are inconsistent with the installation."
@@ -44,13 +47,15 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 }
 . etc/tools/ThirdPartyFunctions
 #------------------------------------------------------------------------------
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 
 usage: ${0##*/} [gperftools-VERSION]
+options:
+  -gcc              Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
+  -help
 
 * build gperftools
       $gperftoolsPACKAGE
@@ -58,16 +63,23 @@ usage: ${0##*/} [gperftools-VERSION]
 USAGE
     exit 1
 }
+#------------------------------------------------------------------------------
+# Ensure configure gets the correct C/C++ compiler
+[ -n "$WM_CC" ]  && export CC="$WM_CC"
+[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
-
-# parse options
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
     -h | -help)
         usage
         ;;
-    gperftools-[0-9]* | gperftools-svn*)
+    -gcc)
+        export CC=gcc    # use gcc/g++
+        export CXX=g++
+        ;;
+    gperftools-[0-9]* | gperftools-svn* | gperftools-git)
         gperftoolsPACKAGE="${1%%/}"
         ;;
     *)
@@ -77,42 +89,54 @@ do
     shift
 done
 
-#------------------------------------------------------------------------------
-# build/install without compiler name
-prefixDIR=$installBASE/$gperftoolsPACKAGE
+[ -n "$gperftoolsPACKAGE" ] || die "The gperftools-VERSION was not specified"
 
+# Nothing to build
+if _foamIsNone $gperftoolsPACKAGE
+then
+    echo "Using gperftools-none (skip ThirdParty build of gperftools)"
+    exit 0
+elif _foamIsSystem $gperftoolsPACKAGE
+then
+    echo "Using gperftools-system (skip ThirdParty build of gperftools)"
+    exit 0
+fi
+
+#------------------------------------------------------------------------------
 #
 # Build gperftools
 #
+GPERFTOOLS_SOURCE_DIR=$sourceBASE/$gperftoolsPACKAGE
+GPERFTOOLS_ARCH_PATH=$installBASE/$gperftoolsPACKAGE
+
 echo "---------------"
-if [ -d "$prefixDIR" ]
+if [ -d "$GPERFTOOLS_ARCH_PATH" ]
 then
     echo "Already built: $gperftoolsPACKAGE"
 else
     echo "Starting build: $gperftoolsPACKAGE"
-(
-    sourceDIR=$WM_THIRD_PARTY_DIR/$gperftoolsPACKAGE
-    buildDIR=$buildBASE/$gperftoolsPACKAGE
-
-    cd $sourceDIR || exit 1
-    make distclean 2>/dev/null
-
-    rm -rf $buildDIR
-    mkdir -p $buildDIR
-    cd $buildDIR
-
-    # remove old junk
-    rm -rf $prefixDIR
-
-    $sourceDIR/configure \
-        --prefix=$prefixDIR \
-    && make -j $WM_NCOMPPROCS \
-    && make install \
-    && echo "Built: $gperftoolsPACKAGE" \
-) || {
-    echo "Error building: $gperftoolsPACKAGE"
-    exit 1
-}
+    (
+        buildDIR=$buildBASE/$gperftoolsPACKAGE
+
+        cd $GPERFTOOLS_SOURCE_DIR || exit 1
+
+        make distclean 2>/dev/null
+
+        rm -rf $GPERFTOOLS_ARCH_PATH
+        rm -rf $buildDIR
+        mkdir -p $buildDIR
+        cd $buildDIR
+
+        set -x
+        $GPERFTOOLS_SOURCE_DIR/configure \
+            --prefix=$GPERFTOOLS_ARCH_PATH \
+        && make -j $WM_NCOMPPROCS \
+        && make install \
+        && echo "Built: $gperftoolsPACKAGE" \
+    ) || {
+        echo "Error building: $gperftoolsPACKAGE"
+        exit 1
+    }
 fi
 
 #------------------------------------------------------------------------------
diff --git a/makeLLVM b/makeLLVM
index 33c0e0b75760ceb036739f645ccefef5474813cf..ede1394fc1904d9c479ddeace1d651a8fa9780bc 100755
--- a/makeLLVM
+++ b/makeLLVM
@@ -51,8 +51,8 @@
 #        mv cfe-3.8.0.src  llvm-3.8.0/tools/clang
 #
 #------------------------------------------------------------------------------
-# get default llvm/clang version
-WM_COMPILER_TYPE="ThirdParty"     # ensure we get the correct compiler settings
+# Get default llvm/clang version
+WM_COMPILER_TYPE=ThirdParty       # ensure we get the correct compiler settings
 WM_COMPILER=Clang                 # force values for 'clang'
 
 . $WM_PROJECT_DIR/etc/config.sh/functions
@@ -70,15 +70,15 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 }
 . etc/tools/ThirdPartyFunctions
 #------------------------------------------------------------------------------
-Script=${0##*/}
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 
-usage: $Script [OPTION] [llvm-VERSION]
+usage: ${0##*/} [OPTION] [llvm-VERSION]
 options:
+  -cmake PATH       with cmake from the path given
+  -gcc              force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
   -help
 
 * build llvm/clang
@@ -87,16 +87,27 @@ options:
 USAGE
     exit 1
 }
-
 #-----------------------------------------------------------------------------
+# Ensure CMake gets the correct C/C++ compiler
+[ -n "$WM_CC" ]  && export CC="$WM_CCX"
+[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
-# parse options
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
     -h | -help)
         usage
         ;;
+    -gcc)
+        export CC=gcc    # use gcc/g++
+        export CXX=g++
+        ;;
+    -cmake)
+        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
+        CMAKE_PATH="${2%%/}"
+        shift
+        ;;
     llvm-[0-9]* | llvm-svn*)
         llvmPACKAGE="${1%%/}"
         ;;
@@ -110,20 +121,19 @@ done
 [ -n "$llvmPACKAGE" ] || die "The llvm-VERSION was not specified"
 
 #------------------------------------------------------------------------------
-# build/install without compiler name
+# Build/install locations without a compiler name
 buildBASE=$WM_THIRD_PARTY_DIR/build/$WM_ARCH$WM_COMPILER_ARCH
 installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
 
-LLVM_ARCH_PATH=$installBASE/$llvmPACKAGE
+# Build LLVM (clang)
+#   LLVM_SOURCE_DIR : location of the original sources
+#   LLVM_BINARY_DIR : location of the build
+#   LLVM_ARCH_PATH  : location of the installed program
+# - Strip any trailing '.src' from the proper names
 
-# name of source directory
-# - may have a llvm/ subdirectory, depending on how the sources were fetched
-#
-sourceDIR=$WM_THIRD_PARTY_DIR/$llvmPACKAGE
-if [ -f $sourceDIR/llvm/configure ]
-then
-    sourceDIR=$sourceDIR/llvm
-fi
+LLVM_SOURCE_DIR=$sourceBASE/$llvmPACKAGE
+LLVM_BINARY_DIR=$buildBASE/${llvmPACKAGE%%.src}
+LLVM_ARCH_PATH=$installBASE/${llvmPACKAGE%%.src}
 
 #
 # Build LLVM
@@ -132,31 +142,63 @@ echo "---------------"
 if [ -d $LLVM_ARCH_PATH ]
 then
     echo "Already built: $llvmPACKAGE"
+elif [ -z "$CMAKE_PATH" ] && $LLVM_SOURCE_DIR/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
+    (
+        cd $LLVM_SOURCE_DIR || exit 1
+        make distclean 2>/dev/null
+
+        rm -rf $LLVM_BINARY_DIR
+        mkdir -p $LLVM_BINARY_DIR
+        cd $LLVM_BINARY_DIR
+
+        set -x
+        $LLVM_SOURCE_DIR/configure \
+            --prefix=$LLVM_ARCH_PATH \
+            --with-gcc-toolchain=$(which gcc | sed s%/bin/gcc%%) \
+            --enable-optimized \
+            --enable-shared \
+        && make -j $WM_NCOMPPROCS \
+        && make install \
+        && echo "Built: $llvmPACKAGE"
+    ) || {
+        echo "Error building: $llvmPACKAGE"
+        exit 1
+    }
+
 else
-    echo "Starting build: $llvmPACKAGE"
+    # CMake used with 3.9.0 and later
+
+    echo "Starting build: $llvmPACKAGE (using cmake)"
     echo
-(
-    cd $sourceDIR || exit 1
-    make distclean 2>/dev/null
-
-    buildDIR=$buildBASE/$llvmPACKAGE
-    rm -rf $buildDIR
-    mkdir -p $buildDIR
-    cd $buildDIR
-
-    set -x
-    $sourceDIR/configure \
-        --prefix=$LLVM_ARCH_PATH \
-        --with-gcc-toolchain=$(which gcc | sed s%/bin/gcc%%) \
-        --enable-optimized \
-        --enable-shared \
-    && make -j $WM_NCOMPPROCS \
-    && make install \
-    && echo "Built: $llvmPACKAGE"
-) || {
-    echo "Error building: $llvmPACKAGE"
-    exit 1
-}
+    (
+        cd $LLVM_SOURCE_DIR || exit 1
+
+        rm -rf $LLVM_BINARY_DIR
+        mkdir -p $LLVM_BINARY_DIR
+        cd $LLVM_BINARY_DIR
+
+        cmake=$(findCMake)
+
+        set -x
+        $cmake \
+            -DCMAKE_INSTALL_PREFIX=$LLVM_ARCH_PATH \
+            -DCMAKE_BUILD_TYPE=Release \
+            -DBUILD_SHARED_LIBS:BOOL=ON \
+            $LLVM_SOURCE_DIR \
+        && make -j $WM_NCOMPPROCS \
+        && make install \
+        && echo "Built: $llvmPACKAGE"
+    ) || {
+        echo "Error building: $llvmPACKAGE"
+        exit 1
+    }
+
 fi
 
 #------------------------------------------------------------------------------
diff --git a/makeMesa b/makeMesa
index f48ecb96c3a7c7ef19b10e74e4f52e6eef777323..c1befd4b472860781f37e24a5ff146b705b66917 100755
--- a/makeMesa
+++ b/makeMesa
@@ -29,14 +29,17 @@
 #     Build script for Mesa
 #
 # Note
-#     Building with mesa-12.0.1 failed to install an "osmesa.h" file,
-#     which renders it useless for off-screen VTK.
+#     Building with mesa-12.x.x fails to create an include/GL directory and
+#     an "osmesa.h" file. Both make it fairly useless for off-screen VTK.
+#
+#     Building with mesa-11.x is fine and mesa-13.x also seems to be okay.
 #
 #------------------------------------------------------------------------------
-mesaPACKAGE=mesa-11.2.2
+# Special purpose script, no default version.
+unset mesaPACKAGE
 
 #------------------------------------------------------------------------------
-# run from third-party directory only
+# Run from third-party directory only
 cd ${0%/*} || exit 1
 wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
     echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
@@ -46,16 +49,14 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 }
 . etc/tools/ThirdPartyFunctions
 #------------------------------------------------------------------------------
-Script=${0##*/}
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 
-usage: $Script [OPTION] [mesa-VERSION]
+usage: ${0##*/} [OPTION] mesa-VERSION
 options:
-  -gcc              force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
+  -gcc              Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
   -help
 
 * build Mesa with
@@ -65,8 +66,7 @@ USAGE
     exit 1
 }
 #------------------------------------------------------------------------------
-
-# ensure configure gets the correct C/C++ compiler
+# Ensure configure gets the correct C/C++ compiler
 [ -n "$WM_CC" ]  && export CC="$WM_CC"
 [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
@@ -77,7 +77,7 @@ then
     thirdPartyClang=true
 fi
 
-# parse options
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
@@ -101,21 +101,19 @@ done
 
 [ -n "$mesaPACKAGE" ] || die "The mesa-VERSION was not specified"
 
-# nothing to build
+# Nothing to build
 if _foamIsNone "$mesaPACKAGE"
 then
     echo "Using mesa-none (skip ThirdParty build of MESA)"
     exit 0
-fi
-
-if _foamIsSystem "$mesaPACKAGE"
+elif _foamIsSystem "$mesaPACKAGE"
 then
     echo "Using mesa-system (skip ThirdParty build of MESA)"
     exit 0
 fi
 
 #------------------------------------------------------------------------------
-# locate third-party clang as required
+# Locate third-party clang as required
 if [ "$thirdPartyClang" = true ]
 then
     thirdPartyClang=$(command -v clang) || {
@@ -139,9 +137,10 @@ fi
 # - MESA itself will normally build into 'lib64'.
 #
 #   MESA_SOURCE_DIR : location of the original sources
+#   MESA_ARCH_DIR   : installation directory
 
+MESA_SOURCE_DIR=$sourceBASE/$mesaPACKAGE
 MESA_ARCH_PATH=$installBASE/$mesaPACKAGE
-MESA_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$mesaPACKAGE
 
 (
     # configuration options:
diff --git a/makeParaView b/makeParaView
index 3164fdef47347931b9c57145fb9d45002a2aeb62..2ca6ebf75765c87e91084b77d6b12106691aa43c 100755
--- a/makeParaView
+++ b/makeParaView
@@ -26,17 +26,21 @@
 #     makeParaView
 #
 # Description
-#     Make and install paraview 4 or 5
-#     - place the paraview source under $WM_THIRD_PARTY_DIR/ParaView-VERSION
-#       (note capitalisation)
+#     Make and install ParaView 4 or 5.
+#     The ParaView sources should be located under one of these locations:
+#       - $WM_THIRD_PARTY_DIR/ParaView-VERSION
+#       - $WM_THIRD_PARTY_DIR/ParaView-vVERSION
+#
+#     Note the capitalization of ParaView in the directory names.
 #
 #------------------------------------------------------------------------------
-# Get ParaView_DIR location from OpenFOAM config file
+# Get ParaView_VERSION location from OpenFOAM config file
 . $WM_PROJECT_DIR/etc/config.sh/functions
+unset -f _foamAddPath _foamAddLib               # get settings only
+unset ParaView_VERSION                          # purge current values
+
 _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview)
 
-# Determine ParaView_VERSION from ParaView_DIR location:
-ParaView_VERSION="${ParaView_DIR##*/}"; export ParaView_VERSION
 : ${ParaView_VERSION##*-}
 
 #------------------------------------------------------------------------------
@@ -90,7 +94,6 @@ withGL2=auto
 #
 #-----------------------------------------------------------------------------
 Script=${0##*/}
-
 usage() {
     : ${ParaView_VERSION:=none} # some dummy value for usage information
     exec 1>&2
@@ -106,7 +109,7 @@ options:
   -mpi=NPROCS       with mpi and max 'NPROCS' processes. NPROCS=0 for no
                         upper-limit on processes.
   -python           with python (if not already enabled)
-  -cmake PATH       with the cmake version corresponding to the cmake path given
+  -cmake PATH       with cmake from the path given
   -qmake PATH       with the Qt version corresponding to the qmake path given
   -qt               with extra Qt gui support (if not already enabled)
   -qt-VER           with Qt version corresponding to
@@ -151,15 +154,13 @@ Or change the \$WM_PROJECT_DIR/etc/config.sh/paraview settings.
 USAGE
     exit 1
 }
-
 #------------------------------------------------------------------------------
-
-# ensure CMake gets the correct C/C++ compiler
+# Ensure CMake gets the correct C/C++ compiler
 [ -n "$WM_CC" ]  && export CC="$WM_CC"
 [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
 #
-# add options based on script name:
+# Add options based on script name:
 #
 case "$Script" in *-mesa*)   withMESA=true;; esac
 case "$Script" in *-mpi*)    withMPI=true;; esac
@@ -170,13 +171,13 @@ case "$Script" in *-qt*)     withQT=true;; esac
 setParaViewVersion ${ParaView_VERSION:-none}
 
 #
-# various building stages
+# Various building stages
 #
 unset runPATCH runCONFIG runMAKE runINSTALL
 runDEFAULT=true
 buildType=Release
 
-# parse options
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
@@ -380,10 +381,9 @@ Features selected
 ---------------------
 Version information
     qt        ${QtVersion:-none}
-    version   ${ParaView_VERSION:-unknown}
+    version   ${ParaView_VERSION:-unknown} $(checkVersion)
     major     ${ParaView_MAJOR:-unknown}
     build     ${buildType:-Release}
-$(checkVersion)
 ---------------------
 SUMMARY
 
diff --git a/makeParaView.example b/makeParaView.example
index 361b69c44f3dd4d4d90f7c20438bbea312c42aa3..5fe489e5a8e0d86aee08e759c02ab8be6d2f456c 100755
--- a/makeParaView.example
+++ b/makeParaView.example
@@ -4,6 +4,7 @@
 # - off-screen mesa
 
 mesa=mesa-11.2.2
+# mesa=mesa-13.0.2
 
 ./makeParaView \
     -mpi=0 \
diff --git a/makeParaView3 b/makeParaView3
deleted file mode 100755
index 6d86c099f1dc2fe842a3d5ca987252503da02d28..0000000000000000000000000000000000000000
--- a/makeParaView3
+++ /dev/null
@@ -1,341 +0,0 @@
-#!/bin/sh
-#------------------------------------------------------------------------------
-# =========                 |
-# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-#  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-#    \\/     M anipulation  | Copyright (C) 2016 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/>.
-#
-# Script
-#     makeParaView3
-#
-# Description
-#     Make and install paraview for version 3.14.1 and higher
-#     - place the paraview source under $WM_THIRD_PARTY_DIR/ParaView-VERSION
-#       (note capitalisation)
-#
-#------------------------------------------------------------------------------
-# Get ParaView_DIR location from OpenFOAM config file
-. $WM_PROJECT_DIR/etc/config.sh/functions
-_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview)
-
-# Determine ParaView_VERSION from ParaView_DIR location:
-ParaView_VERSION="${ParaView_DIR##*/}"; export ParaView_VERSION
-: ${ParaView_VERSION##*-}
-
-#------------------------------------------------------------------------------
-# Run from third-party directory only
-cd ${0%/*} || exit 1
-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
-. etc/tools/ParaView3Functions
-#------------------------------------------------------------------------------
-#
-# USER OPTIONS:
-# ~~~~~~~~~~~~~
-
-# MPI support:
-withMPI=false
-MPI_MAX_PROCS=32
-
-# Python support:
-# note: script will try to determine the appropriate python library.
-#       If it fails, specify the path using the PYTHON_LIBRARY variable
-withPYTHON=false
-PYTHON_LIBRARY=""
-# PYTHON_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libpython2.6.so.1.0"
-
-# MESA graphics support:
-withMESA=false
-MESA_INCLUDE="/usr/include/GL"
-MESA_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so"
-
-# extra QT gui support (useful for some third party apps)
-withQT=true
-
-# Set the path to the Qt-4.5 (or later) qmake if the system Qt is older
-QMAKE_PATH=""
-
-# Set the path to cmake
-CMAKE_PATH=""
-
-#
-# NO FURTHER EDITING BELOW THIS LINE
-#
-#-----------------------------------------------------------------------------
-Script=${0##*/}
-
-usage() {
-    : ${ParaView_VERSION:=none} # some dummy value for usage information
-    exec 1>&2
-    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
-    cat<<USAGE
-
-usage: $Script [OPTION] [paraview-VERSION] [CMAKE-OPTION]
-options:
-  -rebuild          for repeated builds (-make -install) *use with caution*
-  -mesa             with mesa (if not already enabled)
-  -mpi              with mpi (if not already enabled)
-  -python           with python (if not already enabled)
-  -cmake PATH       with the cmake version corresponding to the cmake path given
-  -qmake PATH       with the Qt version corresponding to the qmake path given
-  -qt               with extra Qt gui support (if not already enabled)
-  -qt-VER           with Qt version corresponding to
-                        \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-VER/bin/qmake
-  -gcc              force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
-  -verbose          verbose output in Makefiles
-  -version VER      specify an alternative version (current value: $ParaView_VERSION)
-  -major   VER      specify an alternative major version for special builds
-  -mesa-include DIR location of mesa headers (current value: ${MESA_INCLUDE:-none})
-  -mesa-lib PATH    path to mesa library     (current value: ${MESA_LIBRARY:-none})
-  -python-lib PATH  path to python library   (current value: ${PYTHON_LIBRARY:-none})
-  -help
-
-The -no-FEATURE option can be used to forcibly disable these features:
-  mesa mpi python qt
-
-CMake options start with a capital letter and contain an '='.
-For example,
-    $Script BUILD_TESTING=ON PARAVIEW_GENERATE_PROXY_DOCUMENTATION=OFF
-to add tests and avoid building documentation
-
-For finer control, the build stages can be selected or deselected individually:
-  -config    -no-config
-  -make      -no-make
-  -install   -no-install
-
-
-* Make and install paraview-$ParaView_VERSION located under
-      \$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
-  ->  \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION
-
-To make a different paraview version, simply specify on the command-line.
-For example,
-
-    ./makeParaview 3.14.1
-
-Or change the \$WM_PROJECT_DIR/etc/config.sh/paraview settings.
-
-USAGE
-    exit 1
-}
-
-#------------------------------------------------------------------------------
-
-# ensure CMake gets the correct C/C++ compiler
-[ -n "$WM_CC" ]  && export CC="$WM_CC"
-[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
-
-#
-# add options based on script name:
-#
-case "$Script" in *-mesa*)   withMESA=true;; esac
-case "$Script" in *-mpi*)    withMPI=true;; esac
-case "$Script" in *-python*) withPYTHON=true;; esac
-case "$Script" in *-qt*)     withQT=true;; esac
-
-# Set initial ParaView_MAJOR based on current value of ParaView_VERSION
-setParaViewVersion ${ParaView_VERSION:-none}
-
-#
-# various building stages
-#
-unset runCONFIG runMAKE runINSTALL
-runDEFAULT=true
-
-# parse options
-while [ "$#" -gt 0 ]
-do
-    case "$1" in
-    -h | -help)
-        usage
-        ;;
-    [0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version
-        setParaViewVersion "${1%%/}"
-        ;;
-    [A-Z]*=*)            # cmake variables
-        addCMakeVariable "$1"
-        ;;
-    -gcc)
-        export CC=gcc    # use gcc/g++
-        export CXX=g++
-        ;;
-    -config)             # stage 1: config only
-        runCONFIG=true
-        unset runDEFAULT
-        ;;
-    -no-config)
-        runCONFIG=false
-        ;;
-    -make)               # stage 2: make only
-        runMAKE=true
-        unset runDEFAULT
-        ;;
-    -no-make)
-        runMAKE=false
-        ;;
-    -install)            # stage 3: install only
-        runINSTALL=true
-        unset runDEFAULT
-        ;;
-    -no-install)
-        runINSTALL=false
-        ;;
-    -rebuild)            # shortcut for rebuilding
-        runMAKE=true
-        runINSTALL=true
-        unset runDEFAULT
-        ;;
-    -mesa)
-        withMESA=true
-        ;;
-    -no-mesa)
-        withMESA=false
-        ;;
-    -mesa-include)
-        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
-        MESA_INCLUDE="$2"
-        shift
-        ;;
-    -mesa-lib)
-        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
-        MESA_LIBRARY="$2"
-        shift
-        ;;
-    -mpi)
-        withMPI=true
-        ;;
-    -no-mpi)
-        withMPI=false
-        ;;
-    -python)
-        withPYTHON=true
-        ;;
-    -no-python)
-        withPYTHON=false
-        ;;
-    -python-lib)
-        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
-        PYTHON_LIBRARY="$2"
-        shift
-        ;;
-    -cmake)
-        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
-        CMAKE_PATH=$2
-        shift
-        ;;
-    -qmake)
-        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
-        QMAKE_PATH=$2
-        shift
-        ;;
-    -qt)
-        withQT=true
-        ;;
-    -no-qt)
-        withQT=false
-        ;;
-    -qt-[1-9]*)
-        QMAKE_PATH="$installBASE/${1##-}"
-        ;;
-    -verbose)
-        withVERBOSE=true
-        ;;
-    -version)
-        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
-        setParaViewVersion "${2%%/}"
-        shift
-        ;;
-    -major)
-        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
-        export ParaView_MAJOR="$2"
-        shift
-        ;;
-    *)
-        die "unknown option/argument: '$1'"
-        ;;
-    esac
-    shift
-done
-
-[ -n "$ParaView_VERSION" ] || die "The paraview-VERSION was not specified"
-
-# nothing to build
-if _foamIsNone "$ParaView_VERSION"
-then
-    echo "Using paraview-none (skip ThirdParty build of ParaView)"
-    exit 0
-fi
-
-if [ "$runDEFAULT" = true ]
-then
-    : ${runCONFIG:=true}
-    : ${runMAKE:=true}
-    : ${runINSTALL:=true}
-fi
-
-
-# Set configure options
-#~~~~~~~~~~~~~~~~~~~~~~
-addVerbosity        # verbose makefiles
-addMpiSupport       # set MPI-specific options
-addPythonSupport    # set Python-specific options
-addMesaSupport      # set MESA-specific options
-addQtSupport        # add extra Qt support
-
-setParaViewDirs     # where things are or should be put
-
-
-# Build and install
-# ~~~~~~~~~~~~~~~~~
-cat<<SUMMARY
-
-Build stages selected
----------------------
-    -config   ${runCONFIG:-false}
-    -make     ${runMAKE:-false}
-    -install  ${runINSTALL:-false}
----------------------
-Features selected
-    mesa      ${withMESA:-false}
-    mpi       ${withMPI:-false}
-    python    ${withPYTHON:-false}
-    qt        ${withQT:-false}
----------------------
-Version information
-    qt        ${QtVersion:-none}
-    version   ${ParaView_VERSION:-unknown}
-    major     ${ParaView_MAJOR:-unknown}
-$(checkVersion)
----------------------
-SUMMARY
-
-[ "$runCONFIG"  = true ] && configParaView
-[ "$runMAKE"    = true ] && makeParaView
-[ "$runINSTALL" = true ] && installParaView
-
-echo
-echo Done
-
-#------------------------------------------------------------------------------
diff --git a/makeQt b/makeQt
index 1b65e6e0b0345cd52acaadb01da12bd53871b919..5c27532d8adf7ecc616697d11149dc25b3f038fb 100755
--- a/makeQt
+++ b/makeQt
@@ -43,7 +43,6 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
 . etc/tools/ThirdPartyFunctions
 . etc/tools/QtFunctions
 #------------------------------------------------------------------------------
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
@@ -60,13 +59,13 @@ USAGE
     exit 1
 }
 #------------------------------------------------------------------------------
-# export WM settings in a form that GNU configure recognizes
+# Export WM settings in a form that GNU configure recognizes
 [ -n "$WM_CC" ]         &&  export CC="$WM_CC"
 [ -n "$WM_CXX" ]        &&  export CXX="$WM_CXX"
 [ -n "$WM_CFLAGS" ]     &&  export CFLAGS="$WM_CFLAGS"
 [ -n "$WM_CXXFLAGS" ]   &&  export CXXFLAGS="$WM_CXXFLAGS"
 
-# parse options
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
@@ -105,8 +104,8 @@ fi
 #
 # Build QT
 
+QT_SOURCE_DIR=$sourceBASE/$qtPACKAGE
 QT_ARCH_PATH=$installBASE/qt-$qtVERSION
-QT_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$qtPACKAGE
 
 echo
 echo ========================================
@@ -117,63 +116,62 @@ then
     echo "Already built: Qt-$qtVERSION"
 else
     echo "Starting build: Qt-$qtVERSION"
-(
-    # Configuration options:
-    unset configOpt
-    configOpt="$configOpt -nomake examples"
-
-    case "$qtVERSION" in
-    4*) # QT-4
-        # Without demos.
-        configOpt="$configOpt -nomake demos"
-
-        # Without old qt3 transition code
-        configOpt="$configOpt -no-qt3support"
-
-        # Without WebKit - uses std:tr1 and does not compile with c++11
-        # Fortunately WebKit is now optional for ParaView
-        configOpt="$configOpt -no-webkit"
-        ;;
-
-    *)  # QT-5
-        # Avoid too many X11 system dependencies.
-        configOpt="$configOpt -qt-xcb"
-        ;;
-    esac
-
-    # end of configuration options
-    # ----------------------------
-    buildDIR=$buildBASE/$qtPACKAGE
-
-    cd $QT_SOURCE_DIR || exit 1
-    [ -e Makefile ] && make distclean 2>/dev/null
-
-    # Remove any existing build folder and recreate
-    rm -rf $QT_ARCH_DIR
-    rm -rf $buildDIR 2>/dev/null
-    mkdir -p $buildDIR
-
-    # 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
-
-    cd $buildDIR || exit 1
-
-    # Compile as opensource, accepting LGPL conditions (yes)
-    echo yes | $QT_SOURCE_DIR/configure \
-        -prefix $QT_ARCH_PATH \
-        -opensource \
-        $configOpt \
-    && time make -j $WM_NCOMPPROCS \
-    && make install \
-    && echo "Built: Qt-$qtVERSION" \
-    && finalizeQt
-) || {
-    echo "Error building: Qt-$qtVERSION"
-    exit 1
-}
+    (
+        # Configuration options:
+        unset configOpt
+        configOpt="$configOpt -nomake examples"
+
+        case "$qtVERSION" in
+        4*) # QT-4
+            # Without demos.
+            configOpt="$configOpt -nomake demos"
+
+            # Without old qt3 transition code
+            configOpt="$configOpt -no-qt3support"
+
+            # Without WebKit - uses std:tr1 and does not compile with c++11
+            # Fortunately WebKit is now optional for ParaView
+            configOpt="$configOpt -no-webkit"
+            ;;
+
+        *)  # QT-5
+            # Avoid too many X11 system dependencies.
+            configOpt="$configOpt -qt-xcb"
+            ;;
+        esac
+
+        # end of configuration options
+        # ----------------------------
+        buildDIR=$buildBASE/$qtPACKAGE
+
+        cd $QT_SOURCE_DIR || exit 1
+        [ -e Makefile ] && make distclean 2>/dev/null
+
+        # Remove any existing build folder and recreate
+        rm -rf $QT_ARCH_DIR
+        rm -rf $buildDIR 2>/dev/null
+        mkdir -p $buildDIR
+
+        # 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
+
+        cd $buildDIR || exit 1
+
+        # Compile as opensource, accepting LGPL conditions (yes)
+        echo yes | $QT_SOURCE_DIR/configure \
+            -prefix $QT_ARCH_PATH \
+            -opensource \
+            $configOpt \
+        && time make -j $WM_NCOMPPROCS \
+        && make install \
+        && echo "Built: Qt-$qtVERSION" \
+        && finalizeQt
+    ) || {
+        echo "Error building: Qt-$qtVERSION"
+        exit 1
+    }
 fi
 
-
 # ----------------------------------------------------------------- end-of-file
diff --git a/makeTecio b/makeTecio
new file mode 100755
index 0000000000000000000000000000000000000000..ea2cea3d1237508f6f269962a3e6a338010d9ca4
--- /dev/null
+++ b/makeTecio
@@ -0,0 +1,206 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+#    \\/     M anipulation  |
+#------------------------------------------------------------------------------
+# 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
+#     makeTecio
+#
+# Description
+#     Build Tecplot library
+#
+#------------------------------------------------------------------------------
+# Get boost version (headers only)
+. $WM_PROJECT_DIR/etc/config.sh/functions
+unset -f _foamAddPath _foamAddLib _foamAddMan # get settings only
+
+_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL)
+
+boostPACKAGE=${boost_version:-boost-system}
+tecioPACKAGE=tecio
+targetType=lib
+
+#------------------------------------------------------------------------------
+# Run from third-party directory only
+cd ${0%/*} || exit 1
+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
+}
+[ -n "$FOAM_EXT_LIBBIN" ] || {
+    echo "Error: FOAM_EXT_LIBBIN not set"
+    echo "    Check the OpenFOAM entries in your dot-files and source them."
+    exit 1
+}
+. etc/tools/ThirdPartyFunctions
+#------------------------------------------------------------------------------
+usage()
+{
+    exec 1>&2
+    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
+    /bin/cat<<USAGE
+
+Usage: ${0##*/} [OPTION] [boost-VERSION] [tecio-VERSION]
+options:
+  -cmake PATH       With cmake from the path given
+  -gcc              Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
+  -help
+
+
+* Compile the proprietary libtecio library
+      $tecioPACKAGE
+  with $boostPACKAGE
+
+USAGE
+    exit 1
+}
+#------------------------------------------------------------------------------
+# Ensure CMake gets the correct C/C++ compiler
+[ -n "$WM_CC" ]  && export CC="$WM_CCX"
+[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
+
+# Parse options
+while [ "$#" -gt 0 ]
+do
+    case "$1" in
+    -h | -help)
+        usage
+        ;;
+    -gcc)
+        export CC=gcc    # use gcc/g++
+        export CXX=g++
+        ;;
+    -cmake)
+        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
+        CMAKE_PATH="${2%%/}"
+        shift
+        ;;
+    boost-[0-9]* | boost_[0-9]* | boost-system )
+        boostPACKAGE="${1%%/}"
+        ;;
+    tecio*)
+        tecioPACKAGE="${1%%/}"
+        ;;
+    *)
+        die "unknown option/argument: '$1'"
+        ;;
+    esac
+    shift
+done
+
+# assert: directory must be available
+[ -d "$tecioPACKAGE" ] || die "missing source directory '$tecioPACKAGE'"
+
+
+#------------------------------------------------------------------------------
+#
+# Get Boost information
+# - only headers are required
+
+: ${BOOST_ARCH_PATH:=$installBASE/$boostPACKAGE}    # Fallback
+
+boostInc="$BOOST_ARCH_PATH/include"
+
+if _foamIsSystem $boostPACKAGE
+then
+    echo "Using boost-system"
+
+    # Tagged as 'system' but could actually point to a central location
+    [ -d "$BOOST_ARCH_PATH/include" ] || {
+        boostInc="/usr/include"
+    }
+elif [ -f "$boostInc/boost/version.hpp" ]
+then
+    echo "Using $boostPACKAGE"
+fi
+
+
+# Build TECIO library
+#
+#   TECIO_SOURCE_DIR : location of the original sources
+#   TECIO_BINARY_DIR : location of the build
+#   TECIO_ARCH_PATH  : location of the installed program
+
+TECIO_SOURCE_DIR=$sourceBASE/$tecioPACKAGE/teciosrc
+TECIO_BINARY_DIR=$buildBASE/$tecioPACKAGE
+TECIO_ARCH_PATH=$installBASE/$tecioPACKAGE
+
+if [ -d "$TECIO_SOURCE_DIR" ]
+then
+(
+    # Remove any existing build folder and recreate
+    if [ -d $TECIO_BINARY_DIR ]
+    then
+        echo "removing old build directory"
+        echo "    $TECIO_BINARY_DIR"
+        rm -rf $TECIO_BINARY_DIR
+    fi
+    mkdir -p $TECIO_BINARY_DIR
+
+    rm -rf $TECIO_ARCH_PATH
+
+    unset configBoost
+    echo "----"
+    echo "Configuring $tecioPACKAGE with boost $BOOST_VERSION"
+    echo "    Source         : $TECIO_SOURCE_DIR"
+    echo "    Build          : $TECIO_BINARY_DIR"
+    echo "    Target         : $TECIO_ARCH_PATH"
+
+    if [ -d "$BOOST_ARCH_PATH" ]
+    then
+        echo "    Boost          : ThirdParty (${BOOST_ARCH_PATH##*/})"
+    else
+        echo "    Boost          : system"
+    fi
+
+    cmake=$(findCMake)
+
+    echo "----"
+    set -x
+    cd $TECIO_BINARY_DIR && $cmake \
+        -DCMAKE_INSTALL_PREFIX=$TECIO_ARCH_PATH \
+        -DCMAKE_BINARY_TYPE=Release \
+        -DBoost_INCLUDE_DIR=$boostInc \
+        $TECIO_SOURCE_DIR \
+    && make -j $WM_NCOMPPROCS \
+    && { \
+        # Tecio doesn't offer to install, but fortunately only a few files,
+        # so just install in a single directory
+        mkdir -p $TECIO_ARCH_PATH 2>/dev/null
+
+        /bin/cp -pv \
+            $TECIO_BINARY_DIR/libtecio.a \
+            $TECIO_SOURCE_DIR/TECIO.h \
+            $TECIO_SOURCE_DIR/tecio_Exports.h \
+            $TECIO_ARCH_PATH
+
+        chmod 0644 $TECIO_ARCH_PATH/*
+    } \
+    && echo "Built: $tecioPACKAGE"
+) || {
+    echo "Error building: $tecioPACKAGE"
+}
+fi
+
+#------------------------------------------------------------------------------
diff --git a/makeVTK b/makeVTK
index 4e084e670231cfc9a5011370215579f9621e9598..1206ab68d6e5567468560459e69289334aa94693 100755
--- a/makeVTK
+++ b/makeVTK
@@ -26,16 +26,18 @@
 #     makeVTK
 #
 # Description
-#     Make and install VTK
-#     - place the VTK source under $WM_THIRD_PARTY_DIR/VTK-VERSION
+#     Make and install VTK.
+#     The VTK sources should be located under one of these locations:
+#       - $WM_THIRD_PARTY_DIR/ParaView-VERSION
+#       - $WM_THIRD_PARTY_DIR/ParaView-vVERSION
 #
 #     To use the VTK source from the ParaView source tree, simply make an
 #     appropriate link first. For example,
 #
-#        ln -s ParaView-5.1.0/VTK  VTK-7.1.0
+#        (cd $WM_THIRD_PARTY_DIR && ln -s ParaView-v5.2.0/VTK VTK-7.1.0)
 #
 #------------------------------------------------------------------------------
-# run from third-party directory only
+# Run from third-party directory only
 cd ${0%/*} || exit 1
 wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
     echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
@@ -68,13 +70,11 @@ CMAKE_PATH=""
 # Default to auto-config based on VTK version
 withGL2=auto
 
-
 #
 # NO FURTHER EDITING BELOW THIS LINE
 #
 #-----------------------------------------------------------------------------
 Script=${0##*/}
-
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
@@ -89,7 +89,7 @@ options:
   -mpi=NPROCS       with mpi and max 'NPROCS' processes. NPROCS=0 for no
                         upper-limit on processes.
   -osmesa           with off-screen mesa only
-  -cmake PATH       with the cmake version corresponding to the cmake path given
+  -cmake PATH       with cmake from the path given
   -gcc              force g++ instead of the value from \$WM_CXX
   -verbose          verbose output in Makefiles
   -version VER      specify an alternative version (current value: $VTK_VERSION)
@@ -120,22 +120,20 @@ For finer control, the build stages can be selected or deselected individually:
 USAGE
     exit 1
 }
-
 #------------------------------------------------------------------------------
-
-# ensure CMake gets the correct C/C++ compiler
+# Ensure CMake gets the correct C/C++ compiler
 [ -n "$WM_CC" ]  && export CC="$WM_CC"
 [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
 
 #
-# various building stages
+# Various building stages
 #
 unset runPATCH runCONFIG runMAKE runINSTALL
 runDEFAULT=true
 buildType=Release
 withOSMESA=false
 
-# parse options
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
diff --git a/makeVTK.example b/makeVTK.example
index a21d682fc1508aa37680b9a61d010dee60748fd2..a4566d15c784d46bf786e422b5fab2e61aa59105 100755
--- a/makeVTK.example
+++ b/makeVTK.example
@@ -2,8 +2,9 @@
 # An example for building particular combinations of VTK with
 # - off-screen mesa
 
-vtk=vtk-7.1.0
-mesa=mesa-11.2.2
+vtk=VTK-7.1.0
+# mesa=mesa-11.2.2
+mesa=mesa-13.0.1
 
 ./makeVTK \
     $vtk \
diff --git a/minCmake b/minCmake
index 1d94eefbe6fd94294a1e8590dae0a3a63bb1b510..f6bcc6bde5fe6aa8de1bf29a49eb1c210dbd8fba 100755
--- a/minCmake
+++ b/minCmake
@@ -85,7 +85,8 @@ do
 
     if [ -n "$min" ]
     then
-        echo "${min%.0}" $dir   # With trailing ".0 removed
+        # Remove trailing ".0" from version
+        echo "${min%.0}" "${dir#sources/}"
     fi
 
 done \
diff --git a/sources.txt b/sources.txt
new file mode 100644
index 0000000000000000000000000000000000000000..cc7f8e52f75b789433ac96f2d89f4a503cc9a8c0
--- /dev/null
+++ b/sources.txt
@@ -0,0 +1,38 @@
+Third-Party Sources
+===================
+
+OpenFOAM+ v1612
+---------------
+CGAL-4.9
+ParaView-5.0.1
+boost_1_62_0
+fftw-3.3.5
+openmpi-1.10.4
+scotch_6.0.3
+
+
+OpenFOAM+ v1606
+---------------
+CGAL-4.8
+ParaView-5.0.1
+boost_1_61_0
+fftw-3.3.4
+openmpi-1.10.2
+scotch_6.0.3
+
+
+OpenFOAM+ v3.0
+---------------
+CGAL-4.7
+ParaView-4.4.0
+openmpi-1.10.0
+scotch_6.0.3
+
+
+OpenFOAM+ 2.4
+---------------
+CGAL-4.6
+ParaView-4.1.0
+cmake-2.8.12.1
+openmpi-1.8.5
+scotch_6.0.3