diff mbox series

[1/1] package/netsniff-ng: Allow to build with uclibc but w/o mausezahn

Message ID 20190304085741.13782-1-vadim4j@gmail.com
State Accepted
Headers show
Series [1/1] package/netsniff-ng: Allow to build with uclibc but w/o mausezahn | expand

Commit Message

Vadym Kochan March 4, 2019, 8:57 a.m. UTC
mausezahn can't be build with uclibc because uclibc
does not provide ceill() function, so it does not allow
to build all netsniff-ng's tools with uclibc.

Fix it by moving mausezahn under separate config option,
which has own dependencies and packages selection (libnet & libcli).

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 package/netsniff-ng/Config.in      | 27 +++++++++++++++++++--------
 package/netsniff-ng/netsniff-ng.mk | 16 +++++++++++-----
 2 files changed, 30 insertions(+), 13 deletions(-)

Comments

Arnout Vandecappelle March 4, 2019, 7:06 p.m. UTC | #1
Hi Vadim,

On 04/03/2019 09:57, Vadim Kochan wrote:
> mausezahn can't be build with uclibc because uclibc
> does not provide ceill() function, so it does not allow
> to build all netsniff-ng's tools with uclibc.
> 
> Fix it by moving mausezahn under separate config option,
> which has own dependencies and packages selection (libnet & libcli).
> 
> Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> ---
>  package/netsniff-ng/Config.in      | 27 +++++++++++++++++++--------
>  package/netsniff-ng/netsniff-ng.mk | 16 +++++++++++-----
>  2 files changed, 30 insertions(+), 13 deletions(-)
> 
> diff --git a/package/netsniff-ng/Config.in b/package/netsniff-ng/Config.in
> index c4803b2fa2..15862ff433 100644
> --- a/package/netsniff-ng/Config.in
> +++ b/package/netsniff-ng/Config.in
> @@ -1,16 +1,12 @@
> -config BR2_PACKAGE_NETSNIFF_NG
> +menuconfig BR2_PACKAGE_NETSNIFF_NG
>  	bool "netsniff-ng"
> -	# Build with uClibc fails due to missing ceill()
> -	depends on !BR2_TOOLCHAIN_USES_UCLIBC
>  	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
>  	depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
>  	select BR2_PACKAGE_LIBNL
>  	select BR2_PACKAGE_LIBPCAP
> -	select BR2_PACKAGE_LIBCLI
>  	select BR2_PACKAGE_LIBNETFILTER_CONNTRACK
>  	select BR2_PACKAGE_LIBURCU
> -	select BR2_PACKAGE_LIBNET
>  	help
>  	  netsniff-ng is a free, performant Linux network analyzer and
>  	  networking toolkit. If you will, the Swiss army knife for
> @@ -18,7 +14,22 @@ config BR2_PACKAGE_NETSNIFF_NG
>  
>  	  http://netsniff-ng.org
>  
> -comment "netsniff-ng needs a glibc or musl toolchain w/ threads, headers >= 3.0"
> +if BR2_PACKAGE_NETSNIFF_NG
> +
> +config BR2_PACKAGE_NETSNIFF_NG_MAUSEZAHN
> +	bool "mausezahn"

 Is it worth to add a separate config for this? I.e., does it give significant
saving in either binary size (including libcli and libnet dependencies) or
runtime performance?

 If not, we prefer to handle it "automatically" in the .mk file only. In other
words, keep the libcli and libnet selects above but make them conditional on
!uclibc, and change the .mk file as indicated below...

