On Debian and when building a Debian package, the build system first
builds the clean target, and gnustep-gui fails when cross building
because it runs configure without proper cross-compilation arguments.
You can see the build log(s) here (those in green are with the
attached patch applied).

https://crossqa.debian.net/src/gnustep-gui

The patch is similar in spirit to what was done in Base 11 years ago
(commit 918fbdd).  That change was made for different reasons but
because of it gnustep-base never had cross-compilation problems since
we added this feature in the last Debian release.
>From f5f3a6427cdd44113ae319278a249e25bab72e65 Mon Sep 17 00:00:00 2001
From: Yavor Doganov <[email protected]>
Date: Tue, 13 Oct 2026 21:03:45 +0300
Subject: [PATCH] Fix cross-compilation

---
 GNUmakefile           |  5 +++++
 GNUmakefile.postamble | 23 +++++++++++++++++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 97e456771..3d8ae0c44 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -45,12 +45,16 @@ include $(GNUSTEP_MAKEFILES)/common.make
 
 include ./Version
 
+# Helper variable to check if the generated makefiles are present.
+_have_makefiles := $(shell test -f config.make -o -f gui.make && echo yes)
+
 # Don't build docs by default
 doc=no
 
 #
 # The list of subproject directories
 #
+ifeq ($(_have_makefiles),yes)
 SUBPROJECTS = \
 Source \
 Images \
@@ -73,6 +77,7 @@ SUBPROJECTS += $(BUILD_SOUNDS)
 ifeq ($(doc), yes)
 SUBPROJECTS += Documentation
 endif
+endif
 
 -include GNUmakefile.preamble
 
diff --git a/GNUmakefile.postamble b/GNUmakefile.postamble
index b39f1fe1b..d7758f339 100644
--- a/GNUmakefile.postamble
+++ b/GNUmakefile.postamble
@@ -1,4 +1,4 @@
-# -*-makefile-*-
+# -*-makefile-gmake-*-
 #  GNUmakefile.postamble
 #
 #  Project specific makefile rules
@@ -31,7 +31,19 @@
 #
 
 # Things to do before compiling
-# before-all::
+# Automatically run ./configure if needed to generate the makefiles
+# which we need in order to do our job.  If you need any special
+# argument to ./configure, you can't rely on this rule, and you must
+# always run ./configure manually.
+before-all:: config.make gui.make
+ifeq ($(_have_makefiles),)
+       ./configure
+# The prerequisites have been generated but there are no SUBPROJECTS
+# defined because _have_makefiles has been defined to the empty string
+# when make was invoked initially.  Force make to reread the makefiles
+# in order to continue with the compilation.
+       $(MAKE)
+endif
 
 # Things to do after compiling
 # after-all::
@@ -77,6 +89,9 @@ before-install:: $(DESTDIR)$(GNUSTEP_MAKEFILES)/Additional
 after-distclean::
        rm -f config.status config.log config.cache TAGS config.make gui.make
 
+# If the generated makefiles are present but their prerequisites have
+# changed, let config.status regenerate them.
+ifeq ($(_have_makefiles),yes)
 gui.make: gui.make.in Version configure
        if [ -x config.status ]; then \
          ./config.status --recheck && ./config.status; \
@@ -90,6 +105,10 @@ config.make: config.make.in configure
        else \
          ./configure; \
        fi
+else
+# The makefiles are missing and will be generated by config.status.
+config.make gui.make: ;
+endif
 
 # Things to do before checking
 # before-check::
-- 
2.55.0

Reply via email to