From 65af6ebd1b9ff7c6fa93c6e38de2c07c0fd58f53 Mon Sep 17 00:00:00 2001
From: Timo Heister <timo.heister@gmail.com>
Date: Wed, 25 Jan 2023 20:52:42 -0500
Subject: [PATCH] move patch into file

---
 deal.II-toolchain/packages/parmetis.package   | 19 ++++++-------------
 .../patches/parmetis-4.0.3-64bit.patch        |  8 ++++++++
 2 files changed, 14 insertions(+), 13 deletions(-)
 create mode 100644 deal.II-toolchain/patches/parmetis-4.0.3-64bit.patch

diff --git a/deal.II-toolchain/packages/parmetis.package b/deal.II-toolchain/packages/parmetis.package
index 9d5d580..03c1cc6 100644
--- a/deal.II-toolchain/packages/parmetis.package
+++ b/deal.II-toolchain/packages/parmetis.package
@@ -7,19 +7,6 @@ BUILDCHAIN=custom
 
 INSTALL_PATH=${INSTALL_PATH}/${NAME}
 
-if [ ${USE_64_BIT_INDICES} = ON ]; then
-
-    echo "
---- metis/include/metis.h	2013-03-30 16:24:50.000000000 +0000
-+++ metis/include/metis.h	2022-11-27 16:14:07.863359070 +0000
-@@ -30,7 +30,7 @@
-  GCC does provides these definitions in stdint.h, but it may require some
-  modifications on other architectures.
- --------------------------------------------------------------------------*/
--#define IDXTYPEWIDTH 32
-+#define IDXTYPEWIDTH 64"  | tee -a ${ORIG_DIR}/${PROJECT}/patches/parmetis-4.0.3-build.patch
-fi
-
 package_specific_build() {
     cp -rf ${UNPACK_PATH}/${EXTRACTSTO}/* .
     
@@ -54,6 +41,12 @@ package_specific_patch () {
             cd ${UNPACK_PATH}/${EXTRACTSTO}
             cecho ${WARN} "applying patch for building METIS shared libraries"
             patch -p0 --forward < ${ORIG_DIR}/${PROJECT}/patches/parmetis-4.0.3-build.patch || true
+
+            if [ ${USE_64_BIT_INDICES} = ON ]; then
+            cd ${UNPACK_PATH}/${EXTRACTSTO}
+            cecho ${WARN} "applying patch for 64bit ParMETIS"
+            patch -p0 --forward < ${ORIG_DIR}/${PROJECT}/patches/parmetis-4.0.3-64bit.patch || true
+            fi
         fi
     fi
 }
diff --git a/deal.II-toolchain/patches/parmetis-4.0.3-64bit.patch b/deal.II-toolchain/patches/parmetis-4.0.3-64bit.patch
new file mode 100644
index 0000000..305203a
--- /dev/null
+++ b/deal.II-toolchain/patches/parmetis-4.0.3-64bit.patch
@@ -0,0 +1,8 @@
+--- metis/include/metis.h	2013-03-30 16:24:50.000000000 +0000
++++ metis/include/metis.h	2022-11-27 16:14:07.863359070 +0000
+@@ -30,7 +30,7 @@
+  GCC does provides these definitions in stdint.h, but it may require some
+  modifications on other architectures.
+ --------------------------------------------------------------------------*/
+-#define IDXTYPEWIDTH 32
++#define IDXTYPEWIDTH 64
-- 
2.39.5