uwsgi: musl compat with patches from Alpine and disabling ugreen

This commit is contained in:
Eivind Uggedal 2015-08-04 16:36:24 +00:00
parent 7039811595
commit 7b856acbce
6 changed files with 191 additions and 1 deletions

View file

@ -0,0 +1,40 @@
From 1a09a7264026339d8e0c4899a2f9ff488c0bd97d Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 10 Feb 2014 12:13:00 +0000
Subject: [PATCH 1/4] use portable pthread functions instead of the
non-portable
The pthread functions pthread_mutexattr_setrobust and
pthread_mutex_consistent are in posix nowdays. Use those instead of their
non-portable synonyms.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
core/lock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/lock.c b/core/lock.c
index d368148..f806b2c 100644
--- core/lock.c
+++ core/lock.c
@@ -99,7 +99,7 @@ retry:
exit(1);
}
if (uwsgi_pthread_robust_mutexes_enabled) {
- if (pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST)) {
+ if (pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST)) {
uwsgi_log("unable to make the mutex 'robust'\n");
exit(1);
}
@@ -161,7 +161,7 @@ void uwsgi_lock_fast(struct uwsgi_lock_item *uli) {
#ifdef EOWNERDEAD
if (pthread_mutex_lock((pthread_mutex_t *) uli->lock_ptr) == EOWNERDEAD) {
uwsgi_log("[deadlock-detector] a process holding a robust mutex died. recovering...\n");
- pthread_mutex_consistent_np((pthread_mutex_t *) uli->lock_ptr);
+ pthread_mutex_consistent((pthread_mutex_t *) uli->lock_ptr);
}
#else
pthread_mutex_lock((pthread_mutex_t *) uli->lock_ptr);
--
1.8.5.3

View file

@ -0,0 +1,31 @@
From ab68dc90d3a6e3ae660adb65cf8a020d91eb8f09 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 10 Feb 2014 12:17:18 +0000
Subject: [PATCH 2/4] Check for GNU libc instead of linux for use of execinfo.h
Since execinfo.h is a GNU extension it makes more sense to check for GNU
than to assume that linux is GNU.
This is needed for building on linux with musl libc.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
core/uwsgi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/uwsgi.c b/core/uwsgi.c
index 67b175b..b3b25ae 100644
--- core/uwsgi.c
+++ core/uwsgi.c
@@ -1690,7 +1690,7 @@ void uwsgi_plugins_atexit(void) {
void uwsgi_backtrace(int depth) {
-#if defined(__linux__) || (defined(__APPLE__) && !defined(NO_EXECINFO)) || defined(UWSGI_HAS_EXECINFO)
+#if defined(__GLIBC__) || (defined(__APPLE__) && !defined(NO_EXECINFO)) || defined(UWSGI_HAS_EXECINFO)
#include <execinfo.h>
--
1.8.5.3

View file

@ -0,0 +1,64 @@
From c6ddb3e4ca72f6ec8662f8a18674eb4d861561b8 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 10 Feb 2014 13:03:50 +0000
Subject: [PATCH 3/4] always define _GNU_SOURCE for linux
We are using various extenstions that the spec say depends on _GNU_SOURCE,
for example unshare, CPU_SET, CPU_ZERO, cpu_set_t. We enable those always
for linux and we never unset it.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
uwsgi.h | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/uwsgi.h b/uwsgi.h
index b3ce4f7..3131a0f 100644
--- uwsgi.h
+++ uwsgi.h
@@ -149,29 +149,22 @@ extern "C" {
#endif
#endif
+#ifdef __linux__
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
-#include <stdio.h>
-#ifdef __UCLIBC__
-#include <sched.h>
+#ifndef __USE_GNU
+#define __USE_GNU
+#endif
#endif
-#undef _GNU_SOURCE
+#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <signal.h>
#include <math.h>
#include <sys/types.h>
-#ifdef __linux__
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#ifndef __USE_GNU
-#define __USE_GNU
-#endif
-#endif
#include <sys/socket.h>
#include <net/if.h>
#ifdef __linux__
@@ -179,7 +172,6 @@ extern "C" {
#define MSG_FASTOPEN 0x20000000
#endif
#endif
-#undef _GNU_SOURCE
#include <netinet/in.h>
#include <termios.h>
--
1.8.5.3

View file

@ -0,0 +1,34 @@
From 393de27d01710718ffedf46cbbe20c5a1d559c9e Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 10 Feb 2014 13:15:07 +0000
Subject: [PATCH 4/4] define WAIT_ANY if missing
POSIX uses -1 and does not define WAIT_ANY so we need to define it if
needed.
See:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
uwsgi.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/uwsgi.h b/uwsgi.h
index 3131a0f..7a0d93e 100644
--- uwsgi.h
+++ uwsgi.h
@@ -257,6 +257,9 @@ extern int pivot_root(const char *new_root, const char *put_old);
#include <stdint.h>
#include <sys/wait.h>
+#ifndef WAIT_ANY
+#define WAIT_ANY (-1)
+#endif
#ifdef __APPLE__
#ifndef MAC_OS_X_VERSION_MIN_REQUIRED
--
1.8.5.3

View file

@ -0,0 +1,13 @@
diff --git a/plugins/python/uwsgi_python.h b/plugins/python/uwsgi_python.h
index 0c5c1c8..5c0dc6d 100644
--- plugins/python/uwsgi_python.h
+++ plugins/python/uwsgi_python.h
@@ -1,4 +1,8 @@
#include <uwsgi.h>
+/* seems like Python.h explicitlyl redefines _GNU_SOURCE */
+#ifdef _GNU_SOURCE
+#undef _GNU_SOURCE
+#endif
#include <Python.h>
#include <frameobject.h>

View file

@ -1,7 +1,7 @@
# Template file for 'uwsgi'
pkgname=uwsgi
version=2.0.11.1
revision=2
revision=3
build_style=python-module
hostmakedepends="python-devel python-setuptools"
makedepends="sqlite-devel python-devel python-setuptools libxml2-devel"
@ -12,3 +12,11 @@ license="GPL-2"
homepage="http://projects.unbit.it/uwsgi"
distfiles="http://projects.unbit.it/downloads/uwsgi-$version.tar.gz"
checksum=75a7d3138cfa9cd81a760c2f8a43f3d80961edc8e4f27043dc1412206c926287
pre_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl)
sed -e 's/ugreen,//' -i buildconf/base.ini
;;
esac
}