Initial commit
This commit is contained in:
131
package/libs/libnl/Makefile
Normal file
131
package/libs/libnl/Makefile
Normal file
@@ -0,0 +1,131 @@
|
||||
#
|
||||
# Copyright (C) 2006-2013 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libnl
|
||||
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_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
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
URL:=http://www.infradead.org/~tgr/libnl/
|
||||
endef
|
||||
|
||||
define Package/libnl-core
|
||||
$(call Package/libnl/default)
|
||||
TITLE:=Core Netlink Library
|
||||
DEPENDS:=+libpthread
|
||||
endef
|
||||
|
||||
define Package/libnl-genl
|
||||
$(call Package/libnl/default)
|
||||
TITLE:=Generic Netlink Library
|
||||
DEPENDS:=+libnl-core
|
||||
endef
|
||||
|
||||
define Package/libnl-route
|
||||
$(call Package/libnl/default)
|
||||
TITLE:=Routing Netlink Library
|
||||
DEPENDS:=+libnl-core
|
||||
endef
|
||||
|
||||
define Package/libnl-nf
|
||||
$(call Package/libnl/default)
|
||||
TITLE:=Netfilter Netlink Library
|
||||
DEPENDS:=+libnl-route
|
||||
endef
|
||||
|
||||
define Package/libnl
|
||||
$(call Package/libnl/default)
|
||||
TITLE:=Full Netlink Library
|
||||
DEPENDS:=+libnl-genl +libnl-route +libnl-nf
|
||||
endef
|
||||
|
||||
define Package/libnl-core/description
|
||||
Common code for all netlink libraries
|
||||
endef
|
||||
|
||||
define Package/libnl-genl/description
|
||||
Generic Netlink Library Functions
|
||||
endef
|
||||
|
||||
define Package/libnl-route/description
|
||||
Routing Netlink Library Functions
|
||||
endef
|
||||
|
||||
define Package/libnl-nf/description
|
||||
Netfilter Netlink Library Functions
|
||||
endef
|
||||
|
||||
define Package/libnl/description
|
||||
Socket handling, connection management, sending and receiving of data,
|
||||
message construction and parsing, object caching system, etc.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -ffunction-sections $(FPIC)
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--disable-debug
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/libnl3 $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/libnl3/* $(1)/usr/include/libnl3/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
|
||||
|
||||
# Copy symlinks
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so $(1)/usr/lib/libnl.so
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so $(1)/usr/lib/libnl-genl.so
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so $(1)/usr/lib/libnl-nf.so
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so $(1)/usr/lib/libnl-route.so
|
||||
endef
|
||||
|
||||
define Package/libnl-core/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so $(1)/usr/lib/libnl.so
|
||||
endef
|
||||
|
||||
define Package/libnl-genl/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so $(1)/usr/lib/libnl-genl.so
|
||||
endef
|
||||
|
||||
define Package/libnl-route/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so $(1)/usr/lib/libnl-route.so
|
||||
endef
|
||||
|
||||
define Package/libnl-nf/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so $(1)/usr/lib/libnl-nf.so
|
||||
endef
|
||||
|
||||
define Package/libnl/install
|
||||
:
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libnl-core))
|
||||
$(eval $(call BuildPackage,libnl-genl))
|
||||
$(eval $(call BuildPackage,libnl-route))
|
||||
$(eval $(call BuildPackage,libnl-nf))
|
||||
$(eval $(call BuildPackage,libnl))
|
||||
@@ -0,0 +1,30 @@
|
||||
From db0d59cd06f3ffd350379847c0885e1bfb85af0f Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
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 <thomas.petazzoni@free-electrons.com>
|
||||
---
|
||||
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
|
||||
|
||||
@@ -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 <linux/types.h>
|
||||
+#include <linux/libc-compat.h>
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
@@ -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 <baruch@tkos.co.il>
|
||||
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 <baruch@tkos.co.il>
|
||||
---
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user