package/libmnl: add options to build examples
PATCH v2 1/1 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.
---
Changes v1 -> v2:
- Build all examples when BR2_PACKAGE_LIBMNL_EXAMPLES is set.
--- package/libmnl/Config.in | 9 +++++++++ package/libmnl/libmnl.mk | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+)
package/libmnl/Config.in +9 -0
@@ -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
package/libmnl/libmnl.mk +28 -0
@@ -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))
Signature · 6 lines
2.17.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 40 lines · Dario Binacchi
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 <[email protected]>---
Changes v1 -> v2:
- Build all examples whenBR2_PACKAGE_LIBMNL_EXAMPLESis set.--- package/libmnl/Config.in | 9 +++++++++ package/libmnl/libmnl.mk | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+)package/libmnl/Config.in +9
-0@@ -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. + +endifpackage/libmnl/libmnl.mk +0
-0@@ -12,4 +12,32 @@ LIBMNL_LICENSE = LGPL-2.1+ LIBMNL_LICENSE_FILES = COPYING LIBMNL_CPE_ID_VENDOR = netfilter
package/libmnl/libmnl.mk LIBMNL_LICENSE = LGPL-2.1+ · line 23
Quoted 10 lines
package/libmnl/libmnl.mk +9
-0+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 += \
This could have been simpler as
LIBMNL_EXAMPLES_INSTALL_TARGETS = \ $(addprefix ...) \ $(addprefix ...) \ ....
But I was too lazy to fix it up, so I applied to master as is, thanks.
Regards,
Arnout
Quoted 10 lines
package/libmnl/libmnl.mk +10
-0+ $(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)
package/libmnl/libmnl.mk LIBMNL_LICENSE = LGPL-2.1+ · line 43
Quoted 10 lines
package/libmnl/libmnl.mk +9
-0+ +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))
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot