Source: iptables-netflow
Version: 2.6-3
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

iptables-netflow fails to cross build from source, because it generally
hard codes build architecture build tools and thus fails locating
xtables.pc using the build architecture pkg-config. Moving it to host
tools is not entirely trivial. I'm attaching a patch for your
convenience.

Helmut
diff --minimal -Nru iptables-netflow-2.6/debian/changelog 
iptables-netflow-2.6/debian/changelog
--- iptables-netflow-2.6/debian/changelog       2022-02-14 09:21:27.000000000 
+0100
+++ iptables-netflow-2.6/debian/changelog       2022-11-25 11:26:30.000000000 
+0100
@@ -1,3 +1,10 @@
+iptables-netflow (2.6-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Use host tools. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Fri, 25 Nov 2022 11:26:30 +0100
+
 iptables-netflow (2.6-3) unstable; urgency=high
 
   * Cherry-pick upstream commit 6a55739a to fix build with kernel 5.15 and
diff --minimal -Nru iptables-netflow-2.6/debian/patches/cross.patch 
iptables-netflow-2.6/debian/patches/cross.patch
--- iptables-netflow-2.6/debian/patches/cross.patch     1970-01-01 
01:00:00.000000000 +0100
+++ iptables-netflow-2.6/debian/patches/cross.patch     2022-11-25 
11:26:29.000000000 +0100
@@ -0,0 +1,62 @@
+--- iptables-netflow-2.6.orig/configure
++++ iptables-netflow-2.6/configure
+@@ -123,10 +123,15 @@
+ 
+ check_pkg_config() {
+   test "$PKGWARN" && return 1
+-  if ! which pkg-config >/dev/null 2>&1; then
+-    echo "! You don't have pkg-config, it may be useful to install it."
+-    PKGWARN=1
+-    return 1
++  if test -z "$PKG_CONFIG"; then
++    if ! which pkg-config >/dev/null 2>&1; then
++      echo "! You don't have pkg-config, it may be useful to install it."
++      PKG_CONFIG=false
++      PKGWARN=1
++      return 1
++    else
++      PKG_CONFIG=pkg-config
++    fi
+   fi
+   return 0
+ }
+@@ -143,10 +148,10 @@
+       echo "no iptables binary found"
+     fi
+     check_pkg_config
+-    PKGVER=`pkg-config --modversion xtables 2>/dev/null`
++    PKGVER=`$PKG_CONFIG --modversion xtables 2>/dev/null`
+     if [ "$PKGVER" ]; then
+       IPTVER="$PKGVER"
+-      echo "Xtables version: $IPTVER (detected from `which pkg-config`)"
++      echo "Xtables version: $IPTVER (detected from $PKG_CONFIG)"
+       return
+     fi
+     error "Can not find iptables version, try setting it with --ipt-ver="
+@@ -212,10 +217,10 @@
+ iptables_try_pkgconfig() {
+   if [ ! "$PKGVER" ]; then
+     check_pkg_config
+-    PKGVER=`pkg-config --modversion xtables 2>/dev/null`
+-    TRYPKGVER=`pkg-config --modversion xtables 2>/dev/null`
++    PKGVER=`$PKG_CONFIG --modversion xtables 2>/dev/null`
++    TRYPKGVER=`$PKG_CONFIG --modversion xtables 2>/dev/null`
+     echo -n "pkg-config for version $IPTVER exists: "
+-    pkg-config --exact-version=$IPTVER xtables 2>/dev/null
++    $PKG_CONFIG --exact-version=$IPTVER xtables 2>/dev/null
+     if [ $? = 0 ]; then
+       echo "Yes"
+       PKGVER=$TRYPKGVER
+@@ -230,9 +235,9 @@
+   fi
+   if [ "$PKGVER" ]; then
+     check_pkg_config
+-    PKGVER=`pkg-config --modversion xtables 2>/dev/null`
+-    PKGINC=`pkg-config --cflags xtables`
+-    PKGLIB=`pkg-config --variable=xtlibdir xtables`
++    PKGVER=`$PKG_CONFIG --modversion xtables 2>/dev/null`
++    PKGINC=`$PKG_CONFIG --cflags xtables`
++    PKGLIB=`$PKG_CONFIG --variable=xtlibdir xtables`
+   elif expr "$IPTVER" : '^1\.3' >/dev/null; then
+     echo "! This version of iptables ($IPTVER) will be treated as old 
version."
+     # Newer versions of iptables should not have -I/kernel/include!
diff --minimal -Nru iptables-netflow-2.6/debian/patches/series 
iptables-netflow-2.6/debian/patches/series
--- iptables-netflow-2.6/debian/patches/series  2022-02-14 08:52:59.000000000 
+0100
+++ iptables-netflow-2.6/debian/patches/series  2022-11-25 11:23:09.000000000 
+0100
@@ -4,3 +4,4 @@
 dont-hardcode-current-gcc.patch
 cherry-pick_66e43041_namespace_sk_error_report.patch
 cherry-pick_6a55739a_fix_build_on_v5.15.patch
+cross.patch
diff --minimal -Nru iptables-netflow-2.6/debian/rules 
iptables-netflow-2.6/debian/rules
--- iptables-netflow-2.6/debian/rules   2021-08-24 23:01:47.000000000 +0200
+++ iptables-netflow-2.6/debian/rules   2022-11-25 11:26:30.000000000 +0100
@@ -1,17 +1,19 @@
 #!/usr/bin/make -f
 #export DH_VERBOSE = 1
 
+include /usr/share/dpkg/architecture.mk
+DPKG_EXPORT_BUILDTOOLS=1
+include /usr/share/dpkg/buildtools.mk
 include /usr/share/dpkg/pkg-info.mk
 export DEB_VERSION_UPSTREAM
 
 # see FEATURE AREAS in dpkg-buildflags(1)
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
-ARCH=$(shell dpkg-architecture -q DEB_HOST_MULTIARCH)
 DKMS_CONFIGURE_OPTIONS=\
  --prefix=/usr \
  --includedir=/usr/include \
- --libdir=/usr/lib/$(ARCH) \
+ --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
  --ipt-bin=/usr/sbin/iptables-legacy \
  --enable-natevents    \
  --enable-snmp-rules   \

Reply via email to