> +	default y
> +	# Build with uClibc fails due to missing ceill()
> +	depends on !BR2_TOOLCHAIN_USES_UCLIBC
> +	select BR2_PACKAGE_LIBCLI
> +	select BR2_PACKAGE_LIBNET
> +
> +comment "mausezahn needs glibc or musl toolchain"
> +	depends on BR2_TOOLCHAIN_USES_UCLIBC
> +
> +endif
> +
> +comment "netsniff-ng needs a toolchain w/ threads, headers >= 3.0"
>  	depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
> -	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAIN_USES_UCLIBC \
> -		|| !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
> +	depends on !BR2_TOOLCHAIN_HAS_THREADS  || \
> +			!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
> diff --git a/package/netsniff-ng/netsniff-ng.mk b/package/netsniff-ng/netsniff-ng.mk
> index 77d8921425..9fe50f10d3 100644
> --- a/package/netsniff-ng/netsniff-ng.mk
> +++ b/package/netsniff-ng/netsniff-ng.mk
> @@ -13,9 +13,14 @@ NETSNIFF_NG_LICENSE_FILES = README COPYING
>  NETSNIFF_NG_CONF_ENV = \
>  	NACL_INC_DIR=/dev/null \
>  	NACL_LIB_DIR=/dev/null
> -NETSNIFF_NG_DEPENDENCIES = \
> -	libnl libpcap libcli libnetfilter_conntrack \
> -	liburcu libnet
> +NETSNIFF_NG_DEPENDENCIES = libnl libpcap libnetfilter_conntrack liburcu
> +
> +NETSNIFF_NG_TOOLS = netsniff-ng trafgen astraceroute flowtop ifpps bpfc curvetun
> +
> +ifeq ($(BR2_PACKAGE_NETSNIFF_NG_MAUSEZAHN),y)

 ... make this condition

ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),)

(and move the comment from Config.in to here).

> +NETSNIFF_NG_DEPENDENCIES += libcli libnet
> +NETSNIFF_NG_TOOLS += mausezahn
> +endif
>  
>  ifeq ($(BR2_PACKAGE_GEOIP),y)
>  NETSNIFF_NG_DEPENDENCIES += geoip
> @@ -41,12 +46,13 @@ define NETSNIFF_NG_CONFIGURE_CMDS
>  endef
>  
>  define NETSNIFF_NG_BUILD_CMDS
> -	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
> +	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) $(NETSNIFF_NG_TOOLS)
>  endef
>  
>  define NETSNIFF_NG_INSTALL_TARGET_CMDS
>  	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
> -		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install -C $(@D)
> +		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install \
> +			-C $(@D) $(NETSNIFF_NG_TOOLS)

 I don't like very much that we have to enumerate the tools in the .mk file, but
I don't see any other possibility.

 Regards,
 Arnout

>  endef
>  
>  $(eval $(generic-package))
>
Vadym Kochan March 6, 2019, 5:29 a.m. UTC | #2
Hi Arnout,

On Mon, Mar 04, 2019 at 08:06:00PM +0100, Arnout Vandecappelle wrote:
>  Hi Vadim,
> 
> On 04/03/2019 09:57, Vadim Kochan wrote:
> > mausezahn can't be build with uclibc because uclibc
> > does not provide ceill() function, so it does not allow
> > to build all netsniff-ng's tools with uclibc.
> > 
> > Fix it by moving mausezahn under separate config option,
> > which has own dependencies and packages selection (libnet & libcli).
> > 
> > Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
> > ---
> >  package/netsniff-ng/Config.in      | 27 +++++++++++++++++++--------
> >  package/netsniff-ng/netsniff-ng.mk | 16 +++++++++++-----
> >  2 files changed, 30 insertions(+), 13 deletions(-)
> > 
> > diff --git a/package/netsniff-ng/Config.in b/package/netsniff-ng/Config.in
> > index c4803b2fa2..15862ff433 100644
> > --- a/package/netsniff-ng/Config.in
> > +++ b/package/netsniff-ng/Config.in
> > @@ -1,16 +1,12 @@
> > -config BR2_PACKAGE_NETSNIFF_NG
> > +menuconfig BR2_PACKAGE_NETSNIFF_NG
> >  	bool "netsniff-ng"
> > -	# Build with uClibc fails due to missing ceill()
> > -	depends on !BR2_TOOLCHAIN_USES_UCLIBC
> >  	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
> >  	depends on BR2_TOOLCHAIN_HAS_THREADS
> >  	depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
> >  	select BR2_PACKAGE_LIBNL
> >  	select BR2_PACKAGE_LIBPCAP
> > -	select BR2_PACKAGE_LIBCLI
> >  	select BR2_PACKAGE_LIBNETFILTER_CONNTRACK
> >  	select BR2_PACKAGE_LIBURCU
> > -	select BR2_PACKAGE_LIBNET
> >  	help
> >  	  netsniff-ng is a free, performant Linux network analyzer and
> >  	  networking toolkit. If you will, the Swiss army knife for
> > @@ -18,7 +14,22 @@ config BR2_PACKAGE_NETSNIFF_NG
> >  
> >  	  http://netsniff-ng.org
> >  
> > -comment "netsniff-ng needs a glibc or musl toolchain w/ threads, headers >= 3.0"
> > +if BR2_PACKAGE_NETSNIFF_NG
> > +
> > +config BR2_PACKAGE_NETSNIFF_NG_MAUSEZAHN
> > +	bool "mausezahn"
> 
>  Is it worth to add a separate config for this? I.e., does it give significant
> saving in either binary size (including libcli and libnet dependencies) or
> runtime performance?
> 
>  If not, we prefer to handle it "automatically" in the .mk file only. In other
> words, keep the libcli and libnet selects above but make them conditional on
> !uclibc, and change the .mk file as indicated below...

