csound: fix build for musl

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2019-04-04 02:07:30 +02:00
parent 721de0c32f
commit 0034a27281
4 changed files with 152 additions and 0 deletions

View File

@@ -34,6 +34,9 @@ SRC_URI = " \
file://0006-fixed-unsafe-use-of-strncpy.patch \
file://0007-util1-csd_util-cs.c-Fix-build-with-gcc8.patch \
file://0008-Fix-build-with-fluidsynth-version-2.0.0.patch \
file://0009-Fix-build-for-linux-musl.patch \
file://0010-threadsafe.c-Fix-unused-valable-warning-error.patch \
file://0011-Use-POSIX-conform-location-for-errno.h.patch \
"
SRCREV = "2905724262b516983e779ed8c589602da4bf3f7d"
S = "${WORKDIR}/git"

View File

@@ -0,0 +1,60 @@
From cdcad764c01084d435c17e6a57450ca4a066705c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Wed, 3 Apr 2019 20:50:18 +0200
Subject: [PATCH] Fix build for linux/musl
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Musl (and myabe other libc libraries) does not have execinfo.h. So instead
of assuming the header existant for all linux environments check for the file.
Upstream-Status: Applied [1]
[1] https://github.com/csound/csound/commit/7f93585037a41fbff22ce49d3bbde0d66eb7530b
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
CMakeLists.txt | 5 ++++-
Top/csound.c | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5a8e1bed..90bca5950 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -603,7 +603,7 @@ set(HEADERS_TO_CHECK
unistd.h io.h fcntl.h stdint.h
sys/time.h sys/types.h termios.h
values.h winsock.h sys/socket.h
- dirent.h inttypes.h)
+ dirent.h inttypes.h execinfo.h)
foreach(header ${HEADERS_TO_CHECK})
# Convert to uppercase and replace [./] with _
@@ -617,6 +617,9 @@ if (NOT HAVE_INTTYPES_H)
message(FATAL_ERROR "Csound requires inttypes.h")
endif()
+if (HAVE_EXECINFO_H)
+ add_definitions("-DHAVE_EXECINFO")
+endif()
check_deps(USE_LRINT HAVE_LRINT)
if(USE_LRINT)
diff --git a/Top/csound.c b/Top/csound.c
index 9b95674df..48a53717a 100644
--- a/Top/csound.c
+++ b/Top/csound.c
@@ -1157,7 +1157,7 @@ static void psignal_(int sig, char *str)
static void signal_handler(int sig)
{
-#if defined(LINUX) && !defined(ANDROID) && !defined(NACL)
+#if defined(HAVE_EXECINFO) && !defined(ANDROID) && !defined(NACL)
#include <execinfo.h>
{
--
2.20.1

View File

@@ -0,0 +1,43 @@
From d91048c4943e81dafcdb2db701fe04c0a9d6e0b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Wed, 3 Apr 2019 21:01:24 +0200
Subject: [PATCH] threadsafe.c: Fix unused valable warning/error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
| Top/threadsafe.c:537:5: error: variable 'x' set but not used [-Werror=unused-but-set-variable]
| } x;
| ^
| cc1: all warnings being treated as errors
Upstream-Status: Applied [1]
[1] https://github.com/csound/csound/commit/0c7fee69278933a3eb108d17a641ab4ecabde7c6
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
Top/threadsafe.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Top/threadsafe.c b/Top/threadsafe.c
index 3a7278459..6214a1b5e 100644
--- a/Top/threadsafe.c
+++ b/Top/threadsafe.c
@@ -531,11 +531,13 @@ MYFLT csoundGetControlChannel(CSOUND *csound, const char *name, int *err)
void csoundSetControlChannel(CSOUND *csound, const char *name, MYFLT val){
MYFLT *pval;
+#if defined(MSVC) || defined(HAVE_ATOMIC_BUILTIN)
union {
MYFLT d;
MYFLT_INT_TYPE i;
} x;
x.d = val;
+#endif
if (csoundGetChannelPtr(csound, &pval, name,
CSOUND_CONTROL_CHANNEL | CSOUND_INPUT_CHANNEL)
== CSOUND_SUCCESS)
--
2.20.1

View File

@@ -0,0 +1,46 @@
From 6d86d9c96c01eb74591c83e3f09bfaf46bca445f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Wed, 3 Apr 2019 21:17:30 +0200
Subject: [PATCH] Use POSIX conform location for errno.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On its POSIX-correctness crusade musl spits out a warning which ends as error:
| In file included from /home/superandy/tmp/oe-core-musl/work/cortexa7t2hf-neon-vfpv4-mortsgna-linux-musleabi/csound/6.12-r0/git/Opcodes/linuxjoystick.c:39:
| /home/superandy/tmp/oe-core-musl/work/cortexa7t2hf-neon-vfpv4-mortsgna-linux-musleabi/csound/6.12-r0/recipe-sysroot/usr/include/sys/errno.h:1:2: error: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Werror=cpp]
| #warning redirecting incorrect #include <sys/errno.h> to <errno.h>
| ^~~~~~~
| cc1: all warnings being treated as errors
Yes that is 'correct' [1] as musl claims itself [2] but...
[1] http://pubs.opengroup.org/onlinepubs/000095399/basedefs/errno.h.html
[2] https://www.musl-libc.org/
Upstream-Status: Applied [3]
[3] https://github.com/csound/csound/commit/38da4f1c1d93377d3ff90e15be8998f9408faf34
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
Opcodes/linuxjoystick.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Opcodes/linuxjoystick.c b/Opcodes/linuxjoystick.c
index 348f49168..a56ad18e3 100644
--- a/Opcodes/linuxjoystick.c
+++ b/Opcodes/linuxjoystick.c
@@ -36,7 +36,7 @@
*/
#include "linuxjoystick.h"
-#include <sys/errno.h>
+#include <errno.h>
static int32_t linuxjoystick (CSOUND *csound, LINUXJOYSTICK *stick)
{
--
2.20.1