diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-03-31 18:53:16 -0700 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-04-05 19:28:30 +0200 |
commit | 38f0f1310b3bae6edaf4d6185b49163c63eaa96d (patch) | |
tree | c6e78f3afb72a6890377d0d8d75bff5fa398a02b | |
parent | 254a9f82a60e0e60ca625e61b921696b33a3ad30 (diff) | |
download | meta-openembedded-contrib-38f0f1310b3bae6edaf4d6185b49163c63eaa96d.tar.gz |
networkmanager: Fix build on musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
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 @@ +From 047d3bf96b510740f64687480333c378e414995f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 31 Mar 2017 15:57:05 -0700 +Subject: [PATCH 1/5] adjust net/ headers for musl compatibility + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + libnm-core/nm-utils.c | 12 +++++++----- + libnm-core/nm-utils.h | 5 ++--- + src/platform/wifi/wifi-utils.h | 2 +- + 3 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c +index df75d56..868224e 100644 +--- a/libnm-core/nm-utils.c ++++ b/libnm-core/nm-utils.c +@@ -19,24 +19,26 @@ + * Copyright 2005 - 2014 Red Hat, Inc. + */ + +-#include "nm-default.h" +- +-#include "nm-utils.h" +- + #include <string.h> + #include <errno.h> + #include <stdlib.h> +-#include <netinet/ether.h> + #include <arpa/inet.h> + #include <uuid/uuid.h> + #include <libintl.h> + #include <gmodule.h> + #include <sys/stat.h> ++//#include <net/if_arp.h> ++//#include <net/ethernet.h> ++#include <netinet/ether.h> ++ ++#include "nm-default.h" + ++#include "nm-utils.h" + #if WITH_JANSSON + #include <jansson.h> + #endif + ++ + #include "nm-common-macros.h" + #include "nm-utils-private.h" + #include "nm-setting-private.h" +diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h +index 407c14e..156ccae 100644 +--- a/libnm-core/nm-utils.h ++++ b/libnm-core/nm-utils.h +@@ -27,11 +27,10 @@ + + #include <glib.h> + +-#include <netinet/in.h> +- + /* For ETH_ALEN and INFINIBAND_ALEN */ +-#include <linux/if_ether.h> ++//#include <linux/if_ether.h> + #include <linux/if_infiniband.h> ++#include <netinet/in.h> + + #include "nm-core-enum-types.h" + #include "nm-setting-wireless-security.h" +diff --git a/src/platform/wifi/wifi-utils.h b/src/platform/wifi/wifi-utils.h +index 8e2b93f..84f5ce9 100644 +--- a/src/platform/wifi/wifi-utils.h ++++ b/src/platform/wifi/wifi-utils.h +@@ -22,7 +22,7 @@ + #ifndef __WIFI_UTILS_H__ + #define __WIFI_UTILS_H__ + +-#include <net/ethernet.h> ++//#include <net/ethernet.h> + + #include "nm-dbus-interface.h" + +-- +2.12.1 + 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 @@ +From 05e8bd664d0244cb8ab4376b962830b97860f6bf Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 31 Mar 2017 18:37:19 -0700 +Subject: [PATCH] check for strndupa before using it + +musl does not have strndupa + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + config.h.in | 4 ++++ + configure.ac | 1 + + src/systemd/src/basic/alloc-util.h | 12 ++++++++++++ + 3 files changed, 17 insertions(+) + +diff --git a/config.h.in b/config.h.in +index db8c135..c4229ed 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -41,6 +41,10 @@ + */ + #undef HAVE_DCGETTEXT + ++/* Define to 1 if you have the declaration of `strndupa', and to 0 if you ++ don't. */ ++#undef HAVE_DECL_STRNDUPA ++ + /* Define to 1 if you have the <dlfcn.h> header file. */ + #undef HAVE_DLFCN_H + +diff --git a/configure.ac b/configure.ac +index 2630f8d..d0a57fd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -54,6 +54,7 @@ AC_SUBST(NM_VERSION) + + GIT_SHA_RECORD(NM_GIT_SHA) + ++AC_CHECK_DECLS([strndupa], [], [], [[#include <string.h>]]) + dnl + dnl Checks for typedefs, structures, and compiler characteristics. + dnl +diff --git a/src/systemd/src/basic/alloc-util.h b/src/systemd/src/basic/alloc-util.h +index ceeee51..924b59c 100644 +--- a/src/systemd/src/basic/alloc-util.h ++++ b/src/systemd/src/basic/alloc-util.h +@@ -25,6 +25,18 @@ + #include <string.h> + + #include "macro.h" ++#include "config.h" ++ ++#if !HAVE_DECL_STRNDUPA ++#define strndupa(s, n) \ ++ ({ \ ++ const char *__old = (s); \ ++ size_t __len = strnlen(__old, (n)); \ ++ char *__new = (char *)alloca(__len + 1); \ ++ __new[__len] = '\0'; \ ++ (char *)memcpy(__new, __old, __len); \ ++ }) ++#endif + + #define new(t, n) ((t*) malloc_multiply(sizeof(t), (n))) + +-- +2.12.1 + 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 @@ +From 98d7e3ae5b15e30af1bf5dd1d279e1a774bf2b86 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 31 Mar 2017 16:05:05 -0700 +Subject: [PATCH 2/5] socket-util.h: Include linux/sockios.h on musl + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/systemd/src/basic/socket-util.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/systemd/src/basic/socket-util.h b/src/systemd/src/basic/socket-util.h +index 2536b08..76d6107 100644 +--- a/src/systemd/src/basic/socket-util.h ++++ b/src/systemd/src/basic/socket-util.h +@@ -29,6 +29,12 @@ + #include <linux/netlink.h> + #include <linux/if_packet.h> + ++#if !defined(__GLIBC__) ++/* SIOCGSTAMPNS from linux/asm-generic.h ++ * for src/systemd/src/libsystemd-network/sd-lldp.c */ ++#include <linux/sockios.h> ++#endif ++ + #include "macro.h" + #include "util.h" + +-- +2.12.1 + 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 @@ +From 16c3dc7a407101243d2056d2c93e61dce1a05350 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 31 Mar 2017 16:08:45 -0700 +Subject: [PATCH 3/5] Define ETH_ALEN + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + libnm-core/nm-utils.h | 1 + + src/platform/wifi/wifi-utils.h | 2 ++ + 2 files changed, 3 insertions(+) + +diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h +index 156ccae..68e222b 100644 +--- a/libnm-core/nm-utils.h ++++ b/libnm-core/nm-utils.h +@@ -29,6 +29,7 @@ + + /* For ETH_ALEN and INFINIBAND_ALEN */ + //#include <linux/if_ether.h> ++#define ETH_ALEN 6 /* Octets in one ethernet addr */ + #include <linux/if_infiniband.h> + #include <netinet/in.h> + +diff --git a/src/platform/wifi/wifi-utils.h b/src/platform/wifi/wifi-utils.h +index 84f5ce9..33a838d 100644 +--- a/src/platform/wifi/wifi-utils.h ++++ b/src/platform/wifi/wifi-utils.h +@@ -24,6 +24,8 @@ + + //#include <net/ethernet.h> + ++#define ETH_ALEN 6 /* Octets in one ethernet addr */ ++ + #include "nm-dbus-interface.h" + + typedef struct WifiData WifiData; +-- +2.12.1 + 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 @@ +From 2153109e60e362e0d09215d529bf00176f31a3e7 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 31 Mar 2017 16:09:41 -0700 +Subject: [PATCH 4/5] Define missing features to cater for musl + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/systemd/sd-adapt/nm-sd-adapt.h | 2 +- + src/systemd/src/basic/parse-util.c | 5 ++++- + src/systemd/src/basic/stdio-util.h | 2 ++ + src/systemd/src/basic/util.h | 5 +++++ + src/systemd/src/systemd/sd-event.h | 4 ---- + 5 files changed, 12 insertions(+), 6 deletions(-) + +diff --git a/src/systemd/sd-adapt/nm-sd-adapt.h b/src/systemd/sd-adapt/nm-sd-adapt.h +index cf27c1a..72c1b89 100644 +--- a/src/systemd/sd-adapt/nm-sd-adapt.h ++++ b/src/systemd/sd-adapt/nm-sd-adapt.h +@@ -119,7 +119,7 @@ G_STMT_START { \ + # ifdef HAVE___SECURE_GETENV + # define secure_getenv __secure_getenv + # else +-# error neither secure_getenv nor __secure_getenv is available ++# define secure_getenv getenv + # endif + #endif + +diff --git a/src/systemd/src/basic/parse-util.c b/src/systemd/src/basic/parse-util.c +index 2738663..9c21e5a 100644 +--- a/src/systemd/src/basic/parse-util.c ++++ b/src/systemd/src/basic/parse-util.c +@@ -25,8 +25,11 @@ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> ++#ifdef __GLIBC__ + #include <xlocale.h> +- ++#else ++#include <locale.h> ++#endif + #include "alloc-util.h" + #include "extract-word.h" + #include "macro.h" +diff --git a/src/systemd/src/basic/stdio-util.h b/src/systemd/src/basic/stdio-util.h +index bd1144b..c92e935 100644 +--- a/src/systemd/src/basic/stdio-util.h ++++ b/src/systemd/src/basic/stdio-util.h +@@ -19,7 +19,9 @@ + along with systemd; If not, see <http://www.gnu.org/licenses/>. + ***/ + ++#ifdef __GLIBC__ + #include <printf.h> ++#endif + #include <stdarg.h> + #include <stdio.h> + #include <sys/types.h> +diff --git a/src/systemd/src/basic/util.h b/src/systemd/src/basic/util.h +index bb2fc31..fe074a5 100644 +--- a/src/systemd/src/basic/util.h ++++ b/src/systemd/src/basic/util.h +@@ -46,6 +46,11 @@ + #include "missing.h" + #include "time-util.h" + ++#if !defined(__GLIBC__) ++typedef int (*__compar_fn_t) (const void*, const void*); ++typedef __compar_fn_t comparison_fn_t; ++#endif ++ + size_t page_size(void) _pure_; + #define PAGE_ALIGN(l) ALIGN_TO((l), page_size()) + +diff --git a/src/systemd/src/systemd/sd-event.h b/src/systemd/src/systemd/sd-event.h +index cc26b7d..c7e0004 100644 +--- a/src/systemd/src/systemd/sd-event.h ++++ b/src/systemd/src/systemd/sd-event.h +@@ -69,11 +69,7 @@ typedef int (*sd_event_handler_t)(sd_event_source *s, void *userdata); + typedef int (*sd_event_io_handler_t)(sd_event_source *s, int fd, uint32_t revents, void *userdata); + typedef int (*sd_event_time_handler_t)(sd_event_source *s, uint64_t usec, void *userdata); + typedef int (*sd_event_signal_handler_t)(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata); +-#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED + typedef int (*sd_event_child_handler_t)(sd_event_source *s, const siginfo_t *si, void *userdata); +-#else +-typedef void* sd_event_child_handler_t; +-#endif + + int sd_event_default(sd_event **e); + +-- +2.12.1 + 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 @@ +From 9e9e5814456ec23b9fc669d342bf9d8f7ee49fc2 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 31 Mar 2017 16:48:00 -0700 +Subject: [PATCH 5/5] sd-lldp.h: Remove net/ethernet.h seems to be over + specified + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/systemd/src/systemd/sd-lldp.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: NetworkManager-1.4.2/src/systemd/src/systemd/sd-lldp.h +=================================================================== +--- NetworkManager-1.4.2.orig/src/systemd/src/systemd/sd-lldp.h ++++ NetworkManager-1.4.2/src/systemd/src/systemd/sd-lldp.h +@@ -22,7 +22,7 @@ + ***/ + + #include <inttypes.h> +-#include <net/ethernet.h> ++//#include <net/ethernet.h> + #include <sys/types.h> + + #include "sd-event.h" +Index: NetworkManager-1.4.2/src/systemd/src/libsystemd-network/sd-lldp.c +=================================================================== +--- NetworkManager-1.4.2.orig/src/systemd/src/libsystemd-network/sd-lldp.c ++++ NetworkManager-1.4.2/src/systemd/src/libsystemd-network/sd-lldp.c +@@ -21,6 +21,7 @@ + #include "nm-sd-adapt.h" + + #include <arpa/inet.h> ++#include <net/ethernet.h> + + #include "sd-lldp.h" + 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 = " \ inherit gnomebase gettext systemd bluetooth bash-completion vala gobject-introspection -SRC_URI = " \ - ${GNOME_MIRROR}/NetworkManager/${@gnome_verdir("${PV}")}/NetworkManager-${PV}.tar.xz \ - file://0001-don-t-try-to-run-sbin-dhclient-to-get-the-version-nu.patch \ - file://0002-Fix-nm-version-macro-includes.patch \ -" +SRC_URI = "${GNOME_MIRROR}/NetworkManager/${@gnome_verdir("${PV}")}/NetworkManager-${PV}.tar.xz \ + file://0001-don-t-try-to-run-sbin-dhclient-to-get-the-version-nu.patch \ + file://0002-Fix-nm-version-macro-includes.patch \ + file://0001-adjust-net-headers-for-musl-compatibility.patch \ + file://0002-socket-util.h-Include-linux-sockios.h-on-musl.patch \ + file://0003-Define-ETH_ALEN.patch \ + file://0004-Define-missing-features-to-cater-for-musl.patch \ + file://0005-sd-lldp.h-Remove-net-ethernet.h-seems-to-be-over-spe.patch \ + file://0001-check-for-strndupa-before-using-it.patch \ + " SRC_URI[md5sum] = "59b5b5585467756787c6cb535cbd306e" SRC_URI[sha256sum] = "a864e347ddf6da8dabd40e0185b8c10a655d4a94b45cbaa2b3bb4b5e8360d204" |