From f768402255bcbc506800e135390efcd6fba464e9 Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Fri, 1 Jul 2016 14:53:28 +0100
Subject: [PATCH] Simplified the handling of the CGAL installation

---
 .../utilities/mesh/generation/Allwmake        | 11 ++---
 etc/bashrc                                    |  5 ---
 etc/config.sh/CGAL                            | 42 ++++++++-----------
 etc/cshrc                                     |  4 --
 src/renumber/Allwmake                         | 31 ++------------
 src/renumber/SloanRenumber/Make/options       |  1 -
 6 files changed, 25 insertions(+), 69 deletions(-)

diff --git a/applications/utilities/mesh/generation/Allwmake b/applications/utilities/mesh/generation/Allwmake
index 5beed0b5556..ea140785b99 100755
--- a/applications/utilities/mesh/generation/Allwmake
+++ b/applications/utilities/mesh/generation/Allwmake
@@ -4,13 +4,6 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Parse arguments for compilation (at least for error catching)
 . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
 
-# Get CGAL and boost versions
-. $WM_PROJECT_DIR/etc/config.sh/functions
-_foamEval SOURCE_CGAL_VERSIONS_ONLY=yes \
-          $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL)
-
-set -x
-
 wmake -all $targetType blockMesh
 wmake -all $targetType extrude
 wmake -all $targetType extrude2DMesh
@@ -18,6 +11,10 @@ wmake -all $targetType snappyHexMesh
 
 if [ -n "$FOAMY_HEX_MESH" ]
 then
+    # Get CGAL and boost versions
+    . $WM_PROJECT_DIR/etc/config.sh/functions
+    _foamEval $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL)
+
     foamyMesh/Allwmake $targetType $*
 fi
 
diff --git a/etc/bashrc b/etc/bashrc
index 4df0d6c3754..f05fcea88f0 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -172,11 +172,6 @@ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/ensight`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools`
 
-if [ ! -z "$FOAMY_HEX_MESH" ]
-then
-    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL`
-fi
-
 
 # Clean environment paths again. Only remove duplicates
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/etc/config.sh/CGAL b/etc/config.sh/CGAL
index 5d6b2747aec..e61f8c82390 100644
--- a/etc/config.sh/CGAL
+++ b/etc/config.sh/CGAL
@@ -40,33 +40,27 @@ boost_version=boost-system
 cgal_version=cgal-system
 #cgal_version=CGAL-4.8
 
-if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ]
-then
-
-    common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
-
-    export BOOST_ARCH_PATH=$common_path/$boost_version
-    export CGAL_ARCH_PATH=$common_path/$cgal_version
+thirdPartyPath=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
 
-    if [ "$FOAM_VERBOSE" -a "$PS1" ]
-    then
-        echo "Using CGAL and boost" 1>&2
-        echo "    $cgal_version at $CGAL_ARCH_PATH" 1>&2
-        echo "    $boost_version at $BOOST_ARCH_PATH" 1>&2
-    fi
-
-    if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ]
-    then
-        _foamAddLib $CGAL_ARCH_PATH/lib
-    fi
-
-    if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ]
-    then
-        _foamAddLib $BOOST_ARCH_PATH/lib
-    fi
+if [ "$boost_version" != "boost-system" -a -d "$thirdPartyPath/$boost_version" ]
+then
+    export BOOST_ARCH_PATH=$thirdPartyPath/$boost_version
+    _foamAddLib $BOOST_ARCH_PATH/lib
+fi
 
-    unset boost_version cgal_version common_path
+if [ "$cgal_version" != "cgal-system" -a -d "$thirdPartyPath/$cgal_version" ]
+then
+    export CGAL_ARCH_PATH=$thirdPartyPath/$cgal_version
+    _foamAddLib $CGAL_ARCH_PATH/lib
+fi
 
+if [ "$FOAM_VERBOSE" -a "$PS1" ]
+then
+    echo "Using BOOST and CGAL" 1>&2
+    echo "    $boost_version at $BOOST_ARCH_PATH" 1>&2
+    echo "    $cgal_version at $CGAL_ARCH_PATH" 1>&2
 fi
 
+unset boost_version cgal_version thirdPartyPath
+
 #------------------------------------------------------------------------------
diff --git a/etc/cshrc b/etc/cshrc
index c2f17948b13..22537fc3269 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -218,10 +218,6 @@ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/mpi`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/paraview`
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/ensight`
 
-if ( ($?FOAMY_HEX_MESH) ) then
-    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/CGAL`
-endif
-
 
 # Clean environment paths again. Only remove duplicates
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/src/renumber/Allwmake b/src/renumber/Allwmake
index 66816802312..058816b1a84 100755
--- a/src/renumber/Allwmake
+++ b/src/renumber/Allwmake
@@ -4,36 +4,11 @@ cd ${0%/*} || exit 1    # Run from this directory
 # Parse arguments for library compilation
 . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
 
-# Get CGAL and scotch versions
-. $WM_PROJECT_DIR/etc/config.sh/functions
-_foamEval SOURCE_CGAL_VERSIONS_ONLY=yes \
-          $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL)
-
-## Get ZOLTAN_ARCH_PATH
-#if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan`
-#then
-#    . $settings
-#    echo "using ZOLTAN_ARCH_PATH=$ZOLTAN_ARCH_PATH"
-#else
-#    echo
-#    echo "Error: no config.sh/zoltan settings"
-#    echo
-#fi
-
-
-set -x
-
 wmake $targetType renumberMethods
 
-if [ -n "$BOOST_ARCH_PATH" -o "$boost_version" = "boost-system" ]
-then
-    wmake $targetType SloanRenumber
-else
-    echo
-    echo "Skipping SloanRenumber"
-    echo
-fi
-
+# Deprecate SloanRenumber due to dependency on BOOST causing build and
+# installation problems on a range of legacy systems.
+# wmake $targetType SloanRenumber
 
 if [ -n "$ZOLTAN_ARCH_PATH" ]
 then
diff --git a/src/renumber/SloanRenumber/Make/options b/src/renumber/SloanRenumber/Make/options
index 0bf3c77b82b..cf6e5486151 100644
--- a/src/renumber/SloanRenumber/Make/options
+++ b/src/renumber/SloanRenumber/Make/options
@@ -1,5 +1,4 @@
 EXE_INC = \
-    /* -DFULLDEBUG -g -O0 */ \
     -I$(BOOST_ARCH_PATH)/include \
     -I$(LIB_SRC)/meshTools/lnInclude \
     -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-- 
GitLab