summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-07-22 09:50:45 -0700
committerArmin Kuster <akuster808@gmail.com>2017-09-13 17:16:28 -0700
commita1e9dfd390b8c2452ecf18a688126350b1891b90 (patch)
tree865ef810c6f8f682325df9016b89960f2444b8ad
parent250c476605131f0d85223795f73dcc6599e170ff (diff)
downloadmeta-openembedded-a1e9dfd390b8c2452ecf18a688126350b1891b90.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> (cherry picked from commit 68b2dec5d43904c5e76fb54740b1ed84007335bd) Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-oe/recipes-connectivity/wvdial/wvstreams/0001-Check-for-limits.h-during-configure.patch26
-rw-r--r--meta-oe/recipes-connectivity/wvdial/wvstreams/0002-wvtask-Dont-use-ucontext-on-non-glibc-systems.patch135
-rw-r--r--meta-oe/recipes-connectivity/wvdial/wvstreams/0003-wvtask-Check-for-HAVE_LIBC_STACK_END-only-on-glibc-s.patch27
-rw-r--r--meta-oe/recipes-connectivity/wvdial/wvstreams/0004-wvcrash-Replace-use-of-basename-API.patch28
-rw-r--r--meta-oe/recipes-connectivity/wvdial/wvstreams/0005-check-for-libexecinfo-during-configure.patch30
-rw-r--r--meta-oe/recipes-connectivity/wvdial/wvstreams/argp.patch37
-rw-r--r--meta-oe/recipes-connectivity/wvdial/wvstreams_4.6.1.bb9
7 files changed, 291 insertions, 1 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 @@
1From 7deaf836d1f1b9e4426818584b4267f8c4a095aa Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Jul 2017 21:04:07 -0700
4Subject: [PATCH 1/5] Check for limits.h during configure
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 configure.ac | 2 ++
9 1 file changed, 2 insertions(+)
10
11diff --git a/configure.ac b/configure.ac
12index 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--
252.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 @@
1From 0e054339c1422168a7f4a9dcf090268053a33b1f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Jul 2017 21:05:37 -0700
4Subject: [PATCH 2/5] wvtask: Dont use ucontext on non-glibc systems
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 utils/wvtask.cc | 24 ++++++++++++++++++++++++
9 1 file changed, 24 insertions(+)
10
11diff --git a/utils/wvtask.cc b/utils/wvtask.cc
12index 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(&current_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--
1342.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 @@
1From f1fc9f4d523dd8b773a4535176547b0619ec05c6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Jul 2017 21:08:57 -0700
4Subject: [PATCH 3/5] wvtask: Check for HAVE_LIBC_STACK_END only on glibc
5 systems
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 utils/wvtask.cc | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/utils/wvtask.cc b/utils/wvtask.cc
13index 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--
262.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 @@
1From bfe68126693f9159f7ac66a69217e0b5f43e5781 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Jul 2017 21:11:21 -0700
4Subject: [PATCH 4/5] wvcrash: Replace use of basename API
5
6musl does not have this API
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 utils/wvcrash.cc | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/utils/wvcrash.cc b/utils/wvcrash.cc
14index 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--
272.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 @@
1From fd9515f08dcdafea6ae03413fbe5a43a6438fe3e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Jul 2017 21:25:48 -0700
4Subject: [PATCH 5/5] check for libexecinfo during configure
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 configure.ac | 6 ++++++
9 1 file changed, 6 insertions(+)
10
11diff --git a/configure.ac b/configure.ac
12index 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--
292.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 @@
1Check for argp_parse in libargp and then in libc before using internal version
2
3Index: 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
diff --git a/meta-oe/recipes-connectivity/wvdial/wvstreams_4.6.1.bb b/meta-oe/recipes-connectivity/wvdial/wvstreams_4.6.1.bb
index 607a6178f..0ac175251 100644
--- a/meta-oe/recipes-connectivity/wvdial/wvstreams_4.6.1.bb
+++ b/meta-oe/recipes-connectivity/wvdial/wvstreams_4.6.1.bb
@@ -5,6 +5,7 @@ LICENSE = "LGPLv2"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=55ca817ccb7d5b5b66355690e9abc605" 5LIC_FILES_CHKSUM = "file://LICENSE;md5=55ca817ccb7d5b5b66355690e9abc605"
6 6
7DEPENDS = "zlib openssl (>= 0.9.8) dbus readline" 7DEPENDS = "zlib openssl (>= 0.9.8) dbus readline"
8DEPENDS_append_libc-musl = " argp-standalone libexecinfo"
8 9
9SRC_URI = "http://${BPN}.googlecode.com/files/${BP}.tar.gz \ 10SRC_URI = "http://${BPN}.googlecode.com/files/${BP}.tar.gz \
10 file://04_signed_request.diff \ 11 file://04_signed_request.diff \
@@ -12,7 +13,13 @@ SRC_URI = "http://${BPN}.googlecode.com/files/${BP}.tar.gz \
12 file://06_gcc-4.7.diff \ 13 file://06_gcc-4.7.diff \
13 file://07_buildflags.diff \ 14 file://07_buildflags.diff \
14 file://gcc-6.patch \ 15 file://gcc-6.patch \
15 " 16 file://argp.patch \
17 file://0001-Check-for-limits.h-during-configure.patch \
18 file://0002-wvtask-Dont-use-ucontext-on-non-glibc-systems.patch \
19 file://0003-wvtask-Check-for-HAVE_LIBC_STACK_END-only-on-glibc-s.patch \
20 file://0004-wvcrash-Replace-use-of-basename-API.patch \
21 file://0005-check-for-libexecinfo-during-configure.patch \
22 "
16 23
17SRC_URI[md5sum] = "2760dac31a43d452a19a3147bfde571c" 24SRC_URI[md5sum] = "2760dac31a43d452a19a3147bfde571c"
18SRC_URI[sha256sum] = "8403f5fbf83aa9ac0c6ce15d97fd85607488152aa84e007b7d0621b8ebc07633" 25SRC_URI[sha256sum] = "8403f5fbf83aa9ac0c6ce15d97fd85607488152aa84e007b7d0621b8ebc07633"