diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-07-22 09:50:45 -0700 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-08-13 13:16:18 +0200 |
commit | 68b2dec5d43904c5e76fb54740b1ed84007335bd (patch) | |
tree | 5f65d63c63e2579a466ccb0c324767f8132daf86 /meta-oe/recipes-connectivity/wvdial/wvstreams | |
parent | a8b54e300be027fefe8a774ca1861d0fb8e80d99 (diff) | |
download | meta-openembedded-68b2dec5d43904c5e76fb54740b1ed84007335bd.tar.gz |
wvstreams: Fix build with musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-connectivity/wvdial/wvstreams')
6 files changed, 283 insertions, 0 deletions
diff --git a/meta-oe/recipes-connectivity/wvdial/wvstreams/0001-Check-for-limits.h-during-configure.patch b/meta-oe/recipes-connectivity/wvdial/wvstreams/0001-Check-for-limits.h-during-configure.patch new file mode 100644 index 000000000..b092ba2fc --- /dev/null +++ b/meta-oe/recipes-connectivity/wvdial/wvstreams/0001-Check-for-limits.h-during-configure.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | From 7deaf836d1f1b9e4426818584b4267f8c4a095aa Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 20 Jul 2017 21:04:07 -0700 | ||
4 | Subject: [PATCH 1/5] Check for limits.h during configure | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | configure.ac | 2 ++ | ||
9 | 1 file changed, 2 insertions(+) | ||
10 | |||
11 | diff --git a/configure.ac b/configure.ac | ||
12 | index fe0fa2b..188adfe 100644 | ||
13 | --- a/configure.ac | ||
14 | +++ b/configure.ac | ||
15 | @@ -139,6 +139,8 @@ int main() | ||
16 | [Compiler warning on deprecated functions])]) | ||
17 | CPPFLAGS="$CPPFLAGS_save" | ||
18 | |||
19 | +AC_CHECK_HEADERS(limits.h) | ||
20 | + | ||
21 | # argp | ||
22 | USE_WVSTREAMS_ARGP=0 | ||
23 | AC_CHECK_HEADERS(argp.h) | ||
24 | -- | ||
25 | 2.13.3 | ||
26 | |||
diff --git a/meta-oe/recipes-connectivity/wvdial/wvstreams/0002-wvtask-Dont-use-ucontext-on-non-glibc-systems.patch b/meta-oe/recipes-connectivity/wvdial/wvstreams/0002-wvtask-Dont-use-ucontext-on-non-glibc-systems.patch new file mode 100644 index 000000000..232db9e63 --- /dev/null +++ b/meta-oe/recipes-connectivity/wvdial/wvstreams/0002-wvtask-Dont-use-ucontext-on-non-glibc-systems.patch | |||
@@ -0,0 +1,135 @@ | |||
1 | From 0e054339c1422168a7f4a9dcf090268053a33b1f Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 20 Jul 2017 21:05:37 -0700 | ||
4 | Subject: [PATCH 2/5] wvtask: Dont use ucontext on non-glibc systems | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | utils/wvtask.cc | 24 ++++++++++++++++++++++++ | ||
9 | 1 file changed, 24 insertions(+) | ||
10 | |||
11 | diff --git a/utils/wvtask.cc b/utils/wvtask.cc | ||
12 | index cdcd544..c0bff7d 100644 | ||
13 | --- a/utils/wvtask.cc | ||
14 | +++ b/utils/wvtask.cc | ||
15 | @@ -199,7 +199,9 @@ WvTaskMan::WvTaskMan() | ||
16 | stacktop = (char *)alloca(0); | ||
17 | |||
18 | context_return = 0; | ||
19 | +#ifdef __GLIBC__ | ||
20 | assert(getcontext(&get_stack_return) == 0); | ||
21 | +#endif | ||
22 | if (context_return == 0) | ||
23 | { | ||
24 | // initial setup - start the stackmaster() task (never returns!) | ||
25 | @@ -265,13 +267,17 @@ int WvTaskMan::run(WvTask &task, int val) | ||
26 | state = &old_task->mystate; | ||
27 | |||
28 | context_return = 0; | ||
29 | +#ifdef __GLIBC__ | ||
30 | assert(getcontext(state) == 0); | ||
31 | +#endif | ||
32 | int newval = context_return; | ||
33 | if (newval == 0) | ||
34 | { | ||
35 | // saved the state, now run the task. | ||
36 | context_return = val; | ||
37 | +#ifdef __GLIBC__ | ||
38 | setcontext(&task.mystate); | ||
39 | +#endif | ||
40 | return -1; | ||
41 | } | ||
42 | else | ||
43 | @@ -319,13 +325,17 @@ int WvTaskMan::yield(int val) | ||
44 | #endif | ||
45 | |||
46 | context_return = 0; | ||
47 | +#ifdef __GLIBC__ | ||
48 | assert(getcontext(¤t_task->mystate) == 0); | ||
49 | +#endif | ||
50 | int newval = context_return; | ||
51 | if (newval == 0) | ||
52 | { | ||
53 | // saved the task state; now yield to the toplevel. | ||
54 | context_return = val; | ||
55 | +#ifdef __GLIBC__ | ||
56 | setcontext(&toplevel); | ||
57 | +#endif | ||
58 | return -1; | ||
59 | } | ||
60 | else | ||
61 | @@ -341,7 +351,9 @@ int WvTaskMan::yield(int val) | ||
62 | void WvTaskMan::get_stack(WvTask &task, size_t size) | ||
63 | { | ||
64 | context_return = 0; | ||
65 | +#ifdef __GLIBC__ | ||
66 | assert(getcontext(&get_stack_return) == 0); | ||
67 | +#endif | ||
68 | if (context_return == 0) | ||
69 | { | ||
70 | assert(magic_number == -WVTASK_MAGIC); | ||
71 | @@ -371,7 +383,9 @@ void WvTaskMan::get_stack(WvTask &task, size_t size) | ||
72 | // initial setup | ||
73 | stack_target = &task; | ||
74 | context_return = size/1024 + (size%1024 > 0); | ||
75 | +#ifdef __GLIBC__ | ||
76 | setcontext(&stackmaster_task); | ||
77 | +#endif | ||
78 | } | ||
79 | else | ||
80 | { | ||
81 | @@ -409,7 +423,9 @@ void WvTaskMan::_stackmaster() | ||
82 | assert(magic_number == -WVTASK_MAGIC); | ||
83 | |||
84 | context_return = 0; | ||
85 | +#ifdef __GLIBC__ | ||
86 | assert(getcontext(&stackmaster_task) == 0); | ||
87 | +#endif | ||
88 | val = context_return; | ||
89 | if (val == 0) | ||
90 | { | ||
91 | @@ -419,7 +435,9 @@ void WvTaskMan::_stackmaster() | ||
92 | // all current stack allocations) and go back to get_stack | ||
93 | // (or the constructor, if that's what called us) | ||
94 | context_return = 1; | ||
95 | +#ifdef __GLIBC__ | ||
96 | setcontext(&get_stack_return); | ||
97 | +#endif | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | @@ -474,7 +492,9 @@ void WvTaskMan::do_task() | ||
102 | |||
103 | // back here from longjmp; someone wants stack space. | ||
104 | context_return = 0; | ||
105 | +#ifdef __GLIBC__ | ||
106 | assert(getcontext(&task->mystate) == 0); | ||
107 | +#endif | ||
108 | if (context_return == 0) | ||
109 | { | ||
110 | // done the setjmp; that means the target task now has | ||
111 | @@ -510,7 +530,9 @@ void WvTaskMan::do_task() | ||
112 | } | ||
113 | else | ||
114 | { | ||
115 | +#ifdef __GLIBC__ | ||
116 | assert(getcontext(&task->func_call) == 0); | ||
117 | +#endif | ||
118 | task->func_call.uc_stack.ss_size = task->stacksize; | ||
119 | task->func_call.uc_stack.ss_sp = task->stack; | ||
120 | task->func_call.uc_stack.ss_flags = 0; | ||
121 | @@ -521,9 +543,11 @@ void WvTaskMan::do_task() | ||
122 | (void (*)(void))call_func, 1, task); | ||
123 | |||
124 | context_return = 0; | ||
125 | +#ifdef __GLIBC__ | ||
126 | assert(getcontext(&task->func_return) == 0); | ||
127 | if (context_return == 0) | ||
128 | setcontext(&task->func_call); | ||
129 | +#endif | ||
130 | } | ||
131 | |||
132 | // the task's function terminated. | ||
133 | -- | ||
134 | 2.13.3 | ||
135 | |||
diff --git a/meta-oe/recipes-connectivity/wvdial/wvstreams/0003-wvtask-Check-for-HAVE_LIBC_STACK_END-only-on-glibc-s.patch b/meta-oe/recipes-connectivity/wvdial/wvstreams/0003-wvtask-Check-for-HAVE_LIBC_STACK_END-only-on-glibc-s.patch new file mode 100644 index 000000000..f9304197a --- /dev/null +++ b/meta-oe/recipes-connectivity/wvdial/wvstreams/0003-wvtask-Check-for-HAVE_LIBC_STACK_END-only-on-glibc-s.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | From f1fc9f4d523dd8b773a4535176547b0619ec05c6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 20 Jul 2017 21:08:57 -0700 | ||
4 | Subject: [PATCH 3/5] wvtask: Check for HAVE_LIBC_STACK_END only on glibc | ||
5 | systems | ||
6 | |||
7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
8 | --- | ||
9 | utils/wvtask.cc | 2 +- | ||
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/utils/wvtask.cc b/utils/wvtask.cc | ||
13 | index c0bff7d..716344b 100644 | ||
14 | --- a/utils/wvtask.cc | ||
15 | +++ b/utils/wvtask.cc | ||
16 | @@ -563,7 +563,7 @@ void WvTaskMan::do_task() | ||
17 | |||
18 | const void *WvTaskMan::current_top_of_stack() | ||
19 | { | ||
20 | -#ifdef HAVE_LIBC_STACK_END | ||
21 | +#if defined(HAVE_LIBC_STACK_END) && defined(__GLIBC__) | ||
22 | extern const void *__libc_stack_end; | ||
23 | if (use_shared_stack() || current_task == NULL) | ||
24 | return __libc_stack_end; | ||
25 | -- | ||
26 | 2.13.3 | ||
27 | |||
diff --git a/meta-oe/recipes-connectivity/wvdial/wvstreams/0004-wvcrash-Replace-use-of-basename-API.patch b/meta-oe/recipes-connectivity/wvdial/wvstreams/0004-wvcrash-Replace-use-of-basename-API.patch new file mode 100644 index 000000000..6f3fbffbd --- /dev/null +++ b/meta-oe/recipes-connectivity/wvdial/wvstreams/0004-wvcrash-Replace-use-of-basename-API.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From bfe68126693f9159f7ac66a69217e0b5f43e5781 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 20 Jul 2017 21:11:21 -0700 | ||
4 | Subject: [PATCH 4/5] wvcrash: Replace use of basename API | ||
5 | |||
6 | musl does not have this API | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | utils/wvcrash.cc | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/utils/wvcrash.cc b/utils/wvcrash.cc | ||
14 | index 0417759..3d160b7 100644 | ||
15 | --- a/utils/wvcrash.cc | ||
16 | +++ b/utils/wvcrash.cc | ||
17 | @@ -404,7 +404,7 @@ extern void __wvcrash_init_buffers(const char *program_name); | ||
18 | void wvcrash_setup(const char *_argv0, const char *_desc) | ||
19 | { | ||
20 | if (_argv0) | ||
21 | - argv0 = basename(_argv0); | ||
22 | + argv0 = strrchr(_argv0, '/') ? strrchr(_argv0, '/')+1 : _argv0; | ||
23 | __wvcrash_init_buffers(argv0); | ||
24 | if (_desc) | ||
25 | { | ||
26 | -- | ||
27 | 2.13.3 | ||
28 | |||
diff --git a/meta-oe/recipes-connectivity/wvdial/wvstreams/0005-check-for-libexecinfo-during-configure.patch b/meta-oe/recipes-connectivity/wvdial/wvstreams/0005-check-for-libexecinfo-during-configure.patch new file mode 100644 index 000000000..25e9ee236 --- /dev/null +++ b/meta-oe/recipes-connectivity/wvdial/wvstreams/0005-check-for-libexecinfo-during-configure.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From fd9515f08dcdafea6ae03413fbe5a43a6438fe3e Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 20 Jul 2017 21:25:48 -0700 | ||
4 | Subject: [PATCH 5/5] check for libexecinfo during configure | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | configure.ac | 6 ++++++ | ||
9 | 1 file changed, 6 insertions(+) | ||
10 | |||
11 | diff --git a/configure.ac b/configure.ac | ||
12 | index 188adfe..1ab4d3c 100644 | ||
13 | --- a/configure.ac | ||
14 | +++ b/configure.ac | ||
15 | @@ -159,6 +159,12 @@ AC_SEARCH_LIBS([argp_parse], [argp c], [], [ | ||
16 | USE_WVSTREAMS_ARGP=1 | ||
17 | fi | ||
18 | ]) | ||
19 | + | ||
20 | +USE_LIBEXECINFO=0 | ||
21 | +AC_SEARCH_LIBS([backtrace], [execinfo], [], [ | ||
22 | +USE_LIBEXECINFO=1 | ||
23 | +]) | ||
24 | + | ||
25 | # Function checks | ||
26 | AC_HEADER_DIRENT | ||
27 | |||
28 | -- | ||
29 | 2.13.3 | ||
30 | |||
diff --git a/meta-oe/recipes-connectivity/wvdial/wvstreams/argp.patch b/meta-oe/recipes-connectivity/wvdial/wvstreams/argp.patch new file mode 100644 index 000000000..e85721363 --- /dev/null +++ b/meta-oe/recipes-connectivity/wvdial/wvstreams/argp.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | Check for argp_parse in libargp and then in libc before using internal version | ||
2 | |||
3 | Index: wvstreams-4.6.1/configure.ac | ||
4 | =================================================================== | ||
5 | --- wvstreams-4.6.1.orig/configure.ac | ||
6 | +++ wvstreams-4.6.1/configure.ac | ||
7 | @@ -142,20 +142,21 @@ CPPFLAGS="$CPPFLAGS_save" | ||
8 | # argp | ||
9 | USE_WVSTREAMS_ARGP=0 | ||
10 | AC_CHECK_HEADERS(argp.h) | ||
11 | -AC_CHECK_FUNC(argp_parse) | ||
12 | -if test "$ac_cv_func_argp_parse" != yes \ | ||
13 | - -o "$ac_cv_header_argp_h" != yes ; then | ||
14 | - ( | ||
15 | - echo | ||
16 | +AC_SEARCH_LIBS([argp_parse], [argp c], [], [ | ||
17 | + | ||
18 | + if test "$ac_cv_func_argp_parse" != yes \ | ||
19 | + -o "$ac_cv_header_argp_h" != yes ; then | ||
20 | + ( | ||
21 | + echo | ||
22 | echo 'configuring argp...' | ||
23 | cd argp | ||
24 | ./configure --host=$host_cpu-$host_os || exit $? | ||
25 | echo 'argp configured.' | ||
26 | echo | ||
27 | - ) || exit $? | ||
28 | - USE_WVSTREAMS_ARGP=1 | ||
29 | -fi | ||
30 | - | ||
31 | + ) || exit $? | ||
32 | + USE_WVSTREAMS_ARGP=1 | ||
33 | + fi | ||
34 | +]) | ||
35 | # Function checks | ||
36 | AC_HEADER_DIRENT | ||
37 | |||