summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Marangi2025-11-25 12:39:59 +0000
committerChristian Marangi2025-11-25 12:41:11 +0000
commit41541bf30e00efdb70c6229bf886cb5b454cb500 (patch)
treee95cbdc6de0997ca086bed80685ea9c299b4989a
parentb0e9371cb15216c64d10a0526a078bdb278156df (diff)
downloadopenwrt-41541bf30e00efdb70c6229bf886cb5b454cb500.tar.gz
libunistring: fix compilation error with MUSL
MUSL doesn't provide PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP as it's only glibc and as the MACRO say, it's NP (not portable). Add patch to check for this and disable overwriting the function accordingly. Fixes: 9bdf72347640 ("libunistring: update to 1.4.1") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-rw-r--r--package/libs/libunistring/patches/100-tests-pthread-rwlock-better-support-MUSL.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/package/libs/libunistring/patches/100-tests-pthread-rwlock-better-support-MUSL.patch b/package/libs/libunistring/patches/100-tests-pthread-rwlock-better-support-MUSL.patch
new file mode 100644
index 0000000000..eea6efd59c
--- /dev/null
+++ b/package/libs/libunistring/patches/100-tests-pthread-rwlock-better-support-MUSL.patch
@@ -0,0 +1,36 @@
+From bdd92b59fe63553712fba57cc64cf8fe6e3e824a Mon Sep 17 00:00:00 2001
+From: Christian Marangi <ansuelsmth@gmail.com>
+Date: Tue, 25 Nov 2025 13:25:28 +0100
+Subject: [PATCH] tests: pthread-rwlock: better support MUSL
+
+MUSL doesn't provide PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP as
+it's only glibc and as the MACRO say, it's NP (not portable).
+
+Check for the presence of it and disable overwriting the function
+accordingly.
+
+Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+---
+ tests/pthread-rwlock.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/tests/pthread-rwlock.c
++++ b/tests/pthread-rwlock.c
+@@ -49,7 +49,7 @@ pthread_rwlockattr_destroy (_GL_UNUSED p
+ return 0;
+ }
+
+-#elif PTHREAD_RWLOCK_BAD_WAITQUEUE
++#elif PTHREAD_RWLOCK_BAD_WAITQUEUE && defined PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
+
+ /* Override pthread_rwlockattr_init, to use the kind PREFER_WRITER_NONRECURSIVE
+ (or possibly PREFER_WRITER) instead of the kind DEFAULT. */
+@@ -388,7 +388,7 @@ pthread_rwlock_destroy (pthread_rwlock_t
+
+ # else
+
+-# if PTHREAD_RWLOCK_BAD_WAITQUEUE
++# if PTHREAD_RWLOCK_BAD_WAITQUEUE && defined PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
+
+ /* Override pthread_rwlock_init, to use the kind PREFER_WRITER_NONRECURSIVE
+ (or possibly PREFER_WRITER) instead of the default, when no