buildroot/package/dhcpdump/dhcpdump.mk
Thomas Petazzoni 136c8862cf package/dhcpdump: fix build at -O2
Since commit aa556e2035
("utils/genrandconfig: test with BR2_OPTIMIZE_2=y"), we are doing
builds at -O2 instead of -Os. This has unveiled an issue in the
strsep.c file:

strsep.c:65:23: error: register name not specified for 'delim'
  register const char *delim;

This strsep.c compatibility code is compiled in if HAVE_STRSEP is not
defined, but dhcpdump does not use any kind of configure script to
detect the availability of strsep(). Therefore by default, it gets
compiled in, and the "register" specifier used for some variable
declarations in strsep.c cause build issues at -O2.

A previous commit in Buildroot from
c2a7f0d605 ("dhcpdump: Fix strsep()
feature test"), attempted to fix this problem by changing the test on
HAVE_STRSEP by a test on _BSD_SOURCE.

Unfortunately, _BSD_SOURCE is not meant to be tested: it's a feature
macro that is meant to be *defined* by some code to tell the C library
headers to expose (or not) some given functionality.

So instead, we basically revert commit
c2a7f0d605 by dropping the patch, and
pass -DHAVE_STRSEP in the CFLAGS when building dhcpdump.

Fixes:

  http://autobuild.buildroot.net/results/7231170d3d3e3637f02382c1a0a96009b0527618/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-12-28 11:51:36 +01:00

31 lines
864 B
Makefile

################################################################################
#
# dhcpdump
#
################################################################################
DHCPDUMP_VERSION = 1.8
DHCPDUMP_SITE = http://www.mavetju.org/download
DHCPDUMP_DEPENDENCIES = libpcap
DHCPDUMP_LICENSE = BSD-2-Clause
DHCPDUMP_LICENSE_FILES = LICENSE
DHCPDUMP_LIBS = -lpcap
ifeq ($(BR2_STATIC_LIBS),y)
DHCPDUMP_LIBS += `$(STAGING_DIR)/usr/bin/pcap-config --static --additional-libs`
endif
# glibc, uclibc and musl have strsep()
DHCPDUMP_CFLAGS = $(TARGET_CFLAGS) -DHAVE_STRSEP
define DHCPDUMP_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC="$(TARGET_CC) $(DHCPDUMP_CFLAGS) \
-D_GNU_SOURCE" LIBS="$(DHCPDUMP_LIBS)"
endef
define DHCPDUMP_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 -D $(@D)/dhcpdump $(TARGET_DIR)/usr/bin/dhcpdump
endef
$(eval $(generic-package))