From fe21131df5eae44042d58ac60ca542db124ec180 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Thu, 1 Sep 2022 13:32:30 +0000
Subject: [PATCH] community/vtk to 9.1.0-20

---
 community/vtk/PKGBUILD                | 17 ++++++++------
 community/vtk/vtk-libharu-2.4.0.patch | 32 +++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 7 deletions(-)
 create mode 100644 community/vtk/vtk-libharu-2.4.0.patch

diff --git a/community/vtk/PKGBUILD b/community/vtk/PKGBUILD
index 23d50703d..e2e6edf0c 100644
--- a/community/vtk/PKGBUILD
+++ b/community/vtk/PKGBUILD
@@ -14,7 +14,7 @@
 
 pkgname=vtk
 pkgver=9.1.0
-pkgrel=19
+pkgrel=20
 pkgdesc="Software system for 3D computer graphics, image processing, and visualization"
 arch=(x86_64)
 url="https://www.vtk.org/"
@@ -51,11 +51,12 @@ optdepends=('gnuplot: plotting tools'
             libharu
             liblas
             lz4
+            mariadb-libs
             netcdf
             openvdb
             openvr
             pdal
-            postgresql
+            postgresql-libs
             proj
             sqlite
             unixodbc)
@@ -63,20 +64,22 @@ source=(${url}/files/release/${pkgver%.*}/VTK-${pkgver}.tar.gz
         vtkm-tbb-2021.patch::https://gitlab.kitware.com/vtk/vtk-m/-/merge_requests/2509.patch
         vtk-ffmpeg5.patch::https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8863.patch
         vtk-python3.10.patch::https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8738.patch
-        vtk-exodus-netcdf4.9-compat.patch::https://github.com/sandialabs/seacas/commit/5e1b19181110c52b76d13e3f60da2c8cf678c941.patch)
+        vtk-exodus-netcdf4.9-compat.patch::https://github.com/sandialabs/seacas/commit/5e1b19181110c52b76d13e3f60da2c8cf678c941.patch
+        vtk-libharu-2.4.0.patch)
 options=(staticlibs)
 sha256sums=('8fed42f4f8f1eb8083107b68eaa9ad71da07110161a3116ad807f43e5ca5ce96'
             '37cff664c4eaacf44ecb995e62e9e54e54880bae0857d598c74660a2159ccb2e'
             '955ef22d2541beb9935557ef09a802b6504855a350f27ff056734679da8f0281'
             'dbc9a67caf548cf5afd571018d91aadcfcf78ddf8c66ac75b0772935e26ad29f'
-            '1272fafccd3d9677f3fd9cc0a70e47a21f6ec86379765e25c6bccd9053875259')
+            '1272fafccd3d9677f3fd9cc0a70e47a21f6ec86379765e25c6bccd9053875259'
+            '675707ec492182d1f0c8f4682775613dd9b5d315596af8df99ad4d758196e9c3')
 
 prepare() {
   cd VTK-${pkgver}
-  # We have a patched libharu
-  sed -i "s|2.4.0|2.3.0|" ThirdParty/libharu/CMakeLists.txt
+  # Fix build with libharu 2.4.0
+  patch -p1 < ../vtk-libharu-2.4.0.patch
   # We have a patched fmt
-  sed -i "s|8.1.0|8.0.1|" ThirdParty/fmt/CMakeLists.txt
+  sed -i "s|8.1.0|9.0.0|" ThirdParty/fmt/CMakeLists.txt
   # Fix build with TBB 2021
   patch -p1 -d ThirdParty/vtkm/vtkvtkm/vtk-m < ../vtkm-tbb-2021.patch
   # Fix build with FFmpeg 5
diff --git a/community/vtk/vtk-libharu-2.4.0.patch b/community/vtk/vtk-libharu-2.4.0.patch
new file mode 100644
index 000000000..aea27577e
--- /dev/null
+++ b/community/vtk/vtk-libharu-2.4.0.patch
@@ -0,0 +1,32 @@
+diff --git a/IO/ExportPDF/vtkPDFContextDevice2D.cxx b/IO/ExportPDF/vtkPDFContextDevice2D.cxx
+index 2df979c303..541a73e882 100644
+--- a/IO/ExportPDF/vtkPDFContextDevice2D.cxx
++++ b/IO/ExportPDF/vtkPDFContextDevice2D.cxx
+@@ -1617,21 +1617,21 @@ void vtkPDFContextDevice2D::ApplyLineWidth(float width)
+ void vtkPDFContextDevice2D::ApplyLineType(int type)
+ {
+   // These match the OpenGL2 implementation:
+-  static const HPDF_UINT16 noPen[] = { 0, 10 };
++  static const HPDF_REAL noPen[] = { 0.0f, 10.0f };
+   static const HPDF_UINT noPenLen = 2;
+ 
+-  static const HPDF_UINT16 dash[] = { 8 };
++  static const HPDF_REAL dash[] = { 8.0f };
+   static const HPDF_UINT dashLen = 1;
+ 
+-  static const HPDF_UINT16 dot[] = { 1, 7 };
+-  static const HPDF_UINT16 denseDot[] = { 1, 3 };
++  static const HPDF_REAL dot[] = { 1.0f, 7.0f };
++  static const HPDF_REAL denseDot[] = { 1.0f, 3.0f };
+   static const HPDF_UINT dotLen = 2;
+ 
+-  static const HPDF_UINT16 dashDot[] = { 4, 6, 2, 4 };
++  static const HPDF_REAL dashDot[] = { 4.0f, 6.0f, 2.0f, 4.0f };
+   static const HPDF_UINT dashDotLen = 4;
+ 
+   // This is dash-dot-dash, but eh. It matches the OpenGL2 0x1C47 pattern.
+-  static const HPDF_UINT16 dashDotDot[] = { 3, 3, 1, 3, 3, 3 };
++  static const HPDF_REAL dashDotDot[] = { 3.0f, 3.0f, 1.0f, 3.0f, 3.0f, 3.0f };
+   static const HPDF_UINT dashDotDotLen = 6;
+ 
+   switch (type)