From 41393a878a96874c4e292fff7302a9fc599ef080 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Wed, 18 Jan 2017 20:40:57 +0000
Subject: [PATCH] community/uwsgi to 2.0.14-7

---
 community/uwsgi/PKGBUILD            | 31 +++++++++++++++--------------
 community/uwsgi/uwsgi_php_7.1.patch | 30 ++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 15 deletions(-)
 create mode 100644 community/uwsgi/uwsgi_php_7.1.patch

diff --git a/community/uwsgi/PKGBUILD b/community/uwsgi/PKGBUILD
index d42e5a7c5..090889f8c 100644
--- a/community/uwsgi/PKGBUILD
+++ b/community/uwsgi/PKGBUILD
@@ -24,7 +24,7 @@ pkgname=(uwsgi
          uwsgi-plugin-webdav
          mod_proxy_uwsgi)
 pkgver=2.0.14
-pkgrel=6
+pkgrel=7
 arch=(i686 x86_64)
 url="http://projects.unbit.it/$pkgbase"
 license=(GPL2)
@@ -34,7 +34,7 @@ makedepends=(gcc python python2 ruby python2-greenlet python-greenlet php-embed
              perl lua51 pcre libedit openssl bzip2 gmp pam java-environment=7
              jansson classpath mono python2-gevent apache)
 optdepends=('systemd: daemon scripts')
-source=(http://projects.unbit.it/downloads/$pkgbase-$pkgver.tar.gz
+source=("https://projects.unbit.it/downloads/$pkgbase-$pkgver.tar.gz"
         uwsgiplugin.py::https://raw.githubusercontent.com/unbit/uwsgi/9787f6882c2475aa9873e400988160b17dd04545/plugins/systemd_logger/uwsgiplugin.py
         archlinux.ini
         tmpfilesd
@@ -42,26 +42,27 @@ source=(http://projects.unbit.it/downloads/$pkgbase-$pkgver.tar.gz
         uwsgi_at.socket
         uwsgi_ruby20_compatibility.patch
         uwsgi_trick_chroot.patch
+        uwsgi_php_7.1.patch
         emperor.ini
         emperor.uwsgi.service
         emperor.uwsgi.socket)
-
-md5sums=('d4b2c7db274dc20be54a977c9b040b7e'
-         'd3c9f32479d816208c3620a782fa5246'
-         '9aced0faffc5fc04afccf946e8a2a886'
-         '752475ee32286acfbafa49b898616817'
-         'feaf107977aec047101acdbf06810f30'
-         'ea381549fe65a5d72fa1abb5ceb7d3ef'
-         '4d09535ce379c8acd76160f35d5d6b55'
-         'a49705b98c28dee890b2f88cbaa58be3'
-         '5fa14ddea9a3dae17b5be28468d47b80'
-         '25dfcc365241f16d7ea16f7143698b53'
-         '3ab4486e02f5c217566fb6c8d469c246')
+sha512sums=('cf557ba27cb1c28e784e8909043bca874cd56846aa9ebaf1ff229191ad20484e467147a6ea7cc629399d4afd6e4ac4479b2f6827729df04321eef4bf842b9e42'
+            '68eef703de39cb336915e1e9c36b11c65c2d46482407b0234ca245df0e052952abb7dd85b0a1cd4507c78356a3b7a55424524b3aa0997b559b51e7b20eab5e16'
+            'acfe9fb089d1905c3d736dbeaaef7eb1848b4ce8d1f585de653086cf7f90c166a1e493d0b62ba030a4bcf2eca9c919e0d6deea2ea1c0bcb8533d7cb040d2f67c'
+            '4def9dcd06cfc2c6ce554add9d9545a01f3bb2681f0a2a6fc4ba68f91011111803a955cc41b5e70832ca448b196109368fdf874e81b7ec0edee4b51f864e16f7'
+            'c0c1a5c2d31cdb7e0dc878ea3d0b6025532fb640ae7cf4d5f1eed2f89987e625c8dc7844d367283ed560fb3ef37915e3e9199be2e1b06fc4586ca862a653b4b5'
+            'fb51a4d102a1bc7d9f7d4c4f310ee65076bcfbc94b47e2dafdf9b20e99a661c5f938185dcf698437d81409376f0276b966f09b13c8a29462c48612df43c3f3ef'
+            '162ca1be96282b32e8e6be919b6315bfd08954c491056958985bf99e7f5bdad3511665f059329d6cb6ef5d222f9aa11d4dc43c72e6a963ab941ada959fe8d964'
+            'bc30f8ec69abd14fb96ada5b36cf65811a7a63ee27e224fcb6ceabe9935c1f17379cd872149a17da3d590b8ff60fbe7f77140d777aaf06e25e83388f897f611d'
+            'f973136c51ec0847ac6b3c3eb6ad45a1d137ada69e79a966ea92076ce29166b1f0b92b83d10b18153e48772a22c4b67a52a9e6c55a966c00f0cd0db644bb829f'
+            '41cc29ea14ca87749959379ead773d9a3a499c6bc7be17800e06e33c998a929ae855c9ad0fe2039e26a034c24d2845833945333442b98d7c6f0924aa2a036b1b'
+            '83a6859d729bf186236aaa7fb7433415f6b985f17e05b7ac571d8919bbf1fb9bd577b4f673d9787dea09752e3d8043f47ce3d9c7d5690faaa1365e477e6c9388'
+            '592c85270f43b37e9c51aae126533830515b96fff9fcae969ee865fe173bd0550c7729530d5ff1e44ffee43cd5c78c96688ce091c677a4196379e24983c0180e')
 
 prepare() {
     cd $srcdir/$pkgbase-$pkgver
     cp $srcdir/archlinux.ini buildconf/archlinux.ini
-    for patch in uwsgi_ruby20_compatibility.patch uwsgi_trick_chroot.patch; do
+    for patch in uwsgi_ruby20_compatibility.patch uwsgi_trick_chroot.patch uwsgi_php_7.1.patch; do
         msg2 "Applying $patch"
         patch -Np1 -i $srcdir/$patch
     done
diff --git a/community/uwsgi/uwsgi_php_7.1.patch b/community/uwsgi/uwsgi_php_7.1.patch
new file mode 100644
index 000000000..924f40990
--- /dev/null
+++ b/community/uwsgi/uwsgi_php_7.1.patch
@@ -0,0 +1,30 @@
+From 03dc7e49433defbe47b0c900c86b0968eeda174c Mon Sep 17 00:00:00 2001
+From: Damjan Georgievski <gdamjan@gmail.com>
+Date: Tue, 10 Jan 2017 01:20:25 +0100
+Subject: [PATCH] fix compilation with php 7.1
+
+php 7.1 changed the signature of the log_message function in
+sapi_module_struct. Let's assume it will stay like this for all versions >= 7.1
+
+fixes #1427
+---
+ plugins/php/php_plugin.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c
+index 7440d55..78d980f 100644
+--- a/plugins/php/php_plugin.c
++++ b/plugins/php/php_plugin.c
+@@ -568,8 +568,11 @@ static int php_uwsgi_startup(sapi_module_struct *sapi_module)
+ 	}
+ }
+ 
++#if ((PHP_MAJOR_VERSION >= 7) && (PHP_MINOR_VERSION >= 1))
++static void sapi_uwsgi_log_message(char *message, int syslog_type_int) {
++#else
+ static void sapi_uwsgi_log_message(char *message TSRMLS_DC) {
+-
++#endif
+ 	uwsgi_log("%s\n", message);
+ }
+