From 6940b08822534283d74408b26f8db0c982a36132 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Mon, 1 Mar 2021 09:01:51 +0100
Subject: [PATCH] COMP: adjustments for OSX (#2013)

- int64 ambiguity
- std::array include

- bsd-sed syntax (replaces gnu-sed syntax):
  * wmake-build-info
  * wmake-with-bear
---
 src/OpenFOAM/primitives/Scalar/doubleFloat.H                | 6 +++++-
 src/OpenFOAM/primitives/complex/complexI.H                  | 5 ++++-
 .../searchableSurfaces/searchableSphere/searchableSphere.C  | 3 ++-
 wmake/scripts/wmake-build-info                              | 4 ++--
 wmake/scripts/wmake-with-bear                               | 4 ++--
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/OpenFOAM/primitives/Scalar/doubleFloat.H b/src/OpenFOAM/primitives/Scalar/doubleFloat.H
index 131eb07c1c6..945b08fc137 100644
--- a/src/OpenFOAM/primitives/Scalar/doubleFloat.H
+++ b/src/OpenFOAM/primitives/Scalar/doubleFloat.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
-    Copyright (C) 2018-2019 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -72,6 +72,10 @@ MAXMINPOW(float, float, int)
 MAXMINPOW(float, int, float)
 MAXMINPOW(float, float, long)
 MAXMINPOW(float, long, float)
+#if defined(__APPLE__) && WM_LABEL_SIZE == 64
+MAXMINPOW(float, float, int64_t)
+MAXMINPOW(float, int64_t, float)
+#endif
 
 #undef MAXMINPOW
 
diff --git a/src/OpenFOAM/primitives/complex/complexI.H b/src/OpenFOAM/primitives/complex/complexI.H
index 608a097068e..bba3e4a7384 100644
--- a/src/OpenFOAM/primitives/complex/complexI.H
+++ b/src/OpenFOAM/primitives/complex/complexI.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2014 OpenFOAM Foundation
-    Copyright (C) 2019-2020 OpenCFD Ltd.
+    Copyright (C) 2019-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -440,6 +440,9 @@ inline complex pow(const complex& x, const complex& y)
 
 powFuncs(int)
 powFuncs(long)
+#if defined(__APPLE__) && WM_LABEL_SIZE == 64
+powFuncs(int64_t)
+#endif
 powFuncs(float)
 powFuncs(double)
 
diff --git a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C
index f1f2057a4d3..e665b31384b 100644
--- a/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C
+++ b/src/meshTools/searchableSurfaces/searchableSphere/searchableSphere.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2018-2020 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -39,6 +39,7 @@ https://www.geometrictools.com/Documentation/DistancePointEllipseEllipsoid.pdf
 
 #include "searchableSphere.H"
 #include "addToRunTimeSelectionTable.H"
+#include <array>
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/wmake/scripts/wmake-build-info b/wmake/scripts/wmake-build-info
index 87e151b5440..8ec98bd8f02 100755
--- a/wmake/scripts/wmake-build-info
+++ b/wmake/scripts/wmake-build-info
@@ -6,7 +6,7 @@
 #   \\  /    A nd           | www.openfoam.com
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
-#     Copyright (C) 2018-2020 OpenCFD Ltd.
+#     Copyright (C) 2018-2021 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -237,7 +237,7 @@ getMakeInfo()
     # (api) from WM_DIR/rules/General/general
     # - extract WM_VERSION = OPENFOAM=<digits>
 
-    api="$(sed -ne '/^ *#/!{ /WM_VERSION.*OPENFOAM=/{ s@^.*OPENFOAM= *\([0-9][0-9]*\).*@\1@p; q }}' "$rulesFile" 2>/dev/null)"
+    api="$(sed -ne 's@^ *WM_VERSION *= *OPENFOAM=\([0-9][0-9]*\).*@\1@p' "$rulesFile" 2>/dev/null)"
 
     if [ -d "$META_INFO" ]
     then
diff --git a/wmake/scripts/wmake-with-bear b/wmake/scripts/wmake-with-bear
index a723d80ba2c..addd753e8ba 100755
--- a/wmake/scripts/wmake-with-bear
+++ b/wmake/scripts/wmake-with-bear
@@ -6,7 +6,7 @@
 #   \\  /    A nd           | www.openfoam.com
 #    \\/     M anipulation  |
 #-------------------------------------------------------------------------------
-#     Copyright (C) 2020 OpenCFD Ltd.
+#     Copyright (C) 2020-2021 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -80,7 +80,7 @@ done
 # Detect version. Seems to be stderr for some versions!?
 if version="$(bear --version 2>&1)"
 then
-    version="$(echo "$version" | sed -ne '1{ s/^[^0-9]*\([1-9]\)/\1/p }')"
+    version="$(echo "$version" | sed -ne '1s/^[^0-9]*\([1-9]\)/\1/p;')"
 else
     unset version
 fi
-- 
GitLab