From 9bf8de1c0aa1898d48dd87cc997621b3c96766d7 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Mon, 6 Jun 2016 16:28:08 +0200 Subject: [PATCH] ladish: fix musl build --- srcpkgs/ladish/patches/musl-no-dlvsym.patch | 42 ++++++++++ srcpkgs/ladish/patches/musl-no-execinfo.patch | 29 +++++++ srcpkgs/ladish/patches/musl-pid_t.patch | 21 +++++ srcpkgs/ladish/patches/musl-stdout.patch | 83 +++++++++++++++++++ 4 files changed, 175 insertions(+) create mode 100644 srcpkgs/ladish/patches/musl-no-dlvsym.patch create mode 100644 srcpkgs/ladish/patches/musl-no-execinfo.patch create mode 100644 srcpkgs/ladish/patches/musl-pid_t.patch create mode 100644 srcpkgs/ladish/patches/musl-stdout.patch diff --git a/srcpkgs/ladish/patches/musl-no-dlvsym.patch b/srcpkgs/ladish/patches/musl-no-dlvsym.patch new file mode 100644 index 00000000000..966d62679b7 --- /dev/null +++ b/srcpkgs/ladish/patches/musl-no-dlvsym.patch @@ -0,0 +1,42 @@ +--- alsapid/lib.c.orig 2016-06-06 16:35:46.734195397 +0200 ++++ alsapid/lib.c 2016-06-06 16:35:54.209195783 +0200 +@@ -73,16 +73,29 @@ + //static int (* real_snd_seq_create_port)(snd_seq_t * handle, snd_seq_port_info_t * info); + //static int (* real_snd_seq_create_simple_port)(snd_seq_t * seq, const char * name, unsigned int caps, unsigned int type); + +-#define CHECK_FUNC(func) \ +- if (real_ ## func == NULL) \ +- { \ +- real_ ## func = dlvsym(RTLD_NEXT, #func, API_VERSION); \ +- if (real_ ## func == NULL) \ +- { \ +- fprintf(stderr, "dlvsym(\""#func"\", \""API_VERSION"\") failed. %s\n", dlerror()); \ +- return -1; \ +- } \ +- } ++#if defined(__GLIBC__) ++ #define CHECK_FUNC(func) \ ++ if (real_ ## func == NULL) \ ++ { \ ++ real_ ## func = dlvsym(RTLD_NEXT, #func, API_VERSION); \ ++ if (real_ ## func == NULL) \ ++ { \ ++ fprintf(stderr, "dlvsym(\""#func"\", \""API_VERSION"\") failed. %s\n", dlerror()); \ ++ return -1; \ ++ } \ ++ } ++#else ++ #define CHECK_FUNC(func) \ ++ if (real_ ## func == NULL) \ ++ { \ ++ real_ ## func = dlsym(RTLD_NEXT, #func); \ ++ if (real_ ## func == NULL) \ ++ { \ ++ fprintf(stderr, "dlsym(\""#func"\") failed. %s\n", dlerror()); \ ++ return -1; \ ++ } \ ++ } ++#endif + + #if 0 + LADISH_PUBLIC diff --git a/srcpkgs/ladish/patches/musl-no-execinfo.patch b/srcpkgs/ladish/patches/musl-no-execinfo.patch new file mode 100644 index 00000000000..15e2e6d022b --- /dev/null +++ b/srcpkgs/ladish/patches/musl-no-execinfo.patch @@ -0,0 +1,29 @@ +--- daemon/sigsegv.c.orig 2016-06-06 16:11:21.506119807 +0200 ++++ daemon/sigsegv.c 2016-06-06 16:11:26.667120074 +0200 +@@ -39,7 +39,9 @@ + #include + #include + #include ++#if defined(__GLIBC__) + #include ++#endif + #include + #ifndef NO_CPP_DEMANGLE + //#include +@@ -154,13 +156,15 @@ + ip = bp[1]; + bp = (void**)bp[0]; + } +-#else ++#elif defined(__GLIBC__) + log_error("Stack trace (non-dedicated):"); + sz = backtrace(bt, 20); + strings = backtrace_symbols(bt, sz); + + for(i = 0; i < sz; ++i) + log_error("%s", strings[i]); ++#else ++ log_error("Stack trace not available"); + #endif + log_error("End of stack trace"); + #endif diff --git a/srcpkgs/ladish/patches/musl-pid_t.patch b/srcpkgs/ladish/patches/musl-pid_t.patch new file mode 100644 index 00000000000..8dbc596f9bd --- /dev/null +++ b/srcpkgs/ladish/patches/musl-pid_t.patch @@ -0,0 +1,21 @@ +--- proxies/graph_proxy.h.orig 2016-06-06 16:05:42.186102302 +0200 ++++ proxies/graph_proxy.h 2016-06-06 16:06:09.741103724 +0200 +@@ -28,7 +28,7 @@ + #define GRAPH_PROXY_H__61D1ED56_E33B_4F50_B45B_F520979E8AA7__INCLUDED + + #include "common.h" +- ++#include /* pid_t */ + typedef struct graph_proxy_tag { int unused; } * graph_proxy_handle; + + #ifdef __cplusplus +--- alsapid/alsapid.h.orig 2016-06-06 16:26:09.314165609 +0200 ++++ alsapid/alsapid.h 2016-06-06 16:26:23.903166361 +0200 +@@ -28,6 +28,7 @@ + #define ALSAPID_H__0A27F284_7538_4791_8023_0FBED929EAF3__INCLUDED + + #include "../common.h" ++#include /* pid_t */ + + void alsapid_compose_src_link(int alsa_client_id, char * buffer); + void alsapid_compose_dst_link(char * buffer); diff --git a/srcpkgs/ladish/patches/musl-stdout.patch b/srcpkgs/ladish/patches/musl-stdout.patch new file mode 100644 index 00000000000..b5829993a6f --- /dev/null +++ b/srcpkgs/ladish/patches/musl-stdout.patch @@ -0,0 +1,83 @@ +--- daemon/loader.c.orig 2016-06-06 16:42:34.970216458 +0200 ++++ daemon/loader.c 2016-06-06 16:42:42.293216836 +0200 +@@ -59,13 +59,13 @@ + + bool terminal; + +- int stdout; ++ int stdout_fd; + char stdout_buffer[CLIENT_OUTPUT_BUFFER_SIZE]; + char stdout_last_line[CLIENT_OUTPUT_BUFFER_SIZE]; + unsigned int stdout_last_line_repeat_count; + char * stdout_buffer_ptr; + +- int stderr; ++ int stderr_fd; + char stderr_buffer[CLIENT_OUTPUT_BUFFER_SIZE]; + char stderr_last_line[CLIENT_OUTPUT_BUFFER_SIZE]; + unsigned int stderr_last_line_repeat_count; +@@ -149,8 +149,8 @@ + + if (!child_ptr->terminal) + { +- close(child_ptr->stdout); +- close(child_ptr->stderr); ++ close(child_ptr->stdout_fd); ++ close(child_ptr->stderr_fd); + } + + g_on_child_exit(child_ptr->pid); +@@ -462,7 +462,7 @@ + loader_read_child_output( + child_ptr->vgraph_name, + child_ptr->app_name, +- child_ptr->stdout, ++ child_ptr->stdout_fd, + false, + child_ptr->stdout_buffer, + &child_ptr->stdout_buffer_ptr, +@@ -472,7 +472,7 @@ + loader_read_child_output( + child_ptr->vgraph_name, + child_ptr->app_name, +- child_ptr->stderr, ++ child_ptr->stderr_fd, + true, + child_ptr->stderr_buffer, + &child_ptr->stderr_buffer_ptr, +@@ -585,9 +585,9 @@ + } + else + { +- child_ptr->stderr = stderr_pipe[0]; ++ child_ptr->stderr_fd = stderr_pipe[0]; + +- if (fcntl(child_ptr->stderr, F_SETFL, O_NONBLOCK) == -1) ++ if (fcntl(child_ptr->stderr_fd, F_SETFL, O_NONBLOCK) == -1) + { + log_error("Failed to set nonblocking mode on " + "stderr reading end: %s", +@@ -603,7 +603,7 @@ + if (!run_in_terminal) + { + /* We need pty to disable libc buffering of stdout */ +- pid = forkpty(&child_ptr->stdout, NULL, NULL, NULL); ++ pid = forkpty(&child_ptr->stdout_fd, NULL, NULL, NULL); + } + else + { +@@ -650,12 +650,12 @@ + /* In parent, close unused writing ends of pipe */ + close(stderr_pipe[1]); + +- if (fcntl(child_ptr->stdout, F_SETFL, O_NONBLOCK) == -1) ++ if (fcntl(child_ptr->stdout_fd, F_SETFL, O_NONBLOCK) == -1) + { + log_error("Could not set noblocking mode on stdout " + "- pty: %s", strerror(errno)); + close(stderr_pipe[0]); +- close(child_ptr->stdout); ++ close(child_ptr->stdout_fd); + } + } +