Source: haproxy
Version: 2.9.9-1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: cross-satisfiability ftcbfs

haproxy cannot be cross built from source for multiple reasons. The
immediate issue is the python3-sphinx dependency. That package is
affected by the multiarch interpreter problem and hence must not be
annotated Multi-Arch: foreign. As a result, the dependency is
technically unsatisfiable. Whilst it can be used in
architecture-dependent ways, that's not the common case and we are
commonly annotating it :native. That's also applicable here as it is
used for manual page generation. If the manual page were not included in
an Arch:any package the preferred solution were to move it to
Build-Depends-Indep.

Then debian/rules does not pass any cross tools to make. While normally,
I'd recommend using dh_auto_build, the install target also uses CC and
dh_auto_install does not pass cross tools. So here, I recommend passing
them explicitly instead.

Last but not least, the upstream build system hard codes the build
architecture pkg-config in a few spots. It is recommended for Makefile
build systems to always refer to it via the PKG_CONFIG variable to allow
passing a different one for cross building.

All of these issues are fixed in the attached patch and it makes haproxy
cross buildable. Please consider applying it and forwarding the upstream
parts.

Helmut
diff --minimal -Nru haproxy-2.9.9/debian/changelog 
haproxy-2.9.9/debian/changelog
--- haproxy-2.9.9/debian/changelog      2024-06-14 21:50:59.000000000 +0200
+++ haproxy-2.9.9/debian/changelog      2024-08-23 22:38:41.000000000 +0200
@@ -1,3 +1,13 @@
+haproxy (2.9.9-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Require a sphinx for the build architecture.
+    + Pass CC and PKG_CONFIG to all make targets.
+    + cross.patch: Honour the passed ${PKG_CONFIG}.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Fri, 23 Aug 2024 22:38:41 +0200
+
 haproxy (2.9.9-1) unstable; urgency=medium
 
   * New upstream release.
diff --minimal -Nru haproxy-2.9.9/debian/control haproxy-2.9.9/debian/control
--- haproxy-2.9.9/debian/control        2024-06-14 21:50:59.000000000 +0200
+++ haproxy-2.9.9/debian/control        2024-08-23 22:38:41.000000000 +0200
@@ -12,7 +12,7 @@
                liblua5.3-dev,
                libsystemd-dev [linux-any],
                libjemalloc-dev,
-               python3-sphinx,
+               python3-sphinx:native,
                libopentracing-c-wrapper-dev,
                pkg-config,
                systemd-dev [linux-any]
diff --minimal -Nru haproxy-2.9.9/debian/patches/cross.patch 
haproxy-2.9.9/debian/patches/cross.patch
--- haproxy-2.9.9/debian/patches/cross.patch    1970-01-01 01:00:00.000000000 
+0100
+++ haproxy-2.9.9/debian/patches/cross.patch    2024-08-23 22:38:41.000000000 
+0200
@@ -0,0 +1,42 @@
+--- haproxy-2.9.9.orig/Makefile
++++ haproxy-2.9.9/Makefile
+@@ -169,6 +169,7 @@
+ #### Toolchain options.
+ CC = cc
+ LD = $(CC)
++PKG_CONFIG ?= pkg-config
+ 
+ #### Debug flags (typically "-g").
+ # Those flags only feed CFLAGS so it is not mandatory to use this form.
+--- haproxy-2.9.9.orig/addons/ot/Makefile
++++ haproxy-2.9.9/addons/ot/Makefile
+@@ -18,8 +18,8 @@
+ endif
+ 
+ ifeq ($(OT_INC),)
+-OT_PKGSTAT = $(shell pkg-config --exists $(OTC_WRAPPER)$(OT_DEBUG_EXT); echo 
$$?)
+-OT_CFLAGS = $(shell pkg-config --silence-errors --cflags 
$(OTC_WRAPPER)$(OT_DEBUG_EXT))
++OT_PKGSTAT = $(shell $(PKG_CONFIG) --exists $(OTC_WRAPPER)$(OT_DEBUG_EXT); 
echo $$?)
++OT_CFLAGS = $(shell $(PKG_CONFIG) --silence-errors --cflags 
$(OTC_WRAPPER)$(OT_DEBUG_EXT))
+ else
+ ifneq ($(wildcard $(OT_INC)/$(OTC_WRAPPER)/.*),)
+ OT_CFLAGS = -I$(OT_INC) $(if $(OT_DEBUG),-DOTC_DBG_MEM)
+@@ -37,7 +37,7 @@
+ endif
+ 
+ ifeq ($(OT_LIB),)
+-OT_LDFLAGS = $(shell pkg-config --silence-errors --libs 
$(OTC_WRAPPER)$(OT_DEBUG_EXT))
++OT_LDFLAGS = $(shell $(PKG_CONFIG) --silence-errors --libs 
$(OTC_WRAPPER)$(OT_DEBUG_EXT))
+ else
+ ifneq ($(wildcard $(OT_LIB)/lib$(OTC_WRAPPER).*),)
+ OT_LDFLAGS = -L$(OT_LIB) -l$(OTC_WRAPPER)$(OT_DEBUG_EXT)
+--- haproxy-2.9.9.orig/admin/wireshark-dissectors/peers/Makefile
++++ haproxy-2.9.9/admin/wireshark-dissectors/peers/Makefile
+@@ -1,5 +1,5 @@
+-CFLAGS  = `pkg-config --cflags wireshark` -g -fPIC $(OPTS)
+-LDFLAGS = `pkg-config --libs wireshark`
++CFLAGS  = `$(PKG_CONFIG) --cflags wireshark` -g -fPIC $(OPTS)
++LDFLAGS = `$(PKG_CONFIG) --libs wireshark`
+ 
+ NAME = packet-happp.so
+ OBJS = packet-happp.o
diff --minimal -Nru haproxy-2.9.9/debian/patches/series 
haproxy-2.9.9/debian/patches/series
--- haproxy-2.9.9/debian/patches/series 2024-06-14 21:50:59.000000000 +0200
+++ haproxy-2.9.9/debian/patches/series 2024-08-23 22:38:41.000000000 +0200
@@ -5,3 +5,4 @@
 
 # applied during the build process:
 # debianize-dconv.patch
+cross.patch
diff --minimal -Nru haproxy-2.9.9/debian/rules haproxy-2.9.9/debian/rules
--- haproxy-2.9.9/debian/rules  2024-06-14 21:50:59.000000000 +0200
+++ haproxy-2.9.9/debian/rules  2024-08-23 22:38:41.000000000 +0200
@@ -3,11 +3,14 @@
 include /usr/share/dpkg/pkg-info.mk
 include /usr/share/dpkg/architecture.mk
 include /usr/share/dpkg/buildflags.mk
+include /usr/share/dpkg/buildtools.mk
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
 MAKEARGS=V=1 \
+        CC='$(CC)' \
+        PKG_CONFIG='$(PKG_CONFIG)' \
         DESTDIR=debian/haproxy \
         PREFIX=/usr \
         IGNOREGIT=true \

Reply via email to