Well libnet + libcli uses ~180K, but actually I thought that it is OK to
get rid not needed dependencies), if you think this is not good then
I will prepare a patch for netsniff-ng's configure script which will check
ceill() support and will skip the mausezahn compilation.

> 
> > +	default y
> > +	# Build with uClibc fails due to missing ceill()
> > +	depends on !BR2_TOOLCHAIN_USES_UCLIBC
> > +	select BR2_PACKAGE_LIBCLI
> > +	select BR2_PACKAGE_LIBNET
> > +
> > +comment "mausezahn needs glibc or musl toolchain"
> > +	depends on BR2_TOOLCHAIN_USES_UCLIBC
> > +
> > +endif
> > +
> > +comment "netsniff-ng needs a toolchain w/ threads, headers >= 3.0"
> >  	depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
> > -	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAIN_USES_UCLIBC \
> > -		|| !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
> > +	depends on !BR2_TOOLCHAIN_HAS_THREADS  || \
> > +			!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
> > diff --git a/package/netsniff-ng/netsniff-ng.mk b/package/netsniff-ng/netsniff-ng.mk
> > index 77d8921425..9fe50f10d3 100644
> > --- a/package/netsniff-ng/netsniff-ng.mk
> > +++ b/package/netsniff-ng/netsniff-ng.mk
> > @@ -13,9 +13,14 @@ NETSNIFF_NG_LICENSE_FILES = README COPYING
> >  NETSNIFF_NG_CONF_ENV = \
> >  	NACL_INC_DIR=/dev/null \
> >  	NACL_LIB_DIR=/dev/null
> > -NETSNIFF_NG_DEPENDENCIES = \
> > -	libnl libpcap libcli libnetfilter_conntrack \
> > -	liburcu libnet
> > +NETSNIFF_NG_DEPENDENCIES = libnl libpcap libnetfilter_conntrack liburcu
> > +
> > +NETSNIFF_NG_TOOLS = netsniff-ng trafgen astraceroute flowtop ifpps bpfc curvetun
> > +
> > +ifeq ($(BR2_PACKAGE_NETSNIFF_NG_MAUSEZAHN),y)
> 
>  ... make this condition
> 
> ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),)
> 
> (and move the comment from Config.in to here).
> 
> > +NETSNIFF_NG_DEPENDENCIES += libcli libnet
> > +NETSNIFF_NG_TOOLS += mausezahn
> > +endif
> >  
> >  ifeq ($(BR2_PACKAGE_GEOIP),y)
> >  NETSNIFF_NG_DEPENDENCIES += geoip
> > @@ -41,12 +46,13 @@ define NETSNIFF_NG_CONFIGURE_CMDS
> >  endef
> >  
> >  define NETSNIFF_NG_BUILD_CMDS
> > -	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
> > +	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) $(NETSNIFF_NG_TOOLS)
> >  endef
> >  
> >  define NETSNIFF_NG_INSTALL_TARGET_CMDS
> >  	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
> > -		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install -C $(@D)
> > +		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install \
> > +			-C $(@D) $(NETSNIFF_NG_TOOLS)
> 
>  I don't like very much that we have to enumerate the tools in the .mk file, but
> I don't see any other possibility.
> 
>  Regards,
>  Arnout
> 
> >  endef
> >  
> >  $(eval $(generic-package))
> > 

