From 050ed178349b9c83d13dda197f59145fbf53fb66 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Thu, 24 Sep 2020 14:20:13 +0000
Subject: [PATCH] community/qpid-proton: fix

---
 ...8-Fix-the-fix-so-it-works-everywhere.patch | 33 +++++++++++++++++++
 community/qpid-proton/PKGBUILD                | 12 +++++--
 2 files changed, 43 insertions(+), 2 deletions(-)
 create mode 100644 community/qpid-proton/0001-PROTON-2268-Fix-the-fix-so-it-works-everywhere.patch

diff --git a/community/qpid-proton/0001-PROTON-2268-Fix-the-fix-so-it-works-everywhere.patch b/community/qpid-proton/0001-PROTON-2268-Fix-the-fix-so-it-works-everywhere.patch
new file mode 100644
index 000000000..7eb401bda
--- /dev/null
+++ b/community/qpid-proton/0001-PROTON-2268-Fix-the-fix-so-it-works-everywhere.patch
@@ -0,0 +1,33 @@
+From ede87f48af3f9eda4fc53f0d12ff1294e07d4e3b Mon Sep 17 00:00:00 2001
+From: Andrew Stitcher <astitcher@apache.org>
+Date: Thu, 20 Aug 2020 15:47:44 -0400
+Subject: [PATCH] PROTON-2268: Fix the fix so it works everywhere
+
+---
+ c/tests/threaderciser.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/c/tests/threaderciser.c b/c/tests/threaderciser.c
+index 5f2bb626..f787bda6 100644
+--- a/c/tests/threaderciser.c
++++ b/c/tests/threaderciser.c
+@@ -57,6 +57,7 @@
+ #include <proton/netaddr.h>
+ #include <proton/proactor.h>
+ 
++#include <inttypes.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -94,7 +95,7 @@ static void debug_impl(const char *fmt, ...) {
+   char msg[256];
+   char *i = msg;
+   char *end = i + sizeof(msg);
+-  i += assert_no_err(snprintf(i, end-i, "(%lx) ", (uintptr_t) pthread_self()));
++  i += assert_no_err(snprintf(i, end-i, "(%" PRIxPTR ") ", (uintptr_t) pthread_self()));
+   if (i < end) {
+     va_list ap;
+     va_start(ap, fmt);
+-- 
+2.28.0
+
diff --git a/community/qpid-proton/PKGBUILD b/community/qpid-proton/PKGBUILD
index fadd63bd6..374e713c5 100644
--- a/community/qpid-proton/PKGBUILD
+++ b/community/qpid-proton/PKGBUILD
@@ -2,6 +2,7 @@
 
 # ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
 #  - disable LTO
+#  - upstream patch to fix 32-bit FTBFS
 
 pkgname=qpid-proton
 pkgver=0.32.0
@@ -13,8 +14,15 @@ license=('Apache')
 depends=('libjsoncpp.so' 'python')
 makedepends=('cmake' 'doxygen' 'go' 'python-setuptools' 'python-sphinx' 'python-wheel' 'swig')
 checkdepends=('python-tox')
-source=("https://www.apache.org/dist/qpid/proton/${pkgver}/qpid-proton-${pkgver}.tar.gz")
-sha512sums=('4d1265308b685d5cdd28fd8746f13704c6e36a8dc35a2c121e07b9db21cabaf440da8dd1cf76892fc366845e7f472af2c29ae94dedee19d53756bba2bd4470b6')
+source=("https://www.apache.org/dist/qpid/proton/${pkgver}/qpid-proton-${pkgver}.tar.gz"
+        '0001-PROTON-2268-Fix-the-fix-so-it-works-everywhere.patch')
+sha512sums=('4d1265308b685d5cdd28fd8746f13704c6e36a8dc35a2c121e07b9db21cabaf440da8dd1cf76892fc366845e7f472af2c29ae94dedee19d53756bba2bd4470b6'
+            '3f7cb1da9609e2af1662c5df7c3c40fd2650d5ed1a9baf96aedbb6004bf4bf6dcb8d1003e9eebf4c1e850285f6d7e2994b226864fa2a1b17dd8268f1a493a80c')
+
+prepare() {
+    cd ${pkgname}-${pkgver}
+    patch -p1 -i ../0001-PROTON-2268-Fix-the-fix-so-it-works-everywhere.patch
+}
 
 build() {
     cd ${pkgname}-${pkgver}