pjproject: fix build with musl
authorDaniel Golle <daniel@makrotopia.org>
Fri, 19 Jun 2015 05:24:16 +0000 (07:24 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Fri, 19 Jun 2015 06:02:31 +0000 (08:02 +0200)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libs/pjproject/patches/120-non-gnu-pthreads.patch [new file with mode: 0644]

diff --git a/libs/pjproject/patches/120-non-gnu-pthreads.patch b/libs/pjproject/patches/120-non-gnu-pthreads.patch
new file mode 100644 (file)
index 0000000..e01b542
--- /dev/null
@@ -0,0 +1,66 @@
+Index: pjproject-2.4/pjlib/src/pj/os_core_unix.c
+===================================================================
+--- pjproject-2.4.orig/pjlib/src/pj/os_core_unix.c
++++ pjproject-2.4/pjlib/src/pj/os_core_unix.c
+@@ -1123,7 +1123,7 @@ static pj_status_t init_mutex(pj_mutex_t
+       return PJ_RETURN_OS_ERROR(rc);
+     if (type == PJ_MUTEX_SIMPLE) {
+-#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
++#if (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || \
+     defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
+       rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP);
+ #elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \
+@@ -1133,7 +1133,7 @@ static pj_status_t init_mutex(pj_mutex_t
+       rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
+ #endif
+     } else {
+-#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
++#if (defined(PJ_LINUX) && PJ_LINUX!=0 && defined(__GLIBC__)) || \
+      defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
+       rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
+ #elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \
+Index: pjproject-2.4/pjsip-apps/src/samples/siprtp.c
+===================================================================
+--- pjproject-2.4.orig/pjsip-apps/src/samples/siprtp.c
++++ pjproject-2.4/pjsip-apps/src/samples/siprtp.c
+@@ -1134,7 +1134,7 @@ static void boost_priority(void)
+                   PJ_RETURN_OS_ERROR(rc));
+       return;
+     }
+-    tp.__sched_priority = max_prio;
++    tp.sched_priority = max_prio;
+     rc = sched_setscheduler(0, POLICY, &tp);
+     if (rc != 0) {
+@@ -1143,7 +1143,7 @@ static void boost_priority(void)
+     }
+     PJ_LOG(4, (THIS_FILE, "New process policy=%d, priority=%d",
+-            policy, tp.__sched_priority));
++            policy, tp.sched_priority));
+     /*
+      * Adjust thread scheduling algorithm and priority
+@@ -1156,10 +1156,10 @@ static void boost_priority(void)
+     }
+     PJ_LOG(4, (THIS_FILE, "Old thread policy=%d, priority=%d",
+-            policy, tp.__sched_priority));
++            policy, tp.sched_priority));
+     policy = POLICY;
+-    tp.__sched_priority = max_prio;
++    tp.sched_priority = max_prio;
+     rc = pthread_setschedparam(pthread_self(), policy, &tp);
+     if (rc != 0) {
+@@ -1169,7 +1169,7 @@ static void boost_priority(void)
+     }
+     PJ_LOG(4, (THIS_FILE, "New thread policy=%d, priority=%d",
+-            policy, tp.__sched_priority));
++            policy, tp.sched_priority));
+ }
+ #else