Regards,
Vadim Kochan
Arnout Vandecappelle March 6, 2019, 9:28 a.m. UTC | #3
On 06/03/2019 06:29, Vadim Kochan wrote:
> Hi Arnout,
> 
> On Mon, Mar 04, 2019 at 08:06:00PM +0100, Arnout Vandecappelle wrote:
>>  Hi Vadim,
>>
>> On 04/03/2019 09:57, Vadim Kochan wrote:
[snip]
>>> +if BR2_PACKAGE_NETSNIFF_NG
>>> +
>>> +config BR2_PACKAGE_NETSNIFF_NG_MAUSEZAHN
>>> +	bool "mausezahn"
>>
>>  Is it worth to add a separate config for this? I.e., does it give significant
>> saving in either binary size (including libcli and libnet dependencies) or
>> runtime performance?
>>
>>  If not, we prefer to handle it "automatically" in the .mk file only. In other
>> words, keep the libcli and libnet selects above but make them conditional on
>> !uclibc, and change the .mk file as indicated below...
> 
> Well libnet + libcli uses ~180K,

 That indeed sounds significant. To really compare you should do a minimal build
of netsniff-ng and its dependencies using a musl toolchain; if that ends up at
something like 2MB rootfs size, the 180K is worth it.

 We'd still typically have it in the .mk file only, like:

ifeq ($(BR2_PACKAGE_LIBCLI)$(BR2_PACKAGE_LIBNET):$(BR2_TOOLCHAIN_USES_UCLIBC),yy:)

 However, in this case the libcli and libnet dependencies are very non-obvious,
so having an explicit Config.in option indeed makes sense.

> but actually I thought that it is OK to
> get rid not needed dependencies), if you think this is not good then
> I will prepare a patch for netsniff-ng's configure script which will check
> ceill() support and will skip the mausezahn compilation.

 That would be even better of course, because then we don't need that explicit
list of tools.

 Now you mention it, it looks like the libpcap dependency is also only used for
mausezahn...

 Regards,
 Arnout

> 
>>
>>> +	default y
>>> +	# Build with uClibc fails due to missing ceill()
>>> +	depends on !BR2_TOOLCHAIN_USES_UCLIBC
>>> +	select BR2_PACKAGE_LIBCLI
>>> +	select BR2_PACKAGE_LIBNET
>>> +
>>> +comment "mausezahn needs glibc or musl toolchain"
>>> +	depends on BR2_TOOLCHAIN_USES_UCLIBC
>>> +
>>> +endif
>>> +
>>> +comment "netsniff-ng needs a toolchain w/ threads, headers >= 3.0"
>>>  	depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
>>> -	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAIN_USES_UCLIBC \
>>> -		|| !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
>>> +	depends on !BR2_TOOLCHAIN_HAS_THREADS  || \
>>> +			!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
>>> diff --git a/package/netsniff-ng/netsniff-ng.mk b/package/netsniff-ng/netsniff-ng.mk
>>> index 77d8921425..9fe50f10d3 100644
>>> --- a/package/netsniff-ng/netsniff-ng.mk
>>> +++ b/package/netsniff-ng/netsniff-ng.mk
>>> @@ -13,9 +13,14 @@ NETSNIFF_NG_LICENSE_FILES = README COPYING
>>>  NETSNIFF_NG_CONF_ENV = \
>>>  	NACL_INC_DIR=/dev/null \
>>>  	NACL_LIB_DIR=/dev/null
>>> -NETSNIFF_NG_DEPENDENCIES = \
>>> -	libnl libpcap libcli libnetfilter_conntrack \
>>> -	liburcu libnet
>>> +NETSNIFF_NG_DEPENDENCIES = libnl libpcap libnetfilter_conntrack liburcu
>>> +
>>> +NETSNIFF_NG_TOOLS = netsniff-ng trafgen astraceroute flowtop ifpps bpfc curvetun
>>> +
>>> +ifeq ($(BR2_PACKAGE_NETSNIFF_NG_MAUSEZAHN),y)
>>
>>  ... make this condition
>>
>> ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),)
>>
>> (and move the comment from Config.in to here).
>>
>>> +NETSNIFF_NG_DEPENDENCIES += libcli libnet
>>> +NETSNIFF_NG_TOOLS += mausezahn
>>> +endif
>>>  
>>>  ifeq ($(BR2_PACKAGE_GEOIP),y)
>>>  NETSNIFF_NG_DEPENDENCIES += geoip
>>> @@ -41,12 +46,13 @@ define NETSNIFF_NG_CONFIGURE_CMDS
>>>  endef
>>>  
>>>  define NETSNIFF_NG_BUILD_CMDS
>>> -	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
>>> +	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) $(NETSNIFF_NG_TOOLS)
>>>  endef
>>>  
>>>  define NETSNIFF_NG_INSTALL_TARGET_CMDS
>>>  	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
>>> -		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install -C $(@D)
>>> +		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install \
>>> +			-C $(@D) $(NETSNIFF_NG_TOOLS)
>>
>>  I don't like very much that we have to enumerate the tools in the .mk file, but
>> I don't see any other possibility.
>>
>>  Regards,
>>  Arnout
>>
>>>  endef
>>>  
>>>  $(eval $(generic-package))
>>>
> 
> Regards,
> Vadim Kochan
>
Thomas Petazzoni March 28, 2019, 5:15 p.m. UTC | #4
On Mon, 4 Mar 2019 20:06:00 +0100
Arnout Vandecappelle <arnout@mind.be> wrote:

