waffle: Fix build with musl

Backport needed patches for compilation fixes on musl

(From OE-Core rev: d19772d1f3c9d0a06c10dfb246bb156b575a14c5)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2015-09-25 04:59:17 +00:00
committed by Richard Purdie
parent cfa3ed00b3
commit 5942dfec50
2 changed files with 57 additions and 1 deletions

View File

@@ -0,0 +1,54 @@
From 3b9b8f5f6d1b99af43e95ec0868404e552a85b73 Mon Sep 17 00:00:00 2001
From: Emil Velikov <emil.l.velikov@gmail.com>
Date: Thu, 19 Mar 2015 22:26:11 +0000
Subject: [PATCH] third_party/threads: Use PTHREAD_MUTEX_RECURSIVE by default
PTHREAD_MUTEX_RECURSIVE_NP was used for compatibility with old glibc.
Although due to the_GNU_SOURCES define the portable,
PTHREAD_MUTEX_RECURSIVE will be available for Linuxes since at least
1998. Simplify things giving us compatibility with musl which
apparently does not provide the non-portable define.
Inspired by almost identical commit in mesa aead7fe2e2b(c11/threads: Use
PTHREAD_MUTEX_RECURSIVE by default) by Felix Janda.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
---
Upstream-Status: Backport
third_party/threads/threads_posix.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/third_party/threads/threads_posix.c b/third_party/threads/threads_posix.c
index 5835e43..e122bf9 100644
--- a/third_party/threads/threads_posix.c
+++ b/third_party/threads/threads_posix.c
@@ -26,6 +26,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+
+#define _GNU_SOURCE
+
#include <stdlib.h>
#ifndef assert
#include <assert.h>
@@ -150,13 +153,8 @@ int mtx_init(mtx_t *mtx, int type)
&& type != (mtx_try|mtx_recursive))
return thrd_error;
pthread_mutexattr_init(&attr);
- if ((type & mtx_recursive) != 0) {
-#if defined(__linux__) || defined(__linux)
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
-#else
+ if ((type & mtx_recursive) != 0)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-#endif
- }
pthread_mutex_init(mtx, &attr);
pthread_mutexattr_destroy(&attr);
return thrd_success;
--
2.5.2

View File

@@ -3,7 +3,9 @@ LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=4c5154407c2490750dd461c50ad94797 \
file://include/waffle/waffle.h;endline=24;md5=61dbf8697f61c78645e75a93c585b1bf"
SRC_URI = "http://waffle-gl.org/files/release/${BPN}-${PV}/${BPN}-${PV}.tar.xz"
SRC_URI = "http://waffle-gl.org/files/release/${BPN}-${PV}/${BPN}-${PV}.tar.xz \
file://0001-third_party-threads-Use-PTHREAD_MUTEX_RECURSIVE-by-d.patch \
"
SRC_URI[md5sum] = "c0d802bc3d0aba87c51e423a3a8bdd69"
SRC_URI[sha256sum] = "cbab0e926515064e818bf089a5af04be33307e5f40d07659fb40d59b2bfe20aa"