Ver código fonte

package/libmnl: add options to build examples

The example applications, which are minimal, can be of great help in
understanding how the library works.

As there is no configure option to enable examples compilation, building
and installation instructions had to be added to libmnl.mk. By default,
which is always the case for buildroot, they are disabled.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Dario Binacchi 3 anos atrás
pai
commit
858e6183d6
2 arquivos alterados com 37 adições e 0 exclusões
  1. 9 0
      package/libmnl/Config.in
  2. 28 0
      package/libmnl/libmnl.mk

+ 9 - 0
package/libmnl/Config.in

@@ -5,3 +5,12 @@ config BR2_PACKAGE_LIBMNL
 	  to Netlink developers.
 
 	  http://netfilter.org/projects/libmnl/
+
+if BR2_PACKAGE_LIBMNL
+
+config BR2_PACKAGE_LIBMNL_EXAMPLES
+	bool "install examples"
+	help
+	  Install binary examples.
+
+endif

+ 28 - 0
package/libmnl/libmnl.mk

@@ -12,4 +12,32 @@ LIBMNL_LICENSE = LGPL-2.1+
 LIBMNL_LICENSE_FILES = COPYING
 LIBMNL_CPE_ID_VENDOR = netfilter
 
+ifeq ($(BR2_PACKAGE_LIBMNL_EXAMPLES),y)
+define LIBMNL_EXAMPLES_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) check -C $(@D)
+endef
+LIBMNL_POST_BUILD_HOOKS += LIBMNL_EXAMPLES_BUILD_CMDS
+
+LIBMNL_EXAMPLES_INSTALL_TARGETS += \
+	$(addprefix examples/genl/, genl-family-get genl-group-events)
+LIBMNL_EXAMPLES_INSTALL_TARGETS += \
+	$(addprefix examples/kobject/, kobject-event)
+LIBMNL_EXAMPLES_INSTALL_TARGETS += \
+	$(addprefix examples/netfilter/, nfct-create-batch \
+		nfct-daemon nfct-dump nfct-event nf-log \
+		nf-queue)
+LIBMNL_EXAMPLES_INSTALL_TARGETS += \
+	$(addprefix examples/rtnl/, rtnl-addr-add rtnl-addr-dump \
+		rtnl-link-dump rtnl-link-dump2 rtnl-link-dump3 \
+		rtnl-link-event rtnl-link-set rtnl-neigh-dump \
+		rtnl-route-add rtnl-route-dump rtnl-route-event)
+
+define LIBMNL_EXAMPLES_INSTALL_TARGET_CMDS
+	$(foreach t,$(LIBMNL_EXAMPLES_INSTALL_TARGETS), \
+		$(INSTALL) -D -m 0755 $(@D)/$(t) \
+			$(TARGET_DIR)/usr/bin/$(notdir $(t))$(sep))
+endef
+LIBMNL_POST_INSTALL_TARGET_HOOKS += LIBMNL_EXAMPLES_INSTALL_TARGET_CMDS
+endif
+
 $(eval $(autotools-package))