From 03b7a1d1324f883b735b5842f47aa3cabb63f556 Mon Sep 17 00:00:00 2001 From: uriahheep Date: Wed, 23 Sep 2015 21:39:14 -0400 Subject: [PATCH] wvstreams: add musl support --- .../patches/wvstreams-4.6.1-argp-fpic.patch | 28 ++++ .../wvstreams-4.6.1-modulemgr-limits.patch | 11 ++ .../wvstreams-4.6.1-wvconfemu-execinfo.patch | 20 +++ .../wvstreams-4.6.1-wvcrash-basename.patch | 11 ++ .../wvstreams-4.6.1-wvcrash-execinfo.patch | 50 ++++++++ ...vstreams-4.6.1-wvtask-libc_stack_end.patch | 11 ++ .../wvstreams-4.6.1-wvtask-ucontext.patch | 120 ++++++++++++++++++ srcpkgs/wvstreams/template | 2 +- 8 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/wvstreams/patches/wvstreams-4.6.1-argp-fpic.patch create mode 100644 srcpkgs/wvstreams/patches/wvstreams-4.6.1-modulemgr-limits.patch create mode 100644 srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvconfemu-execinfo.patch create mode 100644 srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvcrash-basename.patch create mode 100644 srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvcrash-execinfo.patch create mode 100644 srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvtask-libc_stack_end.patch create mode 100644 srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvtask-ucontext.patch diff --git a/srcpkgs/wvstreams/patches/wvstreams-4.6.1-argp-fpic.patch b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-argp-fpic.patch new file mode 100644 index 0000000000..0dead8ecc6 --- /dev/null +++ b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-argp-fpic.patch @@ -0,0 +1,28 @@ +Build argp object files with -fPIC. + +The argp bundled dependency is linked to the libwvutils.so shared library. +MIPS will refuce to link a non-PIC library with a shared one. + +We fix this problem by building the argp source files using -fPIC since +the libargp static library will only be used to link to libwvutils.so +as instructed by the following rule in the root Makefile: + +ifeq ($(USE_WVSTREAMS_ARGP),1) + utils/wvargs.o-CPPFLAGS += -Iargp + libwvutils.so-LIBS += -Largp -largp + +Signed-off-by: Markos Chandras + +Index: argp/Makefile.in +=================================================================== +--- argp/Makefile.in.old ++++ argp/Makefile.in +@@ -137,7 +137,7 @@ AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ +-CFLAGS = @CFLAGS@ ++CFLAGS = @CFLAGS@ -fPIC + CPP = @CPP@ + CPPFLAGS = @CPPFLAGS@ + CYGPATH_W = @CYGPATH_W@ diff --git a/srcpkgs/wvstreams/patches/wvstreams-4.6.1-modulemgr-limits.patch b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-modulemgr-limits.patch new file mode 100644 index 0000000000..22bfccb93e --- /dev/null +++ b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-modulemgr-limits.patch @@ -0,0 +1,11 @@ +--- xplc/modulemgr.cc.old 2015-09-23 21:09:18.684676331 -0400 ++++ xplc/modulemgr.cc 2015-09-23 21:07:19.369914303 -0400 +@@ -30,7 +30,5 @@ + # include + #endif +-#ifdef HAVE_LIMITS_H +-# include ++#include +-#endif + + #if !defined(WIN32) diff --git a/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvconfemu-execinfo.patch b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvconfemu-execinfo.patch new file mode 100644 index 0000000000..b3146020f2 --- /dev/null +++ b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvconfemu-execinfo.patch @@ -0,0 +1,20 @@ +--- uniconf/wvconfemu.cc.old 2015-09-22 02:07:38.395970444 -0400 ++++ uniconf/wvconfemu.cc 2015-09-22 02:02:26.111102649 -0400 +@@ -11,7 +11,7 @@ + #include "strutils.h" + + //#define DEBUG_DEL_CALLBACK 1 +-#ifdef DEBUG_DEL_CALLBACK ++#if defined(DEBUG_DEL_CALLBACK) && defined(HAVE_EXECINFO_H) + #include + #endif + +@@ -338,7 +338,7 @@ + return; + } + +-#ifdef DEBUG_DEL_CALLBACK ++#if defined(DEBUG_DEL_CALLBACK) && defined(HAVE_EXECINFO_H) + void* trace[10]; + int count = backtrace(trace, sizeof(trace)/sizeof(trace[0])); + char** tracedump = backtrace_symbols(trace, count); diff --git a/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvcrash-basename.patch b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvcrash-basename.patch new file mode 100644 index 0000000000..21409a777c --- /dev/null +++ b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvcrash-basename.patch @@ -0,0 +1,11 @@ +--- utils/wvcrash.cc.old 2015-09-22 02:27:09.219293510 -0400 ++++ utils/wvcrash.cc 2015-09-22 02:37:15.577967752 -0400 +@@ -409,7 +409,7 @@ + void wvcrash_setup(const char *_argv0, const char *_desc) + { + if (_argv0) +- argv0 = basename(_argv0); ++ argv0 = strrchr(_argv0, '/') ? strrchr(_argv0, '/')+1 : _argv0; + __wvcrash_init_buffers(argv0); + if (_desc) + { diff --git a/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvcrash-execinfo.patch b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvcrash-execinfo.patch new file mode 100644 index 0000000000..dd65da67b8 --- /dev/null +++ b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvcrash-execinfo.patch @@ -0,0 +1,50 @@ +--- utils/wvcrash.cc.old 2015-09-22 01:51:19.515241821 -0400 ++++ utils/wvcrash.cc 2015-09-22 01:53:44.101443017 -0400 +@@ -28,7 +28,10 @@ + // FIXME: this file mostly only works in Linux + #ifdef __linux + ++#ifdef HAVE_EXECINFO_H + # include ++#endif ++ + #include + + #ifdef __USE_GNU +@@ -268,8 +271,10 @@ + } + + wr(fd, "\nBacktrace:\n"); ++#ifdef HAVE_EXECINFO_H + backtrace_symbols_fd(trace, + backtrace(trace, sizeof(trace)/sizeof(trace[0])), fd); ++#endif + + if (pid > 0) + { +@@ -451,6 +456,7 @@ + * ctx.ContextFlags = CONTEXT_FULL; + * GetThreadContext(hThread, &ctx); + */ ++#ifdef HAVE_EXECINFO_H + int backtrace(CONTEXT &ctx) + { + HANDLE hProcess = (HANDLE)GetCurrentProcess(); +@@ -521,6 +527,7 @@ + + return 1; + } ++#endif + + + static void exception_desc(FILE *file, unsigned exception, +@@ -588,7 +595,9 @@ + fprintf(stderr, "Exception 0x%08X:\n ", info->exception); + exception_desc(stderr, info->exception, info->data1, info->data2); + fprintf(stderr, "\n at instruction 0x%08X in thread 0x%08X\n", info->ip, GetCurrentThreadId()); ++#ifdef HAVE_EXECINFO_H + backtrace(*pExceptionPointers->ContextRecord); ++#endif + fprintf(stderr, "--------------------------------------------------------\n"); + + diff --git a/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvtask-libc_stack_end.patch b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvtask-libc_stack_end.patch new file mode 100644 index 0000000000..3476741135 --- /dev/null +++ b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvtask-libc_stack_end.patch @@ -0,0 +1,11 @@ +--- utils/wvtask.cc.old 2015-09-22 05:49:32.911132004 -0400 ++++ utils/wvtask.cc 2015-09-22 05:50:36.230115961 -0400 +@@ -540,7 +540,7 @@ + + const void *WvTaskMan::current_top_of_stack() + { +-#ifdef HAVE_LIBC_STACK_END ++#if defined(HAVE_LIBC_STACK_END) && defined(__GLIBC__) + extern const void *__libc_stack_end; + if (use_shared_stack() || current_task == NULL) + return __libc_stack_end; diff --git a/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvtask-ucontext.patch b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvtask-ucontext.patch new file mode 100644 index 0000000000..dd54d15ec0 --- /dev/null +++ b/srcpkgs/wvstreams/patches/wvstreams-4.6.1-wvtask-ucontext.patch @@ -0,0 +1,120 @@ +--- utils/wvtask.cc.old 2015-09-22 05:49:32.911132004 -0400 ++++ utils/wvtask.cc 2015-09-22 06:48:44.627809854 -0400 +@@ -200,7 +200,9 @@ + stacktop = (char *)alloca(0); + + context_return = 0; ++#ifdef __GLIBC__ + assert(getcontext(&get_stack_return) == 0); ++#endif + if (context_return == 0) + { + // initial setup - start the stackmaster() task (never returns!) +@@ -266,13 +268,17 @@ + state = &old_task->mystate; + + context_return = 0; ++#ifdef __GLIBC__ + assert(getcontext(state) == 0); ++#endif + int newval = context_return; + if (newval == 0) + { + // saved the state, now run the task. + context_return = val; ++#ifdef __GLIBC__ + setcontext(&task.mystate); ++#endif + return -1; + } + else +@@ -320,13 +326,17 @@ + #endif + + context_return = 0; ++#ifdef __GLIBC__ + assert(getcontext(¤t_task->mystate) == 0); ++#endif + int newval = context_return; + if (newval == 0) + { + // saved the task state; now yield to the toplevel. + context_return = val; ++#ifdef __GLIBC__ + setcontext(&toplevel); ++#endif + return -1; + } + else +@@ -342,7 +352,9 @@ + void WvTaskMan::get_stack(WvTask &task, size_t size) + { + context_return = 0; ++#ifdef __GLIBC__ + assert(getcontext(&get_stack_return) == 0); ++#endif + if (context_return == 0) + { + assert(magic_number == -WVTASK_MAGIC); +@@ -372,7 +384,9 @@ + // initial setup + stack_target = &task; + context_return = size/1024 + (size%1024 > 0); ++#ifdef __GLIBC__ + setcontext(&stackmaster_task); ++#endif + } + else + { +@@ -410,7 +424,9 @@ + assert(magic_number == -WVTASK_MAGIC); + + context_return = 0; ++#ifdef __GLIBC__ + assert(getcontext(&stackmaster_task) == 0); ++#endif + val = context_return; + if (val == 0) + { +@@ -420,7 +436,9 @@ + // all current stack allocations) and go back to get_stack + // (or the constructor, if that's what called us) + context_return = 1; ++#ifdef __GLIBC__ + setcontext(&get_stack_return); ++#endif + } + else + { +@@ -475,7 +493,9 @@ + + // back here from longjmp; someone wants stack space. + context_return = 0; ++#ifdef __GLIBC__ + assert(getcontext(&task->mystate) == 0); ++#endif + if (context_return == 0) + { + // done the setjmp; that means the target task now has +@@ -511,7 +531,9 @@ + } + else + { ++#ifdef __GLIBC__ + assert(getcontext(&task->func_call) == 0); ++#endif + task->func_call.uc_stack.ss_size = task->stacksize; + task->func_call.uc_stack.ss_sp = task->stack; + task->func_call.uc_stack.ss_flags = 0; +@@ -522,9 +544,11 @@ + (void (*)(void))call_func, 1, task); + + context_return = 0; ++#ifdef __GLIBC__ + assert(getcontext(&task->func_return) == 0); + if (context_return == 0) + setcontext(&task->func_call); ++#endif + } + + // the task's function terminated. diff --git a/srcpkgs/wvstreams/template b/srcpkgs/wvstreams/template index 0f4e0e65a0..a5cd3030e0 100644 --- a/srcpkgs/wvstreams/template +++ b/srcpkgs/wvstreams/template @@ -1,7 +1,7 @@ # Template file for 'wvstreams' pkgname=wvstreams version=4.6.1 -revision=9 +revision=10 build_style=gnu-configure maintainer="Enno Boland " license="LGPL-2"