From: Daniel Engberg Date: Sat, 13 May 2017 14:38:56 +0000 (+0200) Subject: libs/libnl: Update to 3.3.0 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e4b6900fd60e43ba0527172c30290a69958b7f73;p=openwrt%2Fstaging%2Fthess.git libs/libnl: Update to 3.3.0 Update libnl to 3.3.0 Import patches to fix compilation Source: https://git.busybox.net/buildroot/tree/package/libnl Source: https://gitweb.gentoo.org/proj/musl.git/diff/dev-libs/libnl/files/libnl-3.3.0_rc1-musl.patch?id=48d2a287 Use more automatic toolchain logic Signed-off-by: Daniel Engberg --- diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile index 7916556c00..67201cc7cc 100644 --- a/package/libs/libnl/Makefile +++ b/package/libs/libnl/Makefile @@ -8,14 +8,17 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnl -PKG_VERSION:=3.2.29 +PKG_VERSION:=3.3.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/thom311/libnl/releases/download/libnl3_2_29 -PKG_HASH:=0beb593dc6abfffa18a5c787b27884979c1b7e7f1fd468c801e3cc938a685922 +PKG_SOURCE_URL:=https://github.com/thom311/libnl/releases/download/libnl3_3_0 +PKG_HASH:=705468b5ae4cd1eb099d2d1c476d6a3abe519bc2810becf12fb1e32de1e074e4 PKG_LICENSE:=LGPL-2.1 +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + include $(INCLUDE_DIR)/package.mk define Package/libnl/default @@ -77,13 +80,6 @@ endef TARGET_CFLAGS += -ffunction-sections $(FPIC) -define Build/Compile - $(call Build/Compile/Default) - make -C $(PKG_BUILD_DIR) \ - DESTDIR="$(PKG_INSTALL_DIR)" \ - install -endef - define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include/libnl3 $(1)/usr/lib/pkgconfig $(CP) $(PKG_INSTALL_DIR)/usr/include/libnl3/* $(1)/usr/include/libnl3/ diff --git a/package/libs/libnl/patches/0001-lib-Escape-usage-of-strerror_l-if-it-doesn-t-exist-i.patch b/package/libs/libnl/patches/0001-lib-Escape-usage-of-strerror_l-if-it-doesn-t-exist-i.patch deleted file mode 100644 index a31ef47729..0000000000 --- a/package/libs/libnl/patches/0001-lib-Escape-usage-of-strerror_l-if-it-doesn-t-exist-i.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 098a4cc35b0da4438b8b67a914edecebef5bb6a9 Mon Sep 17 00:00:00 2001 -From: Alexey Brodkin -Date: Fri, 10 Mar 2017 13:22:14 +0300 -Subject: [PATCH] lib: Escape usage of strerror_l() if it doesn't exist in libc - -uClibc doesn't implement strerror_l() and thus libnl starting from -3.2.29 couldn't be compiled with it any longer. - -To work-around that problem we'll just do a check on strerror_l() -availability during configuration and if it's not there just fall back -to locale-less strerror(). - -Signed-off-by: Alexey Brodkin -Cc: Andre Draszik -Cc: Thomas Haller ---- - -This patch is now accepted upstream and will be a part of the next libnl -release, see -https://github.com/thom311/libnl/commit/e15966ac7f3b43df2acf869f98089762807d0568 - - configure.ac | 2 ++ - lib/utils.c | 8 +++++++- - src/lib/utils.c | 6 ++++++ - 3 files changed, 15 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 68b285e5b15c..2739b997ee3a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -121,6 +121,8 @@ fi - - AC_CONFIG_SUBDIRS([doc]) - -+AC_CHECK_FUNCS([strerror_l]) -+ - AC_CONFIG_FILES([ - Makefile - libnl-3.0.pc -diff --git a/lib/utils.c b/lib/utils.c -index fb350d13fd2f..06273c5b291e 100644 ---- a/lib/utils.c -+++ b/lib/utils.c -@@ -30,7 +30,9 @@ - #include - #include - #include /* exit() */ -+#ifdef HAVE_STRERROR_L - #include -+#endif - - /** - * Global variable indicating the desired level of debugging output. -@@ -123,9 +125,10 @@ int __nl_read_num_str_file(const char *path, int (*cb)(long, const char *)) - - const char *nl_strerror_l(int err) - { -+ const char *buf; -+#ifdef HAVE_STRERROR_L - int errno_save = errno; - locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0); -- const char *buf; - - if (loc == (locale_t)0) { - if (errno == ENOENT) -@@ -140,6 +143,9 @@ const char *nl_strerror_l(int err) - } - - errno = errno_save; -+#else -+ buf = strerror(err); -+#endif - return buf; - } - /** @endcond */ -diff --git a/src/lib/utils.c b/src/lib/utils.c -index 5878f279c364..feb1d4ef4056 100644 ---- a/src/lib/utils.c -+++ b/src/lib/utils.c -@@ -81,6 +81,7 @@ void nl_cli_fatal(int err, const char *fmt, ...) - fprintf(stderr, "\n"); - } else { - char *buf; -+#ifdef HAVE_STRERROR_L - locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0); - if (loc == (locale_t)0) { - if (errno == ENOENT) -@@ -91,9 +92,14 @@ void nl_cli_fatal(int err, const char *fmt, ...) - } - if (loc != (locale_t)0) - buf = strerror_l(err, loc); -+#else -+ buf = strerror(err); -+#endif - fprintf(stderr, "%s\n", buf); -+#ifdef HAVE_STRERROR_L - if (loc != (locale_t)0) - freelocale(loc); -+#endif - } - - exit(abs(err)); --- -2.7.4 - diff --git a/package/libs/libnl/patches/100-build-add-Libs.private-field-in-libnl-pkg-config-file.patch b/package/libs/libnl/patches/100-build-add-Libs.private-field-in-libnl-pkg-config-file.patch new file mode 100644 index 0000000000..845a593761 --- /dev/null +++ b/package/libs/libnl/patches/100-build-add-Libs.private-field-in-libnl-pkg-config-file.patch @@ -0,0 +1,30 @@ +From db0d59cd06f3ffd350379847c0885e1bfb85af0f Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 7 Mar 2015 11:34:42 +0100 +Subject: [PATCH 2/2] build: add Libs.private field in libnl pkg-config file + +In order to support static linking, the libnl pkg-config file should +indicate in its Libs.private field the libraries that libnl-3.0.a +requires. The LIBS variable contains the appropriate list of +libraries: -lm in all cases, and -lpthread when pthread support is +enabled. This allows to statically link applications against libnl +properly. + +Signed-off-by: Thomas Petazzoni +--- + libnl-3.0.pc.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libnl-3.0.pc.in b/libnl-3.0.pc.in +index b87e3dc..ddbc999 100644 +--- a/libnl-3.0.pc.in ++++ b/libnl-3.0.pc.in +@@ -7,4 +7,5 @@ Name: libnl + Description: Convenience library for netlink sockets + Version: @PACKAGE_VERSION@ + Libs: -L${libdir} -lnl-@MAJ_VERSION@ ++Libs.private: @LIBS@ + Cflags: -I${includedir}/libnl@MAJ_VERSION@ +-- +2.1.0 + diff --git a/package/libs/libnl/patches/101-add-musl-workaround-to-the-libc-compat.h-copy.patch b/package/libs/libnl/patches/101-add-musl-workaround-to-the-libc-compat.h-copy.patch new file mode 100644 index 0000000000..11dc75b898 --- /dev/null +++ b/package/libs/libnl/patches/101-add-musl-workaround-to-the-libc-compat.h-copy.patch @@ -0,0 +1,103 @@ +diff -Naur libnl-3.3.0_rc1.orig/include/linux-private/linux/if_ether.h libnl-3.3.0_rc1/include/linux-private/linux/if_ether.h +--- /include/linux-private/linux/if_ether.h 2017-03-08 19:56:31.824516933 -0800 ++++ /include/linux-private/linux/if_ether.h 2017-03-08 20:07:01.938237767 -0800 +@@ -22,6 +22,7 @@ + #define _LINUX_IF_ETHER_H + + #include ++#include + + /* + * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble +@@ -117,10 +118,12 @@ + * This is an Ethernet frame header. + */ + ++#if __UAPI_DEF_ETHHDR + struct ethhdr { + unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ + unsigned char h_source[ETH_ALEN]; /* source ether addr */ + __be16 h_proto; /* packet type ID field */ + } __attribute__((packed)); ++#endif + + #endif /* _LINUX_IF_ETHER_H */ +diff -Naur libnl-3.3.0_rc1.orig/include/linux-private/linux/libc-compat.h libnl-3.3.0_rc1/include/linux-private/linux/libc-compat.h +--- /include/linux-private/linux/libc-compat.h 2017-03-08 19:56:31.823516923 -0800 ++++ /include/linux-private/linux/libc-compat.h 2017-03-08 20:12:30.376843489 -0800 +@@ -48,10 +48,18 @@ + #ifndef _LIBC_COMPAT_H + #define _LIBC_COMPAT_H + +-/* We have included glibc headers... */ +-#if defined(__GLIBC__) ++/* We're used from userspace... */ ++#if !defined(__KERNEL__) + +-/* Coordinate with glibc netinet/in.h header. */ ++/* Coordinate with libc netinet/if_ether.h */ ++#ifdef _NETINET_IF_ETHER_H /* musl */ ++#define __UAPI_DEF_ETHHDR 0 ++#else ++/* glibc uses __NETINET_IF_ETHER_H, and uses the uapi header. */ ++#define __UAPI_DEF_ETHHDR 1 ++#endif ++ ++/* Coordinate with libc netinet/in.h header. */ + #if defined(_NETINET_IN_H) + + /* GLIBC headers included first so don't define anything +@@ -64,15 +72,7 @@ + #define __UAPI_DEF_IN_CLASS 0 + + #define __UAPI_DEF_IN6_ADDR 0 +-/* The exception is the in6_addr macros which must be defined +- * if the glibc code didn't define them. This guard matches +- * the guard in glibc/inet/netinet/in.h which defines the +- * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */ +-#if defined(__USE_MISC) || defined (__USE_GNU) + #define __UAPI_DEF_IN6_ADDR_ALT 0 +-#else +-#define __UAPI_DEF_IN6_ADDR_ALT 1 +-#endif + #define __UAPI_DEF_SOCKADDR_IN6 0 + #define __UAPI_DEF_IPV6_MREQ 0 + #define __UAPI_DEF_IPPROTO_V6 0 +@@ -83,7 +83,7 @@ + #else + + /* Linux headers included first, and we must define everything +- * we need. The expectation is that glibc will check the ++ * we need. The expectation is that libc will check the + * __UAPI_DEF_* defines and adjust appropriately. */ + #define __UAPI_DEF_IN_ADDR 1 + #define __UAPI_DEF_IN_IPPROTO 1 +@@ -93,7 +93,7 @@ + #define __UAPI_DEF_IN_CLASS 1 + + #define __UAPI_DEF_IN6_ADDR 1 +-/* We unconditionally define the in6_addr macros and glibc must ++/* We unconditionally define the in6_addr macros and libc must + * coordinate. */ + #define __UAPI_DEF_IN6_ADDR_ALT 1 + #define __UAPI_DEF_SOCKADDR_IN6 1 +@@ -115,7 +115,10 @@ + /* If we did not see any headers from any supported C libraries, + * or we are being included in the kernel, then define everything + * that we need. */ +-#else /* !defined(__GLIBC__) */ ++#else /* defined(__KERNEL__) */ ++ ++/* Definitions for if/ether.h */ ++#define __UAPI_DEF_ETHHDR 1 + + /* Definitions for in.h */ + #define __UAPI_DEF_IN_ADDR 1 +@@ -138,6 +141,6 @@ + /* Definitions for xattr.h */ + #define __UAPI_DEF_XATTR 1 + +-#endif /* __GLIBC__ */ ++#endif /* defined(__KERNEL__) */ + + #endif /* _LIBC_COMPAT_H */ diff --git a/package/libs/libnl/patches/102-revert-build-enable-building-cli-during-tests.patch b/package/libs/libnl/patches/102-revert-build-enable-building-cli-during-tests.patch new file mode 100644 index 0000000000..f715bb83f9 --- /dev/null +++ b/package/libs/libnl/patches/102-revert-build-enable-building-cli-during-tests.patch @@ -0,0 +1,115 @@ +From 68f8393bd356a3d0598cf77e1044b7e8b98aa4d8 Mon Sep 17 00:00:00 2001 +Message-Id: <68f8393bd356a3d0598cf77e1044b7e8b98aa4d8.1493920165.git.baruch@tkos.co.il> +From: Baruch Siach +Date: Thu, 4 May 2017 15:56:14 +0300 +Subject: [PATCH] Revert "build: enable building cli during tests" + +This reverts commit 3cb28534d34392ceec4adead0cfa97039796ccb7. + +Contrary to what 3cb28534d commit log claims, the cli programs depend on +dynamic libraries support of the toolchain. Enabling cli programs +unconditionally breaks static build as follows: + +In file included from lib/cli/cls/basic.c:12:0: +./include/netlink/cli/utils.h:25:19: fatal error: dlfcn.h: No such file or directory +compilation terminated. +Makefile:3666: recipe for target 'lib/cli/cls/lib_cli_cls_basic_la-basic.lo' failed +make[1]: *** [lib/cli/cls/lib_cli_cls_basic_la-basic.lo] Error 1 + +Revert that commit to restore the ability of static only build of libnl, and +its dependencies. + +Signed-off-by: Baruch Siach +--- +Upstream status: https://github.com/thom311/libnl/pull/141 + + Makefile.am | 21 ++++++--------------- + 1 file changed, 6 insertions(+), 15 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 1b95a559304f..279548394650 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -3,8 +3,6 @@ + ACLOCAL_AMFLAGS = -I m4 + + lib_LTLIBRARIES = +-noinst_LTLIBRARIES = +-check_LTLIBRARIES = + + check_PROGRAMS = + check_programs = +@@ -500,6 +498,8 @@ EXTRA_lib_libnl_xfrm_3_la_DEPENDENCIES = \ + lib_libnl_xfrm_3_la_LIBADD = \ + lib/libnl-3.la + ++if ENABLE_CLI ++ + lib_cli_ltlibraries_cls = \ + lib/cli/cls/basic.la \ + lib/cli/cls/cgroup.la +@@ -513,15 +513,11 @@ lib_cli_ltlibraries_qdisc = \ + lib/cli/qdisc/pfifo.la \ + lib/cli/qdisc/plug.la + +-if ENABLE_CLI + pkglib_clsdir = $(pkglibdir)/cli/cls + pkglib_qdiscdir = $(pkglibdir)/cli/qdisc + pkglib_cls_LTLIBRARIES = $(lib_cli_ltlibraries_cls) + pkglib_qdisc_LTLIBRARIES = $(lib_cli_ltlibraries_qdisc) +-else +-noinst_LTLIBRARIES += \ +- $(lib_cli_ltlibraries_cls) \ +- $(lib_cli_ltlibraries_qdisc) ++ + endif + + lib_cli_ldflags = \ +@@ -550,13 +546,8 @@ lib_cli_qdisc_plug_la_LDFLAGS = $(lib_cli_ldflags) + + ############################################################################### + +-src_lib_ldflags = +- + if ENABLE_CLI + lib_LTLIBRARIES += src/lib/libnl-cli-3.la +-src_lib_ldflags += -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +-else +-check_LTLIBRARIES += src/lib/libnl-cli-3.la + endif + + src_lib_libnl_cli_3_la_SOURCES = \ +@@ -583,7 +574,7 @@ src_lib_libnl_cli_3_la_CPPFLAGS = \ + -I$(srcdir)/include \ + -I$(builddir)/include + src_lib_libnl_cli_3_la_LDFLAGS = \ +- $(src_lib_ldflags) \ ++ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ + -Wl,--version-script=$(srcdir)/libnl-cli-3.sym + src_lib_libnl_cli_3_la_LIBADD = \ + lib/libnl-3.la \ +@@ -668,8 +659,6 @@ else + noinst_PROGRAMS += $(cli_programs) + endif + endif +-else +-check_PROGRAMS += $(cli_programs) + endif + + src_genl_ctrl_list_CPPFLAGS = $(src_cppflags) +@@ -847,10 +836,12 @@ tests_test_complex_HTB_with_hash_filters_LDADD = $(tests_ldadd) + tests_test_u32_filter_with_actions_CPPFLAGS = $(tests_cppflags) + tests_test_u32_filter_with_actions_LDADD = $(tests_ldadd) + ++if ENABLE_CLI + check_PROGRAMS += \ + tests/test-cache-mngr \ + tests/test-genl \ + tests/test-nf-cache-mngr ++endif + + tests_cli_ldadd = \ + $(tests_ldadd) \ +-- +2.11.0 + diff --git a/package/network/utils/wpan-tools/patches/001-src-nl_extras.h-fix-compatibility-with-libnl-3.3.0.patch b/package/network/utils/wpan-tools/patches/001-src-nl_extras.h-fix-compatibility-with-libnl-3.3.0.patch new file mode 100644 index 0000000000..1370854b6b --- /dev/null +++ b/package/network/utils/wpan-tools/patches/001-src-nl_extras.h-fix-compatibility-with-libnl-3.3.0.patch @@ -0,0 +1,44 @@ +From bb522bd584f05e6658d5dba97f48ca018f46394c Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 6 May 2017 14:36:08 +0200 +Subject: [PATCH] src/nl_extras.h: fix compatibility with libnl 3.3.0 + +nl_extras.h defines a set of nla_set_s*() functions if not provided by +libnl. They are provided by libnl since version 3.2.26. The test +(LIBNL_VER_MIC <= 26) was working fine while libnl was in the 3.2.x +series, but now that they have incremented the minor version, the +micro version was reset to 0, with the latest libnl version being +3.3.0. + +Due to this, the condition (LIBNL_VER_MIC <= 26) is true, and we get +redefinition errors because nl_extras.h redefines functions already +provided by libnl. + +This commit improves the condition so that nl_extras.h provides the +missing functions only if the minor version is < 2, or if minor is 2 +and micro is < 26. + +Signed-off-by: Thomas Petazzoni +--- + src/nl_extras.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/src/nl_extras.h ++++ b/src/nl_extras.h +@@ -1,7 +1,7 @@ + #ifndef __NL_EXTRAS_H + #define __NL_EXTRAS_H + +-#if LIBNL_VER_MIC <= 26 ++#if (LIBNL_VER_MIN < 2) || (LIBNL_VER_MIN == 2) && (LIBNL_VER_MIC <= 26) + + #ifndef NLA_S8 + +@@ -45,6 +45,6 @@ static inline int32_t nla_get_s32(struct + + #endif /* NLA_S64 */ + +-#endif /* LIBNL_VER_MIC */ ++#endif /* LIBNL_VER_* */ + + #endif /* __NL_EXTRAS_H */