Source: net-snmp
Version: 5.9.3+dfsg-1
Tags: patch
User: [email protected]
Usertags: ftcbfs

This essentially is a follow-up on #944953. Thanks for integrating my
earlier changes from that bug. Last time, I didn't figure how to make
the perl extension build work. Now, I'm attaching a patch to fix that.
It also fixes a number of other issues relating to architecture
variables in debian/rules. This patch actually makes net-snmp cross
buildable. Please consider applying it.

Helmut
diff --minimal -Nru net-snmp-5.9.3+dfsg/debian/changelog 
net-snmp-5.9.3+dfsg/debian/changelog
--- net-snmp-5.9.3+dfsg/debian/changelog        2022-07-18 13:28:38.000000000 
+0200
+++ net-snmp-5.9.3+dfsg/debian/changelog        2022-12-10 15:39:34.000000000 
+0100
@@ -1,3 +1,15 @@
+net-snmp (5.9.3+dfsg-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Initialize architecture variables.
+    + Fix build vs host confusion.
+    + Use the host architecture pkg-config.
+    + export a PERL5LIB for cross building.
+    + cross.patch: Pass PERL5LIB along.
+
+ -- Helmut Grohne <[email protected]>  Sat, 10 Dec 2022 15:39:34 +0100
+
 net-snmp (5.9.3+dfsg-1) unstable; urgency=medium
 
   * New upstream source
diff --minimal -Nru net-snmp-5.9.3+dfsg/debian/patches/cross.patch 
net-snmp-5.9.3+dfsg/debian/patches/cross.patch
--- net-snmp-5.9.3+dfsg/debian/patches/cross.patch      2022-07-18 
13:28:38.000000000 +0200
+++ net-snmp-5.9.3+dfsg/debian/patches/cross.patch      2022-12-10 
15:39:34.000000000 +0100
@@ -34,3 +34,14 @@
  AC_SUBST(MYSQL_LIBS)
  AC_SUBST(MYSQL_INCLUDES)
  
+--- net-snmp-5.9.3+dfsg.orig/Makefile.in
++++ net-snmp-5.9.3+dfsg/Makefile.in
+@@ -186,7 +186,7 @@
+       if false; then                                                  \
+           carp=-MCarp::Always;                                        \
+       fi &&                                                           \
+-      export PERL5LIB="$$dir/perl" &&                                 \
++      export PERL5LIB="$$dir/perl$${PERL5LIB:+:$$PERL5LIB}" &&        \
+       $(PERL) $$carp Makefile.PL -NET-SNMP-IN-SOURCE=true             \
+           -NET-SNMP-CONFIG="sh $$dir/net-snmp-config" $(PERLARGS)
+ 
diff --minimal -Nru net-snmp-5.9.3+dfsg/debian/rules 
net-snmp-5.9.3+dfsg/debian/rules
--- net-snmp-5.9.3+dfsg/debian/rules    2022-07-18 13:28:38.000000000 +0200
+++ net-snmp-5.9.3+dfsg/debian/rules    2022-12-10 15:39:33.000000000 +0100
@@ -2,7 +2,8 @@
 #export DH_VERBOSE=1
 
 export DEB_BUILD_MAINT_OPTIONS := hardening=+all
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/buildtools.mk
 
 LIB_VERSION = 40
 
@@ -11,22 +12,26 @@
 
 
MIBS_DIR="/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf"
 
-ifeq (linux,$(DEB_BUILD_ARCH_OS))
+ifeq (linux,$(DEB_HOST_ARCH_OS))
 MIB_MODULES += ucd-snmp/diskio ucd-snmp/lmsensorsMib 
etherlike-mib/dot3StatsTable
 DEB_DH_GENCONTROL_ARGS=-- -Vos-specific-dev="libsensors4-dev"
 else
-ifeq (kfreebsd,$(DEB_BUILD_ARCH_OS))
+ifeq (kfreebsd,$(DEB_HOST_ARCH_OS))
 DEB_DH_GENCONTROL_ARGS=-- -Vos-specific-dev="libkvm-dev"
-CFLAGS += $(shell pkg-config --cflags libbsd-overlay)
-LDFLAGS += $(shell pkg-config --libs libbsd-overlay)
+CFLAGS += $(shell $(PKG_CONFIG) --cflags libbsd-overlay)
+LDFLAGS += $(shell $(PKG_CONFIG) --libs libbsd-overlay)
 endif
 endif
-ifeq (hurd,$(DEB_BUILD_ARCH_OS))
+ifeq (hurd,$(DEB_HOST_ARCH_OS))
 EXCL_MIB_MODULES += mibII
 else
 MIB_MODULES += host
 endif
 
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+export PERL5LIB=/usr/lib/$(DEB_HOST_MULTIARCH)/perl/cross-config-$(shell perl 
-MConfig -e 'print $$Config{version}')
+endif
+
 %:
        dh $@
 

Reply via email to