summaryrefslogtreecommitdiffstats
path: root/audio-libs
diff options
context:
space:
mode:
authorIsmael Luceno2022-07-26 22:10:08 +0200
committerIsmael Luceno2022-07-26 22:12:19 +0200
commit27ab9fad51f91c5f5dea9d18a1be290d8d899c00 (patch)
tree67e3f58f62d3b3464fe35662641a824ce4f696f1 /audio-libs
parent313272eb8fdf49588bd57cd37bf3b3d4b233a3dc (diff)
rtmidi: Fix build against musl
Diffstat (limited to 'audio-libs')
-rw-r--r--audio-libs/rtmidi/HISTORY4
-rwxr-xr-xaudio-libs/rtmidi/PRE_BUILD3
-rw-r--r--audio-libs/rtmidi/patches/0001-Use-posix-sched_yield-instead-of-pthread_yield.patch42
3 files changed, 49 insertions, 0 deletions
diff --git a/audio-libs/rtmidi/HISTORY b/audio-libs/rtmidi/HISTORY
index f855fd05fa..b185ca0360 100644
--- a/audio-libs/rtmidi/HISTORY
+++ b/audio-libs/rtmidi/HISTORY
@@ -1,3 +1,7 @@
+2022-07-26 Ismael Luceno <ismael@iodev.co.uk>
+ * patches/0001-Use-posix-sched_yield-instead-of-pthread_yield.patch,
+ PRE_BUILD: fixed build against musl
+
2022-06-18 Treeve Jelbert <treeve@sourcemage.org>
* DETAILS: version 5.0.0
spell created
diff --git a/audio-libs/rtmidi/PRE_BUILD b/audio-libs/rtmidi/PRE_BUILD
new file mode 100755
index 0000000000..c230ad14bf
--- /dev/null
+++ b/audio-libs/rtmidi/PRE_BUILD
@@ -0,0 +1,3 @@
+default_pre_build &&
+cd "$SOURCE_DIRECTORY" &&
+apply_patch_dir patches
diff --git a/audio-libs/rtmidi/patches/0001-Use-posix-sched_yield-instead-of-pthread_yield.patch b/audio-libs/rtmidi/patches/0001-Use-posix-sched_yield-instead-of-pthread_yield.patch
new file mode 100644
index 0000000000..e26e163348
--- /dev/null
+++ b/audio-libs/rtmidi/patches/0001-Use-posix-sched_yield-instead-of-pthread_yield.patch
@@ -0,0 +1,42 @@
+From cfe34c02112c256235b62b45895fc2c401fd874d Mon Sep 17 00:00:00 2001
+From: Niclas Rosenvik <youremailsarecrap@gmail.com>
+Date: Sun, 19 Dec 2021 13:56:27 +0100
+Subject: [PATCH] Use posix sched_yield instead of pthread_yield
+
+Use posix sched_yield instead of pthread_yield.
+pthread_yield is linux specific sched_yield is
+a standard posix function. pthread_yield on linux
+is implemented using sched_yield.
+This makes the jack plugin work on other
+platforms than linux.
+
+Upstream-Status: Backport [commit cfe34c02112c256235b62b45895fc2c401fd874d]
+Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
+---
+ RtMidi.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/RtMidi.cpp b/RtMidi.cpp
+index 6a1c89e670e6..88b55e1880aa 100644
+--- a/RtMidi.cpp
++++ b/RtMidi.cpp
+@@ -3092,6 +3092,7 @@ void MidiOutWinMM :: sendMessage( const unsigned char *message, size_t size )
+ #include <jack/midiport.h>
+ #include <jack/ringbuffer.h>
+ #include <pthread.h>
++#include <sched.h>
+ #ifdef HAVE_SEMAPHORE
+ #include <semaphore.h>
+ #endif
+@@ -3608,7 +3609,7 @@ void MidiOutJack :: sendMessage( const unsigned char *message, size_t size )
+ return;
+
+ while ( jack_ringbuffer_write_space(data->buff) < sizeof(nBytes) + size )
+- pthread_yield();
++ sched_yield();
+
+ // Write full message to buffer
+ jack_ringbuffer_write( data->buff, ( char * ) &nBytes, sizeof( nBytes ) );
+--
+2.36.0
+