> >  define NETSNIFF_NG_INSTALL_TARGET_CMDS
> >  	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
> > -		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install -C $(@D)
> > +		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install \
> > +			-C $(@D) $(NETSNIFF_NG_TOOLS)  
> 
>  I don't like very much that we have to enumerate the tools in the .mk file, but
> I don't see any other possibility.

The Makefile has the following targets:

	allbutmausezahn: $(filter-out mausezahn,$(TOOLS))

	install_allbutmausezahn: $(foreach tool,$(filter-out mausezahn,$(TOOLS)),$(tool)_install)

So I think we can build/install everything except mausezahen fairly
easily without duplicating the list of tools in netsniff-ng.mk.

Best regards,

Thomas
Thomas Petazzoni March 28, 2019, 5:16 p.m. UTC | #5
Hello,

On Wed, 6 Mar 2019 10:28:26 +0100
Arnout Vandecappelle <arnout@mind.be> wrote:

>  Now you mention it, it looks like the libpcap dependency is also only used for
> mausezahn...

Not so sure:

$ grep pcap.h bpf_comp.c 
#include <pcap.h>
$ grep bpf_comp netsniff-ng/Makefile 
netsniff-ng-objs +=	bpf_comp.o

$ grep -r "lpcap" *
configure:	$CC -o $TMPDIR/pcaptest $TMPDIR/pcaptest.c -lpcap >> config.log 2>&1
mausezahn/Makefile:			-lpcap \
netsniff-ng/Makefile:netsniff-ng-libs +=	-lpcap

Thomas
Vadym Kochan March 28, 2019, 5:41 p.m. UTC | #6
On Thu, Mar 28, 2019 at 06:15:11PM +0100, Thomas Petazzoni wrote:
> On Mon, 4 Mar 2019 20:06:00 +0100
> Arnout Vandecappelle <arnout@mind.be> wrote:
> 
> > >  define NETSNIFF_NG_INSTALL_TARGET_CMDS
> > >  	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
> > > -		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install -C $(@D)
> > > +		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install \
> > > +			-C $(@D) $(NETSNIFF_NG_TOOLS)  
> > 
> >  I don't like very much that we have to enumerate the tools in the .mk file, but
> > I don't see any other possibility.
> 
> The Makefile has the following targets:
> 
> 	allbutmausezahn: $(filter-out mausezahn,$(TOOLS))
> 
> 	install_allbutmausezahn: $(foreach tool,$(filter-out mausezahn,$(TOOLS)),$(tool)_install)
> 
> So I think we can build/install everything except mausezahen fairly
> easily without duplicating the list of tools in netsniff-ng.mk.
> 

Good catch, I really missed this event that I contributed some quite a
lot of patches to netsniff-ng :))

But still separate config option for mz is OK ? If not, then I will
prepare patch for netsniff-ng configure to check for existence of missed
function for mz, but in that case libnet and libcli will be selected by
buildroot even if mz is not built.

Regards,
Vadim Kochan
Thomas Petazzoni March 28, 2019, 5:56 p.m. UTC | #7
Hello Vadim,

On Mon,  4 Mar 2019 10:57:41 +0200
Vadim Kochan <vadim4j@gmail.com> wrote:

> mausezahn can't be build with uclibc because uclibc
> does not provide ceill() function, so it does not allow
> to build all netsniff-ng's tools with uclibc.
> 
> Fix it by moving mausezahn under separate config option,
> which has own dependencies and packages selection (libnet & libcli).
> 
> Signed-off-by: Vadim Kochan <vadim4j@gmail.com>

Applied to master with a few changes.

> -config BR2_PACKAGE_NETSNIFF_NG
> +menuconfig BR2_PACKAGE_NETSNIFF_NG

