summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-09-13 20:24:40 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-23 09:53:03 +0100
commitd36384e61d538fbf3f0434a0ae4e5fd3b361e27a (patch)
tree1ed09d1f965cb7fcf6b013f98c61c9704492fcc8
parent0df9b98d31e96f87f1482f4665ff75412719fe9d (diff)
downloadpoky-d36384e61d538fbf3f0434a0ae4e5fd3b361e27a.tar.gz
connman: Fix build with musl
(From OE-Core rev: d08f9d7145ba14ce9fbf320719c05560be69212f) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-connectivity/connman/connman.inc1
-rw-r--r--meta/recipes-connectivity/connman/connman/0001-Detect-backtrace-API-availability-before-using-it.patch55
-rw-r--r--meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch77
-rw-r--r--meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch85
-rw-r--r--meta/recipes-connectivity/connman/connman_1.30.bb3
5 files changed, 221 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/connman/connman.inc b/meta/recipes-connectivity/connman/connman.inc
index 17dc4b938c..fd9640e079 100644
--- a/meta/recipes-connectivity/connman/connman.inc
+++ b/meta/recipes-connectivity/connman/connman.inc
@@ -30,6 +30,7 @@ EXTRA_OECONF += "\
30 --disable-polkit \ 30 --disable-polkit \
31 --enable-client \ 31 --enable-client \
32" 32"
33CFLAGS += "-D_GNU_SOURCE"
33 34
34PACKAGECONFIG ??= "wispr \ 35PACKAGECONFIG ??= "wispr \
35 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd','systemd', '', d)} \ 36 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd','systemd', '', d)} \
diff --git a/meta/recipes-connectivity/connman/connman/0001-Detect-backtrace-API-availability-before-using-it.patch b/meta/recipes-connectivity/connman/connman/0001-Detect-backtrace-API-availability-before-using-it.patch
new file mode 100644
index 0000000000..5dc6fd634b
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0001-Detect-backtrace-API-availability-before-using-it.patch
@@ -0,0 +1,55 @@
1From 00d4447395725abaa651e12ed40095081e04011e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 13 Sep 2015 13:22:01 -0700
4Subject: [PATCH 1/3] Detect backtrace() API availability before using it
5
6C libraries besides glibc do not have backtrace() implemented
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Pending
11
12 configure.ac | 2 ++
13 src/log.c | 5 ++---
14 2 files changed, 4 insertions(+), 3 deletions(-)
15
16diff --git a/configure.ac b/configure.ac
17index 69c0eeb..90099f2 100644
18--- a/configure.ac
19+++ b/configure.ac
20@@ -171,6 +171,8 @@ fi
21 AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no")
22 AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin")
23
24+AC_CHECK_HEADERS([execinfo.h])
25+
26 AC_CHECK_HEADERS(resolv.h, dummy=yes,
27 AC_MSG_ERROR(resolver header files are required))
28 AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
29diff --git a/src/log.c b/src/log.c
30index a693bd0..5b40c1f 100644
31--- a/src/log.c
32+++ b/src/log.c
33@@ -30,7 +30,6 @@
34 #include <stdlib.h>
35 #include <string.h>
36 #include <syslog.h>
37-#include <execinfo.h>
38 #include <dlfcn.h>
39
40 #include "connman.h"
41@@ -215,9 +214,9 @@ static void print_backtrace(unsigned int offset)
42 static void signal_handler(int signo)
43 {
44 connman_error("Aborting (signal %d) [%s]", signo, program_exec);
45-
46+#ifdef HAVE_EXECINFO_H
47 print_backtrace(2);
48-
49+#endif /* HAVE_EXECINFO_H */
50 exit(EXIT_FAILURE);
51 }
52
53--
542.5.1
55
diff --git a/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch b/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch
new file mode 100644
index 0000000000..0593427710
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0002-resolve-musl-does-not-implement-res_ninit.patch
@@ -0,0 +1,77 @@
1From 10b0d16d04b811b1ccd1f9b0cfe757bce8d876a1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 6 Apr 2015 23:02:21 -0700
4Subject: [PATCH 2/3] resolve: musl does not implement res_ninit
5
6ported from
7http://git.alpinelinux.org/cgit/aports/plain/testing/connman/libresolv.patch
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 gweb/gresolv.c | 33 ++++++++++++---------------------
14 1 file changed, 12 insertions(+), 21 deletions(-)
15
16diff --git a/gweb/gresolv.c b/gweb/gresolv.c
17index 5cf7a9a..3ad8e70 100644
18--- a/gweb/gresolv.c
19+++ b/gweb/gresolv.c
20@@ -875,8 +875,6 @@ GResolv *g_resolv_new(int index)
21 resolv->index = index;
22 resolv->nameserver_list = NULL;
23
24- res_ninit(&resolv->res);
25-
26 return resolv;
27 }
28
29@@ -916,8 +914,6 @@ void g_resolv_unref(GResolv *resolv)
30
31 flush_nameservers(resolv);
32
33- res_nclose(&resolv->res);
34-
35 g_free(resolv);
36 }
37
38@@ -1020,24 +1016,19 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname,
39 debug(resolv, "hostname %s", hostname);
40
41 if (!resolv->nameserver_list) {
42- int i;
43-
44- for (i = 0; i < resolv->res.nscount; i++) {
45- char buf[100];
46- int family = resolv->res.nsaddr_list[i].sin_family;
47- void *sa_addr = &resolv->res.nsaddr_list[i].sin_addr;
48-
49- if (family != AF_INET &&
50- resolv->res._u._ext.nsaddrs[i]) {
51- family = AF_INET6;
52- sa_addr = &resolv->res._u._ext.nsaddrs[i]->sin6_addr;
53+ FILE *f = fopen("/etc/resolv.conf", "r");
54+ if (f) {
55+ char line[256], *s;
56+ int i;
57+ while (fgets(line, sizeof(line), f)) {
58+ if (strncmp(line, "nameserver", 10) || !isspace(line[10]))
59+ continue;
60+ for (s = &line[11]; isspace(s[0]); s++);
61+ for (i = 0; s[i] && !isspace(s[i]); i++);
62+ s[i] = 0;
63+ g_resolv_add_nameserver(resolv, s, 53, 0);
64 }
65-
66- if (family != AF_INET && family != AF_INET6)
67- continue;
68-
69- if (inet_ntop(family, sa_addr, buf, sizeof(buf)))
70- g_resolv_add_nameserver(resolv, buf, 53, 0);
71+ fclose(f);
72 }
73
74 if (!resolv->nameserver_list)
75--
762.5.1
77
diff --git a/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch b/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch
new file mode 100644
index 0000000000..6327aa2cbd
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch
@@ -0,0 +1,85 @@
1From 67645a01a2f3f52625d8dd77f2811a9e213e1b7d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 13 Sep 2015 13:28:20 -0700
4Subject: [PATCH] Fix header inclusions for musl
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 gweb/gresolv.c | 1 +
11 plugins/wifi.c | 3 +--
12 src/tethering.c | 2 --
13 tools/dhcp-test.c | 1 -
14 tools/dnsproxy-test.c | 1 +
15 5 files changed, 3 insertions(+), 5 deletions(-)
16
17diff --git a/gweb/gresolv.c b/gweb/gresolv.c
18index 3ad8e70..61d6fe8 100644
19--- a/gweb/gresolv.c
20+++ b/gweb/gresolv.c
21@@ -28,6 +28,7 @@
22 #include <stdarg.h>
23 #include <string.h>
24 #include <stdlib.h>
25+#include <stdio.h>
26 #include <resolv.h>
27 #include <sys/types.h>
28 #include <sys/socket.h>
29diff --git a/plugins/wifi.c b/plugins/wifi.c
30index dfe849f..99cff3f 100644
31--- a/plugins/wifi.c
32+++ b/plugins/wifi.c
33@@ -30,9 +30,8 @@
34 #include <string.h>
35 #include <sys/ioctl.h>
36 #include <sys/socket.h>
37-#include <linux/if_arp.h>
38-#include <linux/wireless.h>
39 #include <net/ethernet.h>
40+#include <linux/wireless.h>
41
42 #ifndef IFF_LOWER_UP
43 #define IFF_LOWER_UP 0x10000
44diff --git a/src/tethering.c b/src/tethering.c
45index ceeec74..c44cb36 100644
46--- a/src/tethering.c
47+++ b/src/tethering.c
48@@ -31,10 +31,8 @@
49 #include <stdio.h>
50 #include <sys/ioctl.h>
51 #include <net/if.h>
52-#include <linux/sockios.h>
53 #include <string.h>
54 #include <fcntl.h>
55-#include <linux/if_tun.h>
56 #include <netinet/in.h>
57 #include <linux/if_bridge.h>
58
59diff --git a/tools/dhcp-test.c b/tools/dhcp-test.c
60index c34e10a..eae66fc 100644
61--- a/tools/dhcp-test.c
62+++ b/tools/dhcp-test.c
63@@ -33,7 +33,6 @@
64 #include <arpa/inet.h>
65 #include <net/route.h>
66 #include <net/ethernet.h>
67-#include <linux/if_arp.h>
68
69 #include <gdhcp/gdhcp.h>
70
71diff --git a/tools/dnsproxy-test.c b/tools/dnsproxy-test.c
72index 551cae9..226ba86 100644
73--- a/tools/dnsproxy-test.c
74+++ b/tools/dnsproxy-test.c
75@@ -27,6 +27,7 @@
76 #include <stdlib.h>
77 #include <string.h>
78 #include <unistd.h>
79+#include <stdio.h>
80 #include <arpa/inet.h>
81 #include <netinet/in.h>
82 #include <sys/types.h>
83--
842.5.1
85
diff --git a/meta/recipes-connectivity/connman/connman_1.30.bb b/meta/recipes-connectivity/connman/connman_1.30.bb
index 8c47353bcf..9b512c565f 100644
--- a/meta/recipes-connectivity/connman/connman_1.30.bb
+++ b/meta/recipes-connectivity/connman/connman_1.30.bb
@@ -3,6 +3,9 @@ require connman.inc
3SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \ 3SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
4 file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \ 4 file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
5 file://add_xuser_dbus_permission.patch \ 5 file://add_xuser_dbus_permission.patch \
6 file://0001-Detect-backtrace-API-availability-before-using-it.patch \
7 file://0002-resolve-musl-does-not-implement-res_ninit.patch \
8 file://0003-Fix-header-inclusions-for-musl.patch \
6 file://connman \ 9 file://connman \
7 " 10 "
8SRC_URI[md5sum] = "4a3efdbd6796922db9c6f66da57887fa" 11SRC_URI[md5sum] = "4a3efdbd6796922db9c6f66da57887fa"