[openwrt/openwrt] xdp-tools: fix build with NLS enabled

LEDE Commits lede-commits at lists.infradead.org
Wed Jul 6 14:39:14 PDT 2022


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/d29722e6ff764d78428c54a5618b7a0e191245f1

commit d29722e6ff764d78428c54a5618b7a0e191245f1
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Wed Jul 6 22:20:25 2022 +0100

    xdp-tools: fix build with NLS enabled
    
    Make sure the 'configure' shell script finds the libintl when linking
    the test programs for discovering libpcap and libbpf.
    
    Reported-by: @trippleflux
    Fixes: 6ad1bea2a603 ("xdp-tools: add package")
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 package/network/utils/xdp-tools/Makefile           |  3 +++
 .../patches/010-configure-respect-LDFLAGS.patch    | 29 ++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/package/network/utils/xdp-tools/Makefile b/package/network/utils/xdp-tools/Makefile
index f0af555919..7d831d0fec 100644
--- a/package/network/utils/xdp-tools/Makefile
+++ b/package/network/utils/xdp-tools/Makefile
@@ -16,6 +16,7 @@ PKG_FLAGS:=nonshared
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/bpf.mk
+include $(INCLUDE_DIR)/nls.mk
 
 PKG_BUILD_PARALLEL:=1
 PKG_INSTALL:=1
@@ -76,6 +77,8 @@ define Package/xdpdump/description
 xdpdump - a simple tcpdump like tool for capturing packets at the XDP layer
 endef
 
+TARGET_LDFLAGS += $(INTL_LDFLAGS)
+
 CONFIGURE_VARS += \
 	FORCE_SYSTEM_LIBBPF=1 \
 	CC="$(TARGET_CC)" \
diff --git a/package/network/utils/xdp-tools/patches/010-configure-respect-LDFLAGS.patch b/package/network/utils/xdp-tools/patches/010-configure-respect-LDFLAGS.patch
new file mode 100644
index 0000000000..b3454548f8
--- /dev/null
+++ b/package/network/utils/xdp-tools/patches/010-configure-respect-LDFLAGS.patch
@@ -0,0 +1,29 @@
+--- a/configure
++++ b/configure
+@@ -138,7 +138,7 @@ int main(int argc, char **argv) {
+     return 0;
+ }
+ EOF
+-    libpcap_err=$($CC -o $TMPDIR/libpcaptest $TMPDIR/libpcaptest.c  $LIBPCAP_CFLAGS $LIBPCAP_LDLIBS 2>&1)
++    libpcap_err=$($CC -o $TMPDIR/libpcaptest $TMPDIR/libpcaptest.c  $LIBPCAP_CFLAGS $LIBPCAP_LDLIBS $LDFLAGS 2>&1)
+     if [ "$?" -eq "0" ]; then
+         echo "HAVE_PCAP:=y" >>$CONFIG
+         [ -n "$LIBPCAP_CFLAGS" ] && echo 'CFLAGS += ' $LIBPCAP_CFLAGS >> $CONFIG
+@@ -186,7 +186,7 @@ int main(int argc, char **argv) {
+     return 0;
+ }
+ EOF
+-    libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS 2>&1)
++    libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS $LDFLAGS 2>&1)
+     if [ "$?" -eq "0" ]; then
+         echo "HAVE_FEATURES+=${config_var}" >>"$CONFIG"
+         echo "yes"
+@@ -253,7 +253,7 @@ int main(int argc, char **argv) {
+ }
+ EOF
+ 
+-        libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS 2>&1)
++        libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS $LDFLAGS 2>&1)
+         if [ "$?" -eq "0" ]; then
+             echo "SYSTEM_LIBBPF:=y" >>$CONFIG
+             echo "LIBBPF_VERSION=$LIBBPF_VERSION" >>$CONFIG




More information about the lede-commits mailing list