From d6b35e6777b5ca3a3b70650f672451c70c354aec Mon Sep 17 00:00:00 2001
From: Chris Morgan <aur@chrismorgan.info>
Date: Sun, 2 May 2021 02:53:00 +1000
Subject: [PATCH] Make it build, and adhere to Arch standards more
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

• Its vendored qwt-lib thing needs a straightforward patch because of
  something that I hear Qt 5.15 broke.

• Git submodules are supposed to be specified as sources and sorted out
  in prepare. This was incidentally moderately necessary to sort out
  because the qwt patch needs the submodules to be up to date, so either
  the patch application had to be shifted to build, or the submodules to
  prepare.

• Improve the package version by pulling something from Git.
  In theory this package should probably also be renamed to
  entropy-piano-tuner-git, but upstream looks pretty dead. I dunno.
  Anyway, 1.2.0.r27.gee7857a > git. (And not just in meaningfulness; in
  version comparison, too, so an epoch bump isn’t needed.)
---
 .SRCINFO             | 12 +++++++-
 PKGBUILD             | 33 +++++++++++++++++++---
 qwt-lib-qt5.15.patch | 66 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+), 5 deletions(-)
 create mode 100644 qwt-lib-qt5.15.patch

diff --git a/.SRCINFO b/.SRCINFO
index e07f43d..a9d6905 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
 pkgbase = entropy-piano-tuner
 	pkgdesc = Free Software for Piano Tuning
-	pkgver = git
+	pkgver = 1.2.0.r27.gee7857a
 	pkgrel = 1
 	url = https://gitlab.com/tp3/Entropy-Piano-Tuner
 	arch = i686
@@ -14,9 +14,19 @@ pkgbase = entropy-piano-tuner
 	depends = fftw
 	depends = qt5-declarative
 	source = git+https://gitlab.com/tp3/Entropy-Piano-Tuner.git
+	source = git+https://gitlab.com/chwick/fftw3-qmake.git
+	source = git+https://github.com/libuv/libuv.git
+	source = git+https://gitlab.com/chwick/qwt-lib.git
+	source = git+https://gitlab.com/tp3/tp3log.git
 	source = rpath.patch
+	source = qwt-lib-qt5.15.patch
+	md5sums = SKIP
+	md5sums = SKIP
+	md5sums = SKIP
+	md5sums = SKIP
 	md5sums = SKIP
 	md5sums = e7f34645ebe707be6d417f1f4bc31ebd
+	md5sums = ec874c86d32d0e4a7e4acbfb8262c86d
 
 pkgname = entropy-piano-tuner
 
diff --git a/PKGBUILD b/PKGBUILD
index 9479093..cef1a39 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
 # Maintainer: Stefan Damm <autama@nurfuerspam.de>
 pkgname=entropy-piano-tuner
-pkgver=git
+pkgver=1.2.0.r27.gee7857a
 pkgrel=1
 pkgdesc="Free Software for Piano Tuning"
 arch=('i686' 'x86_64')
@@ -8,18 +8,43 @@ url="https://gitlab.com/tp3/Entropy-Piano-Tuner"
 license=('GPL3')
 depends=('qtmidi-qt5' 'qwt' 'libuv' 'hicolor-icon-theme' 'qt5-multimedia' 'fftw' 'qt5-declarative')
 
