From 985b2c3db7495f12683abb778984cb672a672985 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Sat, 14 Jan 2017 17:15:28 +0100 Subject: [PATCH] NetworkManager: fix musl. --- srcpkgs/NetworkManager/files/musl_defines.h | 40 +++++++ srcpkgs/NetworkManager/patches/fix-musl.patch | 103 ++++++++++++++++++ srcpkgs/NetworkManager/template | 10 +- 3 files changed, 148 insertions(+), 5 deletions(-) create mode 100644 srcpkgs/NetworkManager/files/musl_defines.h create mode 100644 srcpkgs/NetworkManager/patches/fix-musl.patch diff --git a/srcpkgs/NetworkManager/files/musl_defines.h b/srcpkgs/NetworkManager/files/musl_defines.h new file mode 100644 index 00000000000..5e0a4c51575 --- /dev/null +++ b/srcpkgs/NetworkManager/files/musl_defines.h @@ -0,0 +1,40 @@ +#ifndef MUSL_DEFINES_H +#define MUSL_DEFINES_H + +#define IFF_TUN 0x0001 +#define IFF_TAP 0x0002 +#define IFF_NO_PI 0x1000 +#define IFF_VNET_HDR 0x4000 +#define IFF_TUN_EXCL 0x8000 +#define TUNSETIFF _IOW('T', 202, int) +#define TUNSETPERSIST _IOW('T', 203, int) +#define TUNSETOWNER _IOW('T', 204, int) +#define TUNSETGROUP _IOW('T', 206, int) + +enum { + IFLA_GRE_UNSPEC, + IFLA_GRE_LINK, + IFLA_GRE_IFLAGS, + IFLA_GRE_OFLAGS, + IFLA_GRE_IKEY, + IFLA_GRE_OKEY, + IFLA_GRE_LOCAL, + IFLA_GRE_REMOTE, + IFLA_GRE_TTL, + IFLA_GRE_TOS, + IFLA_GRE_PMTUDISC, + IFLA_GRE_ENCAP_LIMIT, + IFLA_GRE_FLOWINFO, + IFLA_GRE_FLAGS, + IFLA_GRE_ENCAP_TYPE, + IFLA_GRE_ENCAP_FLAGS, + IFLA_GRE_ENCAP_SPORT, + IFLA_GRE_ENCAP_DPORT, + IFLA_GRE_COLLECT_METADATA, + IFLA_GRE_IGNORE_DF, + __IFLA_GRE_MAX, +}; + +#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) + +#endif /* !MUSL_DEFINES_H */ diff --git a/srcpkgs/NetworkManager/patches/fix-musl.patch b/srcpkgs/NetworkManager/patches/fix-musl.patch new file mode 100644 index 00000000000..fdfd026c3ee --- /dev/null +++ b/srcpkgs/NetworkManager/patches/fix-musl.patch @@ -0,0 +1,103 @@ +--- libnm-core/nm-utils.h.orig 2017-01-14 13:13:15.458590816 +0100 ++++ libnm-core/nm-utils.h 2017-01-14 13:14:38.569521150 +0100 +@@ -30,8 +30,13 @@ + #include + + /* For ETH_ALEN and INFINIBAND_ALEN */ ++#ifdef __GLIBC__ + #include + #include ++#else ++#define ETH_ALEN 6 /* Octets in one ethernet addr */ ++#define INFINIBAND_ALEN 20 /* Octets in IPoIB HW addr */ ++#endif + + #include "nm-core-enum-types.h" + #include "nm-setting-wireless-security.h" +--- src/platform/nm-linux-platform.c.orig 2016-12-15 20:39:00.000000000 +0100 ++++ src/platform/nm-linux-platform.c 2017-01-14 13:34:51.509504441 +0100 +@@ -30,10 +30,15 @@ + #include + #include + #include ++#ifdef __GLIBC__ + #include + #include + #include + #include + #include ++#else ++#include ++#include "../../musl_defines.h" ++#endif + #include + #include +--- src/systemd/src/basic/util.h.orig 2017-01-14 14:11:23.719666887 +0100 ++++ src/systemd/src/basic/util.h 2017-01-14 14:11:39.890653333 +0100 +@@ -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()) + +--- src/systemd/src/basic/stdio-util.h.orig 2017-01-14 14:17:08.268378080 +0100 ++++ src/systemd/src/basic/stdio-util.h 2017-01-14 14:17:48.499344359 +0100 +@@ -19,7 +19,9 @@ + along with systemd; If not, see . + ***/ + ++#ifdef __GLIBC__ + #include ++#endif + #include + #include + #include + +--- src/systemd/src/basic/in-addr-util.c.orig 2017-01-14 14:22:17.147119172 +0100 ++++ src/systemd/src/basic/in-addr-util.c 2017-01-14 14:22:49.402092135 +0100 +@@ -32,6 +32,15 @@ + #include "parse-util.h" + #include "util.h" + ++#ifndef strndupa ++#define strndupa(s, n) \ ++ (__extension__ ({const char *__in = (s); \ ++ size_t __len = strnlen (__in, (n)) + 1; \ ++ char *__out = (char *) alloca (__len); \ ++ __out[__len-1] = '\0'; \ ++ (char *) memcpy (__out, __in, __len-1);})) ++#endif ++ + bool in4_addr_is_null(const struct in_addr *a) { + return a->s_addr == 0; + } + +--- src/systemd/src/basic/parse-util.c.orig 2017-01-14 14:25:54.270937174 +0100 ++++ src/systemd/src/basic/parse-util.c 2017-01-14 14:26:08.422925312 +0100 +@@ -25,7 +25,9 @@ + #include + #include + #include ++#ifdef __GLIBC__ + #include ++#endif + + #include "alloc-util.h" + #include "extract-word.h" + +--- src/systemd/src/libsystemd-network/sd-lldp.c.orig 2017-03-03 17:19:32.513074615 +0100 ++++ src/systemd/src/libsystemd-network/sd-lldp.c 2017-03-03 17:21:21.668728717 +0100 +@@ -21,6 +21,7 @@ + #include "nm-sd-adapt.h" + + #include ++#include + + #include "sd-lldp.h" + diff --git a/srcpkgs/NetworkManager/template b/srcpkgs/NetworkManager/template index 4bdf8456fca..dc3756f5456 100644 --- a/srcpkgs/NetworkManager/template +++ b/srcpkgs/NetworkManager/template @@ -22,11 +22,6 @@ homepage="https://wiki.gnome.org/Projects/NetworkManager" license="GPL-2" distfiles="${GNOME_SITE}/$pkgname/${version%.*}/$pkgname-$version.tar.xz" checksum=829378f318cc008d138a23ca6a9191928ce75344e7e47a2f2c35f4ac82133309 -case "$XBPS_TARGET_MACHINE" in -*-musl) - broken="https://build.voidlinux.eu/builders/x86_64-musl_builder/builds/1111/steps/shell_3/logs/stdio" - ;; -esac hostmakedepends=" automake libtool pkg-config intltool gnutls-devel glib-devel dbus-glib-devel @@ -44,6 +39,10 @@ make_dirs=" /etc/NetworkManager/dispatcher.d/pre-up.d 0750 root root /etc/NetworkManager/dispatcher.d/pre-down.d 0750 root root " +case "$XBPS_TARGET_MACHINE" in +*-musl) CFLAGS+="-DHAVE_SECURE_GETENV -Dsecure_getenv=getenv -D__USE_POSIX199309" + ;; +esac # Package build options build_options="gir" @@ -53,6 +52,7 @@ fi pre_configure() { NOCONFIGURE=1 ./autogen.sh + cp $FILESDIR/musl_defines.h . # Full switch to /run to not depend on /var/run being a symlink. sed -e 's,^nmrundir=.*$,nmrundir=\"/run/\$PACKAGE\",' -i configure