All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/libmnl: add options to build examples
@ 2022-05-01 14:18 Dario Binacchi via buildroot
  2022-05-01 19:50 ` Yann E. MORIN
  0 siblings, 1 reply; 2+ messages in thread
From: Dario Binacchi via buildroot @ 2022-05-01 14:18 UTC (permalink / raw)
  To: buildroot; +Cc: 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 <dariobin@libero.it>
---
 package/libmnl/Config.in | 37 +++++++++++++++++++++++++++++++++++++
 package/libmnl/libmnl.mk | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+)

diff --git a/package/libmnl/Config.in b/package/libmnl/Config.in
index 5acfb2447e..81b3811270 100644
--- a/package/libmnl/Config.in
+++ b/package/libmnl/Config.in
@@ -5,3 +5,40 @@ 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.
+
+if BR2_PACKAGE_LIBMNL_EXAMPLES
+
+config BR2_PACKAGE_LIBMNL_EXAMPLES_GENL
+	bool "genl"
+	help
+	  This option will build and install the genl examples for
+	  the target.
+
+config BR2_PACKAGE_LIBMNL_EXAMPLES_KOBJECT
+	bool "kobject"
+	help
+	  This option will build and install the kobject examples
+	  for the target.
+
+config BR2_PACKAGE_LIBMNL_EXAMPLES_NETFILTER
+	bool "netfilter"
+	help
+	  This option will build and install the netfilter examples
+	  for the target.
+
+config BR2_PACKAGE_LIBMNL_EXAMPLES_RTNL
+	bool "rtnl"
+	help
+	  This option will build and install the rtnl examples for
+	  the target.
+
+endif
+
+endif
diff --git a/package/libmnl/libmnl.mk b/package/libmnl/libmnl.mk
index 3361d05248..cb31b0f75f 100644
--- a/package/libmnl/libmnl.mk
+++ b/package/libmnl/libmnl.mk
@@ -12,4 +12,43 @@ 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
+
+ifeq ($(BR2_PACKAGE_LIBMNL_EXAMPLES_GENL),y)
+LIBMNL_EXAMPLES_INSTALL_TARGETS += \
+	$(addprefix examples/genl/, genl-family-get genl-group-events)
+endif
+
+ifeq ($(BR2_PACKAGE_LIBMNL_EXAMPLES_KOBJECT),y)
+LIBMNL_EXAMPLES_INSTALL_TARGETS += \
+	$(addprefix examples/kobject/, kobject-event)
+endif
+
+ifeq ($(BR2_PACKAGE_LIBMNL_EXAMPLES_NETFILTER),y)
+LIBMNL_EXAMPLES_INSTALL_TARGETS += \
+	$(addprefix examples/netfilter/, nfct-create-batch \
+		nfct-daemon nfct-dump nfct-event nf-log \
+		nf-queue)
+endif
+
+ifeq ($(BR2_PACKAGE_LIBMNL_EXAMPLES_RTNL),y)
+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)
+endif
+
+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))
-- 
2.17.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/libmnl: add options to build examples
  2022-05-01 14:18 [Buildroot] [PATCH 1/1] package/libmnl: add options to build examples Dario Binacchi via buildroot
@ 2022-05-01 19:50 ` Yann E. MORIN
  0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2022-05-01 19:50 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: buildroot

Dario, All,

On 2022-05-01 16:18 +0200, Dario Binacchi via buildroot spake thusly:
> 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.

I thjink it does not make much sense to add an option for each example.
Instead, just build all of them when BR2_PACKAGE_LIBMNL_EXAMPLES is set.

Can you rework and respin, please?

Regards,
Yann E. MORIN.

> Signed-off-by: Dario Binacchi <dariobin@libero.it>
> ---
>  package/libmnl/Config.in | 37 +++++++++++++++++++++++++++++++++++++
>  package/libmnl/libmnl.mk | 39 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 76 insertions(+)
> 
> diff --git a/package/libmnl/Config.in b/package/libmnl/Config.in
> index 5acfb2447e..81b3811270 100644
> --- a/package/libmnl/Config.in
> +++ b/package/libmnl/Config.in
> @@ -5,3 +5,40 @@ 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.
> +
> +if BR2_PACKAGE_LIBMNL_EXAMPLES
> +
> +config BR2_PACKAGE_LIBMNL_EXAMPLES_GENL
> +	bool "genl"
> +	help
> +	  This option will build and install the genl examples for
> +	  the target.
> +
> +config BR2_PACKAGE_LIBMNL_EXAMPLES_KOBJECT
> +	bool "kobject"
> +	help
> +	  This option will build and install the kobject examples
> +	  for the target.
> +
> +config BR2_PACKAGE_LIBMNL_EXAMPLES_NETFILTER
> +	bool "netfilter"
> +	help
> +	  This option will build and install the netfilter examples
> +	  for the target.
> +
> +config BR2_PACKAGE_LIBMNL_EXAMPLES_RTNL
> +	bool "rtnl"
> +	help
> +	  This option will build and install the rtnl examples for
> +	  the target.
> +
> +endif
> +
> +endif
> diff --git a/package/libmnl/libmnl.mk b/package/libmnl/libmnl.mk
> index 3361d05248..cb31b0f75f 100644
> --- a/package/libmnl/libmnl.mk
> +++ b/package/libmnl/libmnl.mk
> @@ -12,4 +12,43 @@ 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
> +
> +ifeq ($(BR2_PACKAGE_LIBMNL_EXAMPLES_GENL),y)
> +LIBMNL_EXAMPLES_INSTALL_TARGETS += \
> +	$(addprefix examples/genl/, genl-family-get genl-group-events)
> +endif
> +
> +ifeq ($(BR2_PACKAGE_LIBMNL_EXAMPLES_KOBJECT),y)
> +LIBMNL_EXAMPLES_INSTALL_TARGETS += \
> +	$(addprefix examples/kobject/, kobject-event)
> +endif
> +
> +ifeq ($(BR2_PACKAGE_LIBMNL_EXAMPLES_NETFILTER),y)
> +LIBMNL_EXAMPLES_INSTALL_TARGETS += \
> +	$(addprefix examples/netfilter/, nfct-create-batch \
> +		nfct-daemon nfct-dump nfct-event nf-log \
> +		nf-queue)
> +endif
> +
> +ifeq ($(BR2_PACKAGE_LIBMNL_EXAMPLES_RTNL),y)
> +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)
> +endif
> +
> +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))
> -- 
> 2.17.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-01 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-01 14:18 [Buildroot] [PATCH 1/1] package/libmnl: add options to build examples Dario Binacchi via buildroot
2022-05-01 19:50 ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.