-source=(git+https://gitlab.com/tp3/Entropy-Piano-Tuner.git rpath.patch)
+source=(git+https://gitlab.com/tp3/Entropy-Piano-Tuner.git
+        git+https://gitlab.com/chwick/fftw3-qmake.git
+        git+https://github.com/libuv/libuv.git
+        git+https://gitlab.com/chwick/qwt-lib.git
+        git+https://gitlab.com/tp3/tp3log.git
+        rpath.patch
+        qwt-lib-qt5.15.patch)
 md5sums=('SKIP'
-         'e7f34645ebe707be6d417f1f4bc31ebd')
+         'SKIP'
+         'SKIP'
+         'SKIP'
+         'SKIP'
+         'e7f34645ebe707be6d417f1f4bc31ebd'
+         'ec874c86d32d0e4a7e4acbfb8262c86d')
+
+pkgver() {
+  cd Entropy-Piano-Tuner
+  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
+}
 
 prepare() {
   cd Entropy-Piano-Tuner
+
+  git submodule init
+  git config submodule.thirdparty/fftw3.url $srcdir/fftw3-qmake
+  git config submodule.thirdparty/libuv/libuv.url $srcdir/libuv
+  git config submodule.thirdparty/qwt-lib.url $srcdir/qwt-lib
+  git config submodule.thirdparty/tp3log.url $srcdir/tp3log
+  git submodule update
+
   patch -Np1 -i ../rpath.patch
+  # Qt 5.15 broke QPainterPath stuff; fortunately it’s an easy fix.
+  patch -Np1 -i ../qwt-lib-qt5.15.patch
 }
 
 build() {
   cd "Entropy-Piano-Tuner"
-  git submodule update --init
 
   rm -rf build
   mkdir build
diff --git a/qwt-lib-qt5.15.patch b/qwt-lib-qt5.15.patch
new file mode 100644
index 0000000..c657909
--- /dev/null
+++ b/qwt-lib-qt5.15.patch
@@ -0,0 +1,66 @@
+diff --git a/thirdparty/qwt-lib/qwt/qwt_null_paintdevice.h b/thirdparty/qwt-lib/qwt/qwt_null_paintdevice.h
+index d7f03be..cef492e 100644
+--- a/thirdparty/qwt-lib/qwt/qwt_null_paintdevice.h
++++ b/thirdparty/qwt-lib/qwt/qwt_null_paintdevice.h
+@@ -13,6 +13,7 @@
+ #include "qwt_global.h"
+ #include <qpaintdevice.h>
+ #include <qpaintengine.h>
++#include <QPainterPath>
+ 
+ /*!
+   \brief A null paint device doing nothing
+diff --git a/thirdparty/qwt-lib/qwt/qwt_painter.h b/thirdparty/qwt-lib/qwt/qwt_painter.h
+index 9609b69..67095a3 100644
+--- a/thirdparty/qwt-lib/qwt/qwt_painter.h
++++ b/thirdparty/qwt-lib/qwt/qwt_painter.h
+@@ -17,6 +17,7 @@
+ #include <qpen.h>
+ #include <qline.h>
+ #include <qpalette.h>
++#include <QPainterPath>
+ 
+ class QPainter;
+ class QBrush;
+@@ -31,7 +32,6 @@ class QwtColorMap;
+ class QwtInterval;
+ 
+ class QTextDocument;
+-class QPainterPath;
+ 
+ /*!
+   \brief A collection of QPainter workarounds
+diff --git a/thirdparty/qwt-lib/qwt/qwt_painter_command.h b/thirdparty/qwt-lib/qwt/qwt_painter_command.h
+index 2da597a..3a85b68 100644
+--- a/thirdparty/qwt-lib/qwt/qwt_painter_command.h
++++ b/thirdparty/qwt-lib/qwt/qwt_painter_command.h
+@@ -15,8 +15,7 @@
+ #include <qpixmap.h>
+ #include <qimage.h>
+ #include <qpolygon.h>
+-
+-class QPainterPath;
++#include <QPainterPath>
+ 
+ /*!
+   QwtPainterCommand represents the attributes of a paint operation
+diff --git a/thirdparty/qwt-lib/qwt/qwt_symbol.h b/thirdparty/qwt-lib/qwt/qwt_symbol.h
+index ea16d88..8dc65c3 100644
+--- a/thirdparty/qwt-lib/qwt/qwt_symbol.h
++++ b/thirdparty/qwt-lib/qwt/qwt_symbol.h
+@@ -12,6 +12,7 @@
+ 
+ #include "qwt_global.h"
+ #include <qpolygon.h>
++#include <QPainterPath>
+ 
+ class QPainter;
+ class QRect;
+@@ -21,7 +22,6 @@ class QPen;
+ class QColor;
+ class QPointF;
+ class QPolygonF;
+-class QPainterPath;
+ class QPixmap;
+ class QByteArray;
+ class QwtGraphic;
-- 
2.31.1

