Source: foot
Version: 1.15.3-1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

foot fails to cross build from source, because it builds for the build
architecture. Looking closer, the reason is that it doesn't use
dh_auto_configure. It cannot, because it does a pgo build. pgo means
running a first build and using the profile to optimize a second build,
but that "run" part is what we totally cannot do at all for cross
builds. So this becomes pgo vs cross.

I propose supporting the value "nopgo" in DEB_BUILD_OPTIONS. This is not
passed by buildds and therefore regular builds of foot will continue to
be pgo. When cross building or adding nopgo to DEB_BUILD_OPTIONS, the
build will degrade to a normal non-pgo build.

Note that foot also is unreproducible according to
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/diffoscope-results/foot.html
and I strongly suspect that adding nopgo would make it reproducible.

I am not asking to disable pgo by default.

Helmut
diff --minimal -Nru foot-1.15.3/debian/changelog foot-1.15.3/debian/changelog
--- foot-1.15.3/debian/changelog        2023-08-15 09:34:04.000000000 +0200
+++ foot-1.15.3/debian/changelog        2023-09-11 08:53:12.000000000 +0200
@@ -1,3 +1,11 @@
+foot (1.15.3-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Support DEB_BUILD_OPTIONS=nopgo and enable it for cross.
+    (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 11 Sep 2023 08:53:12 +0200
+
 foot (1.15.3-1) unstable; urgency=medium
 
   * New upstream release
diff --minimal -Nru foot-1.15.3/debian/rules foot-1.15.3/debian/rules
--- foot-1.15.3/debian/rules    2023-08-15 09:34:04.000000000 +0200
+++ foot-1.15.3/debian/rules    2023-09-11 08:53:10.000000000 +0200
@@ -3,17 +3,29 @@
 # optimize=-lto because the pgo script handles lto by itself
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto
 
-# According to upstream's INSTALL.md, -O2 with PGO can create issues
-export DEB_CFLAGS_MAINT_STRIP = -O2
-
 %:
        dh $@ --builddir=build
 
+ifneq (,$(filter nopgo,$(DEB_BUILD_OPTIONS)))
+DISABLE_PGO=1
+endif
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+DISABLE_PGO=1
+endif
+
+ifneq (1,$(DISABLE_PGO))
+# According to upstream's INSTALL.md, -O2 with PGO can create issues
+export DEB_CFLAGS_MAINT_STRIP = -O2
+
 # meson setup is run by ./pgo/pgo.sh
 override_dh_auto_configure:
 
 override_dh_auto_build:
        ./pgo/pgo.sh partial . build --prefix=/usr --wrap-mode=nodownload
+else:
+override_dh_auto_configure:
+       dh_auto_configure -- --wrap-mode=nodownload
+endif
 
 execute_after_dh_auto_install:
        rm debian/tmp/usr/share/doc/foot/LICENSE

Reply via email to