NetworkManager: fix musl.

This commit is contained in:
Enno Boland 2017-01-14 17:15:28 +01:00
parent 4d2cffa96a
commit 985b2c3db7
3 changed files with 148 additions and 5 deletions

View File

@ -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 */

View File

@ -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 <netinet/in.h>
/* For ETH_ALEN and INFINIBAND_ALEN */
+#ifdef __GLIBC__
#include <linux/if_ether.h>
#include <linux/if_infiniband.h>
+#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 <arpa/inet.h>
#include <netinet/icmp6.h>
#include <netinet/in.h>
+#ifdef __GLIBC__
#include <linux/ip.h>
#include <linux/if_arp.h>
#include <linux/if_link.h>
#include <linux/if_tun.h>
#include <linux/if_tunnel.h>
+#else
+#include <netinet/ip.h>
+#include "../../musl_defines.h"
+#endif
#include <netlink/netlink.h>
#include <netlink/msg.h>
--- 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 <http://www.gnu.org/licenses/>.
***/
+#ifdef __GLIBC__
#include <printf.h>
+#endif
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
--- 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef __GLIBC__
#include <xlocale.h>
+#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 <arpa/inet.h>
+#include <linux/sockios.h>
#include "sd-lldp.h"

View File

@ -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