Kept "config" here. We don't typically have a "menuconfig" for just one
sub-option.

> +NETSNIFF_NG_TOOLS = netsniff-ng trafgen astraceroute flowtop ifpps bpfc curvetun

I changed this to use the allbutmausezahn and install_allbutmausezahn targets.

Thanks!

Thomas
diff mbox series

Patch

diff --git a/package/netsniff-ng/Config.in b/package/netsniff-ng/Config.in
index c4803b2fa2..15862ff433 100644
--- a/package/netsniff-ng/Config.in
+++ b/package/netsniff-ng/Config.in
@@ -1,16 +1,12 @@ 
-config BR2_PACKAGE_NETSNIFF_NG
+menuconfig BR2_PACKAGE_NETSNIFF_NG
 	bool "netsniff-ng"
-	# Build with uClibc fails due to missing ceill()
-	depends on !BR2_TOOLCHAIN_USES_UCLIBC
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
 	select BR2_PACKAGE_LIBNL
 	select BR2_PACKAGE_LIBPCAP
-	select BR2_PACKAGE_LIBCLI
 	select BR2_PACKAGE_LIBNETFILTER_CONNTRACK
 	select BR2_PACKAGE_LIBURCU
-	select BR2_PACKAGE_LIBNET
 	help
 	  netsniff-ng is a free, performant Linux network analyzer and
 	  networking toolkit. If you will, the Swiss army knife for
@@ -18,7 +14,22 @@  config BR2_PACKAGE_NETSNIFF_NG
 
 	  http://netsniff-ng.org
 
-comment "netsniff-ng needs a glibc or musl toolchain w/ threads, headers >= 3.0"
+if BR2_PACKAGE_NETSNIFF_NG
+
+config BR2_PACKAGE_NETSNIFF_NG_MAUSEZAHN
+	bool "mausezahn"
+	default y
+	# Build with uClibc fails due to missing ceill()
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC
+	select BR2_PACKAGE_LIBCLI
+	select BR2_PACKAGE_LIBNET
+
+comment "mausezahn needs glibc or musl toolchain"
+	depends on BR2_TOOLCHAIN_USES_UCLIBC
+
+endif
+
+comment "netsniff-ng needs a toolchain w/ threads, headers >= 3.0"
 	depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
-	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAIN_USES_UCLIBC \
-		|| !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
+	depends on !BR2_TOOLCHAIN_HAS_THREADS  || \
+			!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
diff --git a/package/netsniff-ng/netsniff-ng.mk b/package/netsniff-ng/netsniff-ng.mk
index 77d8921425..9fe50f10d3 100644
--- a/package/netsniff-ng/netsniff-ng.mk
+++ b/package/netsniff-ng/netsniff-ng.mk
@@ -13,9 +13,14 @@  NETSNIFF_NG_LICENSE_FILES = README COPYING
 NETSNIFF_NG_CONF_ENV = \
 	NACL_INC_DIR=/dev/null \
 	NACL_LIB_DIR=/dev/null
-NETSNIFF_NG_DEPENDENCIES = \
-	libnl libpcap libcli libnetfilter_conntrack \
-	liburcu libnet
+NETSNIFF_NG_DEPENDENCIES = libnl libpcap libnetfilter_conntrack liburcu
+
+NETSNIFF_NG_TOOLS = netsniff-ng trafgen astraceroute flowtop ifpps bpfc curvetun
+
+ifeq ($(BR2_PACKAGE_NETSNIFF_NG_MAUSEZAHN),y)
+NETSNIFF_NG_DEPENDENCIES += libcli libnet
+NETSNIFF_NG_TOOLS += mausezahn
+endif
 
 ifeq ($(BR2_PACKAGE_GEOIP),y)
 NETSNIFF_NG_DEPENDENCIES += geoip
@@ -41,12 +46,13 @@  define NETSNIFF_NG_CONFIGURE_CMDS
 endef
 
 define NETSNIFF_NG_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) $(NETSNIFF_NG_TOOLS)
 endef
 
 define NETSNIFF_NG_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
-		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install -C $(@D)
+		PREFIX=$(TARGET_DIR)/usr ETCDIR=$(TARGET_DIR)/etc install \
+			-C $(@D) $(NETSNIFF_NG_TOOLS)
 endef
 
 $(eval $(generic-package))