Source: snort
Version: 2.9.15.1-4
Tags: patch
User: [email protected]
Usertags: ftcbfs

snort fails to cross build from source, because it does not pass --host
to configure. It actually does pass --build with a value that is wrong
most of the time. Once fixing this, configure fails in a number of cases
due to use of AC_RUN_IFELSE. This macro does not work during cross
compilation. In all relevant cases, it could be replaced with
cross compilation compatible alternatives. Please consider applying the
attached patch to make snort cross buildable.

Helmut
diff --minimal -Nru snort-2.9.15.1/debian/changelog 
snort-2.9.15.1/debian/changelog
--- snort-2.9.15.1/debian/changelog     2020-12-06 17:23:14.000000000 +0100
+++ snort-2.9.15.1/debian/changelog     2020-12-14 17:47:56.000000000 +0100
@@ -1,3 +1,13 @@
+snort (2.9.15.1-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Pass reasonable --build and --host to configure.
+    + cross.patch: Replace a number of AC_RUN_IFELSE with cross-compatible
+      variants.
+
+ -- Helmut Grohne <[email protected]>  Mon, 14 Dec 2020 17:47:56 +0100
+
 snort (2.9.15.1-4) unstable; urgency=high
 
   * debian/snort.docs, debian/snort-doc.docs debian/rules: Add README.csv and
diff --minimal -Nru snort-2.9.15.1/debian/patches/cross.patch 
snort-2.9.15.1/debian/patches/cross.patch
--- snort-2.9.15.1/debian/patches/cross.patch   1970-01-01 01:00:00.000000000 
+0100
+++ snort-2.9.15.1/debian/patches/cross.patch   2020-12-14 17:47:56.000000000 
+0100
@@ -0,0 +1,136 @@
+--- snort-2.9.15.1.orig/configure.in
++++ snort-2.9.15.1/configure.in
+@@ -283,21 +283,11 @@
+ 
+ # In case INADDR_NONE is not defined (like on Solaris)
+ have_inaddr_none="no"
+-AC_MSG_CHECKING([for INADDR_NONE])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
++AC_CHECK_DECL([INADDR_NONE],[have_inaddr_none="yes"],[have_inaddr_none="no"],[
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+-]],
+-[[
+-      if (inet_addr("10,5,2") == INADDR_NONE);
+-    return 0;
+-]])],
+-[have_inaddr_none="yes"],
+-[have_inaddr_none="no"])
+-AC_MSG_RESULT($have_inaddr_none)
++])
+ if test "x$have_inaddr_none" = "xno"; then
+       AC_DEFINE([INADDR_NONE],[-1],[For INADDR_NONE definition])
+ fi
+@@ -428,18 +418,7 @@
+   fi
+ fi
+ 
+-AC_MSG_CHECKING([for pcap_lex_destroy])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <pcap.h>
+-]],
+-[[
+-   pcap_lex_destroy();
+-]])],
+-[have_pcap_lex_destroy="yes"],
+-[have_pcap_lex_destroy="no"])
+-AC_MSG_RESULT($have_pcap_lex_destroy)
++AC_CHECK_FUNC([pcap_lex_destroy],[have_pcap_lex_destroy="yes"],[have_pcap_lex_destroy="no"])
+ if test "x$have_pcap_lex_destroy" = "xyes"; then
+     AC_DEFINE([HAVE_PCAP_LEX_DESTROY],[1],[Can cleanup lex buffer stack 
created by pcap bpf filter])
+ fi
+@@ -717,7 +696,7 @@
+ AC_CHECK_FUNCS([daq_hup_apply] [daq_acquire_with_meta] [daq_dp_add_dc])
+ 
+ AC_MSG_CHECKING([for daq real addresses])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
+@@ -771,7 +750,7 @@
+ fi
+ 
+ AC_MSG_CHECKING([for daq address space ID])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
+@@ -789,7 +768,7 @@
+ fi
+ 
+ AC_MSG_CHECKING([for daq flow ID])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
+@@ -807,7 +786,7 @@
+ fi
+ 
+ AC_MSG_CHECKING([for daq extended flow modifiers])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
+@@ -828,7 +807,7 @@
+ fi
+ 
+ AC_MSG_CHECKING([for daq query flow])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
+@@ -849,7 +828,7 @@
+ fi
+ 
+ AC_MSG_CHECKING([for daq data channel flags])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
+@@ -867,7 +846,7 @@
+ fi
+ 
+ AC_MSG_CHECKING([for separate IP versions on pinhole endpoints])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
+@@ -886,7 +865,7 @@
+ fi
+ 
+ AC_MSG_CHECKING([for DAQ_VERDICT_RETRY])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
+@@ -904,7 +883,7 @@
+ fi
+ 
+ AC_MSG_CHECKING([for daq packet trace])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
+@@ -924,7 +903,7 @@
+ fi
+ 
+ AC_MSG_CHECKING([for daq verdict reason])
+-AC_RUN_IFELSE(
++AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <daq.h>
diff --minimal -Nru snort-2.9.15.1/debian/patches/series 
snort-2.9.15.1/debian/patches/series
--- snort-2.9.15.1/debian/patches/series        2020-12-06 17:23:14.000000000 
+0100
+++ snort-2.9.15.1/debian/patches/series        2020-12-14 17:47:56.000000000 
+0100
@@ -12,3 +12,4 @@
 config_disabled_rules
 documentation_debian
 fix_compile_errors
+cross.patch
diff --minimal -Nru snort-2.9.15.1/debian/rules snort-2.9.15.1/debian/rules
--- snort-2.9.15.1/debian/rules 2020-12-06 17:23:14.000000000 +0100
+++ snort-2.9.15.1/debian/rules 2020-12-14 17:47:54.000000000 +0100
@@ -15,6 +15,8 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+include /usr/share/dpkg/architecture.mk
+
 # Enable all hardening features as Snort is a network "listener" of sorts
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 export CONFFLAGS= \
@@ -55,7 +57,7 @@
 override_dh_auto_configure:
 # Cannot use this as libdir is defined twice
 #      dh_auto_configure -- $(CONFFLAGS)
-       ./configure --build=i686-linux-gnu --prefix=/usr 
--includedir=\$$\{prefix\}/include --mandir=\$$\{prefix\}/share/man 
--infodir=\$$\{prefix\}/share/info --sysconfdir=/etc --localstatedir=/var 
--disable-silent-rules --runstatedir=/run --disable-maintainer-mode 
--disable-dependency-tracking --disable-perfprofiling $(CONFFLAGS) 
+       ./configure --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) 
--prefix=/usr --includedir=\$$\{prefix\}/include 
--mandir=\$$\{prefix\}/share/man --infodir=\$$\{prefix\}/share/info 
--sysconfdir=/etc --localstatedir=/var --disable-silent-rules 
--runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking 
--disable-perfprofiling $(CONFFLAGS) 
 
 
 override_dh_clean:

Reply via email to