summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-03-31 18:53:16 -0700
committerMartin Jansa <Martin.Jansa@gmail.com>2017-04-05 19:28:30 +0200
commit38f0f1310b3bae6edaf4d6185b49163c63eaa96d (patch)
treec6e78f3afb72a6890377d0d8d75bff5fa398a02b
parent254a9f82a60e0e60ca625e61b921696b33a3ad30 (diff)
downloadmeta-openembedded-38f0f1310b3bae6edaf4d6185b49163c63eaa96d.tar.gz
networkmanager: Fix build on musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-connectivity/networkmanager/networkmanager/0001-adjust-net-headers-for-musl-compatibility.patch82
-rw-r--r--meta-oe/recipes-connectivity/networkmanager/networkmanager/0001-check-for-strndupa-before-using-it.patch67
-rw-r--r--meta-oe/recipes-connectivity/networkmanager/networkmanager/0002-socket-util.h-Include-linux-sockios.h-on-musl.patch30
-rw-r--r--meta-oe/recipes-connectivity/networkmanager/networkmanager/0003-Define-ETH_ALEN.patch39
-rw-r--r--meta-oe/recipes-connectivity/networkmanager/networkmanager/0004-Define-missing-features-to-cater-for-musl.patch93
-rw-r--r--meta-oe/recipes-connectivity/networkmanager/networkmanager/0005-sd-lldp.h-Remove-net-ethernet.h-seems-to-be-over-spe.patch36
-rw-r--r--meta-oe/recipes-connectivity/networkmanager/networkmanager_1.4.2.bb15
7 files changed, 357 insertions, 5 deletions
diff --git a/meta-oe/recipes-connectivity/networkmanager/networkmanager/0001-adjust-net-headers-for-musl-compatibility.patch b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0001-adjust-net-headers-for-musl-compatibility.patch
new file mode 100644
index 0000000000..ced0c7cfff
--- /dev/null
+++ b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0001-adjust-net-headers-for-musl-compatibility.patch
@@ -0,0 +1,82 @@
1From 047d3bf96b510740f64687480333c378e414995f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 31 Mar 2017 15:57:05 -0700
4Subject: [PATCH 1/5] adjust net/ headers for musl compatibility
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 libnm-core/nm-utils.c | 12 +++++++-----
9 libnm-core/nm-utils.h | 5 ++---
10 src/platform/wifi/wifi-utils.h | 2 +-
11 3 files changed, 10 insertions(+), 9 deletions(-)
12
13diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
14index df75d56..868224e 100644
15--- a/libnm-core/nm-utils.c
16+++ b/libnm-core/nm-utils.c
17@@ -19,24 +19,26 @@
18 * Copyright 2005 - 2014 Red Hat, Inc.
19 */
20
21-#include "nm-default.h"
22-
23-#include "nm-utils.h"
24-
25 #include <string.h>
26 #include <errno.h>
27 #include <stdlib.h>
28-#include <netinet/ether.h>
29 #include <arpa/inet.h>
30 #include <uuid/uuid.h>
31 #include <libintl.h>
32 #include <gmodule.h>
33 #include <sys/stat.h>
34+//#include <net/if_arp.h>
35+//#include <net/ethernet.h>
36+#include <netinet/ether.h>
37+
38+#include "nm-default.h"
39
40+#include "nm-utils.h"
41 #if WITH_JANSSON
42 #include <jansson.h>
43 #endif
44
45+
46 #include "nm-common-macros.h"
47 #include "nm-utils-private.h"
48 #include "nm-setting-private.h"
49diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h
50index 407c14e..156ccae 100644
51--- a/libnm-core/nm-utils.h
52+++ b/libnm-core/nm-utils.h
53@@ -27,11 +27,10 @@
54
55 #include <glib.h>
56
57-#include <netinet/in.h>
58-
59 /* For ETH_ALEN and INFINIBAND_ALEN */
60-#include <linux/if_ether.h>
61+//#include <linux/if_ether.h>
62 #include <linux/if_infiniband.h>
63+#include <netinet/in.h>
64
65 #include "nm-core-enum-types.h"
66 #include "nm-setting-wireless-security.h"
67diff --git a/src/platform/wifi/wifi-utils.h b/src/platform/wifi/wifi-utils.h
68index 8e2b93f..84f5ce9 100644
69--- a/src/platform/wifi/wifi-utils.h
70+++ b/src/platform/wifi/wifi-utils.h
71@@ -22,7 +22,7 @@
72 #ifndef __WIFI_UTILS_H__
73 #define __WIFI_UTILS_H__
74
75-#include <net/ethernet.h>
76+//#include <net/ethernet.h>
77
78 #include "nm-dbus-interface.h"
79
80--
812.12.1
82
diff --git a/meta-oe/recipes-connectivity/networkmanager/networkmanager/0001-check-for-strndupa-before-using-it.patch b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0001-check-for-strndupa-before-using-it.patch
new file mode 100644
index 0000000000..26f380bf98
--- /dev/null
+++ b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0001-check-for-strndupa-before-using-it.patch
@@ -0,0 +1,67 @@
1From 05e8bd664d0244cb8ab4376b962830b97860f6bf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 31 Mar 2017 18:37:19 -0700
4Subject: [PATCH] check for strndupa before using it
5
6musl does not have strndupa
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 config.h.in | 4 ++++
11 configure.ac | 1 +
12 src/systemd/src/basic/alloc-util.h | 12 ++++++++++++
13 3 files changed, 17 insertions(+)
14
15diff --git a/config.h.in b/config.h.in
16index db8c135..c4229ed 100644
17--- a/config.h.in
18+++ b/config.h.in
19@@ -41,6 +41,10 @@
20 */
21 #undef HAVE_DCGETTEXT
22
23+/* Define to 1 if you have the declaration of `strndupa', and to 0 if you
24+ don't. */
25+#undef HAVE_DECL_STRNDUPA
26+
27 /* Define to 1 if you have the <dlfcn.h> header file. */
28 #undef HAVE_DLFCN_H
29
30diff --git a/configure.ac b/configure.ac
31index 2630f8d..d0a57fd 100644
32--- a/configure.ac
33+++ b/configure.ac
34@@ -54,6 +54,7 @@ AC_SUBST(NM_VERSION)
35
36 GIT_SHA_RECORD(NM_GIT_SHA)
37
38+AC_CHECK_DECLS([strndupa], [], [], [[#include <string.h>]])
39 dnl
40 dnl Checks for typedefs, structures, and compiler characteristics.
41 dnl
42diff --git a/src/systemd/src/basic/alloc-util.h b/src/systemd/src/basic/alloc-util.h
43index ceeee51..924b59c 100644
44--- a/src/systemd/src/basic/alloc-util.h
45+++ b/src/systemd/src/basic/alloc-util.h
46@@ -25,6 +25,18 @@
47 #include <string.h>
48
49 #include "macro.h"
50+#include "config.h"
51+
52+#if !HAVE_DECL_STRNDUPA
53+#define strndupa(s, n) \
54+ ({ \
55+ const char *__old = (s); \
56+ size_t __len = strnlen(__old, (n)); \
57+ char *__new = (char *)alloca(__len + 1); \
58+ __new[__len] = '\0'; \
59+ (char *)memcpy(__new, __old, __len); \
60+ })
61+#endif
62
63 #define new(t, n) ((t*) malloc_multiply(sizeof(t), (n)))
64
65--
662.12.1
67
diff --git a/meta-oe/recipes-connectivity/networkmanager/networkmanager/0002-socket-util.h-Include-linux-sockios.h-on-musl.patch b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0002-socket-util.h-Include-linux-sockios.h-on-musl.patch
new file mode 100644
index 0000000000..22bc6e8bda
--- /dev/null
+++ b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0002-socket-util.h-Include-linux-sockios.h-on-musl.patch
@@ -0,0 +1,30 @@
1From 98d7e3ae5b15e30af1bf5dd1d279e1a774bf2b86 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 31 Mar 2017 16:05:05 -0700
4Subject: [PATCH 2/5] socket-util.h: Include linux/sockios.h on musl
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 src/systemd/src/basic/socket-util.h | 6 ++++++
9 1 file changed, 6 insertions(+)
10
11diff --git a/src/systemd/src/basic/socket-util.h b/src/systemd/src/basic/socket-util.h
12index 2536b08..76d6107 100644
13--- a/src/systemd/src/basic/socket-util.h
14+++ b/src/systemd/src/basic/socket-util.h
15@@ -29,6 +29,12 @@
16 #include <linux/netlink.h>
17 #include <linux/if_packet.h>
18
19+#if !defined(__GLIBC__)
20+/* SIOCGSTAMPNS from linux/asm-generic.h
21+ * for src/systemd/src/libsystemd-network/sd-lldp.c */
22+#include <linux/sockios.h>
23+#endif
24+
25 #include "macro.h"
26 #include "util.h"
27
28--
292.12.1
30
diff --git a/meta-oe/recipes-connectivity/networkmanager/networkmanager/0003-Define-ETH_ALEN.patch b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0003-Define-ETH_ALEN.patch
new file mode 100644
index 0000000000..236914f756
--- /dev/null
+++ b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0003-Define-ETH_ALEN.patch
@@ -0,0 +1,39 @@
1From 16c3dc7a407101243d2056d2c93e61dce1a05350 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 31 Mar 2017 16:08:45 -0700
4Subject: [PATCH 3/5] Define ETH_ALEN
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 libnm-core/nm-utils.h | 1 +
9 src/platform/wifi/wifi-utils.h | 2 ++
10 2 files changed, 3 insertions(+)
11
12diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h
13index 156ccae..68e222b 100644
14--- a/libnm-core/nm-utils.h
15+++ b/libnm-core/nm-utils.h
16@@ -29,6 +29,7 @@
17
18 /* For ETH_ALEN and INFINIBAND_ALEN */
19 //#include <linux/if_ether.h>
20+#define ETH_ALEN 6 /* Octets in one ethernet addr */
21 #include <linux/if_infiniband.h>
22 #include <netinet/in.h>
23
24diff --git a/src/platform/wifi/wifi-utils.h b/src/platform/wifi/wifi-utils.h
25index 84f5ce9..33a838d 100644
26--- a/src/platform/wifi/wifi-utils.h
27+++ b/src/platform/wifi/wifi-utils.h
28@@ -24,6 +24,8 @@
29
30 //#include <net/ethernet.h>
31
32+#define ETH_ALEN 6 /* Octets in one ethernet addr */
33+
34 #include "nm-dbus-interface.h"
35
36 typedef struct WifiData WifiData;
37--
382.12.1
39
diff --git a/meta-oe/recipes-connectivity/networkmanager/networkmanager/0004-Define-missing-features-to-cater-for-musl.patch b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0004-Define-missing-features-to-cater-for-musl.patch
new file mode 100644
index 0000000000..27c9ae9624
--- /dev/null
+++ b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0004-Define-missing-features-to-cater-for-musl.patch
@@ -0,0 +1,93 @@
1From 2153109e60e362e0d09215d529bf00176f31a3e7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 31 Mar 2017 16:09:41 -0700
4Subject: [PATCH 4/5] Define missing features to cater for musl
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 src/systemd/sd-adapt/nm-sd-adapt.h | 2 +-
9 src/systemd/src/basic/parse-util.c | 5 ++++-
10 src/systemd/src/basic/stdio-util.h | 2 ++
11 src/systemd/src/basic/util.h | 5 +++++
12 src/systemd/src/systemd/sd-event.h | 4 ----
13 5 files changed, 12 insertions(+), 6 deletions(-)
14
15diff --git a/src/systemd/sd-adapt/nm-sd-adapt.h b/src/systemd/sd-adapt/nm-sd-adapt.h
16index cf27c1a..72c1b89 100644
17--- a/src/systemd/sd-adapt/nm-sd-adapt.h
18+++ b/src/systemd/sd-adapt/nm-sd-adapt.h
19@@ -119,7 +119,7 @@ G_STMT_START { \
20 # ifdef HAVE___SECURE_GETENV
21 # define secure_getenv __secure_getenv
22 # else
23-# error neither secure_getenv nor __secure_getenv is available
24+# define secure_getenv getenv
25 # endif
26 #endif
27
28diff --git a/src/systemd/src/basic/parse-util.c b/src/systemd/src/basic/parse-util.c
29index 2738663..9c21e5a 100644
30--- a/src/systemd/src/basic/parse-util.c
31+++ b/src/systemd/src/basic/parse-util.c
32@@ -25,8 +25,11 @@
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36+#ifdef __GLIBC__
37 #include <xlocale.h>
38-
39+#else
40+#include <locale.h>
41+#endif
42 #include "alloc-util.h"
43 #include "extract-word.h"
44 #include "macro.h"
45diff --git a/src/systemd/src/basic/stdio-util.h b/src/systemd/src/basic/stdio-util.h
46index bd1144b..c92e935 100644
47--- a/src/systemd/src/basic/stdio-util.h
48+++ b/src/systemd/src/basic/stdio-util.h
49@@ -19,7 +19,9 @@
50 along with systemd; If not, see <http://www.gnu.org/licenses/>.
51 ***/
52
53+#ifdef __GLIBC__
54 #include <printf.h>
55+#endif
56 #include <stdarg.h>
57 #include <stdio.h>
58 #include <sys/types.h>
59diff --git a/src/systemd/src/basic/util.h b/src/systemd/src/basic/util.h
60index bb2fc31..fe074a5 100644
61--- a/src/systemd/src/basic/util.h
62+++ b/src/systemd/src/basic/util.h
63@@ -46,6 +46,11 @@
64 #include "missing.h"
65 #include "time-util.h"
66
67+#if !defined(__GLIBC__)
68+typedef int (*__compar_fn_t) (const void*, const void*);
69+typedef __compar_fn_t comparison_fn_t;
70+#endif
71+
72 size_t page_size(void) _pure_;
73 #define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
74
75diff --git a/src/systemd/src/systemd/sd-event.h b/src/systemd/src/systemd/sd-event.h
76index cc26b7d..c7e0004 100644
77--- a/src/systemd/src/systemd/sd-event.h
78+++ b/src/systemd/src/systemd/sd-event.h
79@@ -69,11 +69,7 @@ typedef int (*sd_event_handler_t)(sd_event_source *s, void *userdata);
80 typedef int (*sd_event_io_handler_t)(sd_event_source *s, int fd, uint32_t revents, void *userdata);
81 typedef int (*sd_event_time_handler_t)(sd_event_source *s, uint64_t usec, void *userdata);
82 typedef int (*sd_event_signal_handler_t)(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata);
83-#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
84 typedef int (*sd_event_child_handler_t)(sd_event_source *s, const siginfo_t *si, void *userdata);
85-#else
86-typedef void* sd_event_child_handler_t;
87-#endif
88
89 int sd_event_default(sd_event **e);
90
91--
922.12.1
93
diff --git a/meta-oe/recipes-connectivity/networkmanager/networkmanager/0005-sd-lldp.h-Remove-net-ethernet.h-seems-to-be-over-spe.patch b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0005-sd-lldp.h-Remove-net-ethernet.h-seems-to-be-over-spe.patch
new file mode 100644
index 0000000000..f4a04c782c
--- /dev/null
+++ b/meta-oe/recipes-connectivity/networkmanager/networkmanager/0005-sd-lldp.h-Remove-net-ethernet.h-seems-to-be-over-spe.patch
@@ -0,0 +1,36 @@
1From 9e9e5814456ec23b9fc669d342bf9d8f7ee49fc2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 31 Mar 2017 16:48:00 -0700
4Subject: [PATCH 5/5] sd-lldp.h: Remove net/ethernet.h seems to be over
5 specified
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 src/systemd/src/systemd/sd-lldp.h | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12Index: NetworkManager-1.4.2/src/systemd/src/systemd/sd-lldp.h
13===================================================================
14--- NetworkManager-1.4.2.orig/src/systemd/src/systemd/sd-lldp.h
15+++ NetworkManager-1.4.2/src/systemd/src/systemd/sd-lldp.h
16@@ -22,7 +22,7 @@
17 ***/
18
19 #include <inttypes.h>
20-#include <net/ethernet.h>
21+//#include <net/ethernet.h>
22 #include <sys/types.h>
23
24 #include "sd-event.h"
25Index: NetworkManager-1.4.2/src/systemd/src/libsystemd-network/sd-lldp.c
26===================================================================
27--- NetworkManager-1.4.2.orig/src/systemd/src/libsystemd-network/sd-lldp.c
28+++ NetworkManager-1.4.2/src/systemd/src/libsystemd-network/sd-lldp.c
29@@ -21,6 +21,7 @@
30 #include "nm-sd-adapt.h"
31
32 #include <arpa/inet.h>
33+#include <net/ethernet.h>
34
35 #include "sd-lldp.h"
36
diff --git a/meta-oe/recipes-connectivity/networkmanager/networkmanager_1.4.2.bb b/meta-oe/recipes-connectivity/networkmanager/networkmanager_1.4.2.bb
index 064c58b520..90499a6b70 100644
--- a/meta-oe/recipes-connectivity/networkmanager/networkmanager_1.4.2.bb
+++ b/meta-oe/recipes-connectivity/networkmanager/networkmanager_1.4.2.bb
@@ -23,11 +23,16 @@ DEPENDS = " \
23 23
24inherit gnomebase gettext systemd bluetooth bash-completion vala gobject-introspection 24inherit gnomebase gettext systemd bluetooth bash-completion vala gobject-introspection
25 25
26SRC_URI = " \ 26SRC_URI = "${GNOME_MIRROR}/NetworkManager/${@gnome_verdir("${PV}")}/NetworkManager-${PV}.tar.xz \
27 ${GNOME_MIRROR}/NetworkManager/${@gnome_verdir("${PV}")}/NetworkManager-${PV}.tar.xz \ 27 file://0001-don-t-try-to-run-sbin-dhclient-to-get-the-version-nu.patch \
28 file://0001-don-t-try-to-run-sbin-dhclient-to-get-the-version-nu.patch \ 28 file://0002-Fix-nm-version-macro-includes.patch \
29 file://0002-Fix-nm-version-macro-includes.patch \ 29 file://0001-adjust-net-headers-for-musl-compatibility.patch \
30" 30 file://0002-socket-util.h-Include-linux-sockios.h-on-musl.patch \
31 file://0003-Define-ETH_ALEN.patch \
32 file://0004-Define-missing-features-to-cater-for-musl.patch \
33 file://0005-sd-lldp.h-Remove-net-ethernet.h-seems-to-be-over-spe.patch \
34 file://0001-check-for-strndupa-before-using-it.patch \
35 "
31SRC_URI[md5sum] = "59b5b5585467756787c6cb535cbd306e" 36SRC_URI[md5sum] = "59b5b5585467756787c6cb535cbd306e"
32SRC_URI[sha256sum] = "a864e347ddf6da8dabd40e0185b8c10a655d4a94b45cbaa2b3bb4b5e8360d204" 37SRC_URI[sha256sum] = "a864e347ddf6da8dabd40e0185b8c10a655d4a94b45cbaa2b3bb4b5e8360d204"
33 38