Bug#1079531: ezquake FTCBFS: hard codes the build architecture pkg-config

Helmut Grohne helmut at subdivi.de
Sat Aug 24 12:16:04 BST 2024


Source: ezquake
Version: 3.6.4-3
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs

ezquake fails to cross build from source, because the upstream Makefile
hard codes the build architecture pkg-config and thus fails to locate a
number of .pc files that are only requested for the host architecture by
Build-Depends. The recommended way is using the variable PKG_CONFIG and
thus allowing the substitution of a host-specific tool. Beyond this, the
Makefile also investigates uname and thereby misdetects CPU and SYS in a
cross build environment. I'm attaching a patch fixing both aspects.

Helmut
-------------- next part --------------
diff --minimal -Nru ezquake-3.6.4/debian/changelog ezquake-3.6.4/debian/changelog
--- ezquake-3.6.4/debian/changelog	2024-01-15 05:26:53.000000000 +0100
+++ ezquake-3.6.4/debian/changelog	2024-08-24 11:54:08.000000000 +0200
@@ -1,3 +1,12 @@
+ezquake (3.6.4-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + cross.patch: Honour ${PKG_CONFIG}.
+    + Also pass CPU and SYS to make when cross building.
+
+ -- Helmut Grohne <helmut at subdivi.de>  Sat, 24 Aug 2024 11:54:08 +0200
+
 ezquake (3.6.4-3) unstable; urgency=medium
 
   * Fix 32-bit pointer conversion warning.
diff --minimal -Nru ezquake-3.6.4/debian/patches/cross.patch ezquake-3.6.4/debian/patches/cross.patch
--- ezquake-3.6.4/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ ezquake-3.6.4/debian/patches/cross.patch	2024-08-24 11:54:06.000000000 +0200
@@ -0,0 +1,103 @@
+--- ezquake-3.6.4.orig/Makefile
++++ ezquake-3.6.4/Makefile
+@@ -27,6 +27,7 @@
+ 
+ LSYS := $(shell echo $(SYS) | tr A-Z a-z)
+ CC ?= gcc
++PKG_CONFIG ?= pkg-config
+ WINDRES ?= windres
+ STRIP ?= strip
+ RM ?= rm -f
+@@ -115,51 +116,51 @@
+ CFLAGS_c += $(ZLIB_CFLAGS)
+ LIBS_c += $(ZLIB_LIBS)
+ 
+-PCRE2_CFLAGS ?= $(shell pkg-config libpcre2-8 --cflags)
+-PCRE2_LIBS ?= $(shell pkg-config libpcre2-8 --libs)
++PCRE2_CFLAGS ?= $(shell $(PKG_CONFIG) libpcre2-8 --cflags)
++PCRE2_LIBS ?= $(shell $(PKG_CONFIG) libpcre2-8 --libs)
+ CFLAGS_c += $(PCRE2_CFLAGS) -DPCRE2_CODE_UNIT_WIDTH=8
+ LIBS_c += $(PCRE2_LIBS)
+ 
+-EXPAT_CFLAGS ?= $(shell pkg-config expat --cflags)
+-EXPAT_LIBS ?= $(shell pkg-config expat --libs)
++EXPAT_CFLAGS ?= $(shell $(PKG_CONFIG) expat --cflags)
++EXPAT_LIBS ?= $(shell $(PKG_CONFIG) expat --libs)
+ CFLAGS_c += $(EXPAT_CFLAGS)
+ LIBS_c += $(EXPAT_LIBS)
+ 
+-PNG_CFLAGS ?= $(shell pkg-config libpng --cflags) -DWITH_PNG
+-PNG_LIBS ?= $(shell pkg-config libpng --libs)
++PNG_CFLAGS ?= $(shell $(PKG_CONFIG) libpng --cflags) -DWITH_PNG
++PNG_LIBS ?= $(shell $(PKG_CONFIG) libpng --libs)
+ CFLAGS_c += $(PNG_CFLAGS)
+ LIBS_c += $(PNG_LIBS)
+ 
+-JPEG_CFLAGS ?= $(shell pkg-config libjpeg --cflags) -DWITH_JPEG
+-JPEG_LIBS ?= $(shell pkg-config libjpeg --libs)
++JPEG_CFLAGS ?= $(shell $(PKG_CONFIG) libjpeg --cflags) -DWITH_JPEG
++JPEG_LIBS ?= $(shell $(PKG_CONFIG) libjpeg --libs)
+ CFLAGS_c += $(JPEG_CFLAGS)
+ LIBS_c += $(JPEG_LIBS)
+ 
+-CURL_CFLAGS ?= $(shell pkg-config libcurl --cflags)
+-CURL_LIBS ?= $(shell pkg-config libcurl --libs)
++CURL_CFLAGS ?= $(shell $(PKG_CONFIG) libcurl --cflags)
++CURL_LIBS ?= $(shell $(PKG_CONFIG) libcurl --libs)
+ CFLAGS_c += $(CURL_CFLAGS)
+ LIBS_c += $(CURL_LIBS)
+ 
+-JANSSON_CFLAGS ?= $(shell pkg-config jansson --cflags)
+-JANSSON_LIBS ?= $(shell pkg-config jansson --libs)
++JANSSON_CFLAGS ?= $(shell $(PKG_CONFIG) jansson --cflags)
++JANSSON_LIBS ?= $(shell $(PKG_CONFIG) jansson --libs)
+ CFLAGS += $(JANSSON_CFLAGS)
+ LIBS_c += $(JANSSON_LIBS)
+ 
+-MINIZIP_CFLAGS ?= $(shell pkg-config --cflags minizip)
+-MINIZIP_LIBS ?= $(shell pkg-config --libs minizip)
++MINIZIP_CFLAGS ?= $(shell $(PKG_CONFIG) --cflags minizip)
++MINIZIP_LIBS ?= $(shell $(PKG_CONFIG) --libs minizip)
+ CFLAGS_c += $(MINIZIP_CFLAGS)
+ LIBS_c += $(MINIZIP_LIBS)
+ 
+-SPEEX_LIBS ?= $(shell pkg-config speex --libs) $(shell pkg-config speexdsp --libs)
++SPEEX_LIBS ?= $(shell $(PKG_CONFIG) speex --libs) $(shell $(PKG_CONFIG) speexdsp --libs)
+ ifdef SPEEX_LIBS
+-    CFLAGS_c += $(shell pkg-config speex --cflags) $(shell pkg-config speexdsp --cflags) -DWITH_SPEEX
++    CFLAGS_c += $(shell $(PKG_CONFIG) speex --cflags) $(shell $(PKG_CONFIG) speexdsp --cflags) -DWITH_SPEEX
+ endif
+ LIBS_c += $(SPEEX_LIBS)
+ 
+ ifndef CONFIG_WINDOWS
+-    ifeq ($(shell pkg-config --exists freetype2 && echo 1),1)
+-        FREETYPE_CFLAGS ?= $(shell pkg-config freetype2 --cflags)
+-        FREETYPE_LIBS ?= $(shell pkg-config freetype2 --libs)
++    ifeq ($(shell $(PKG_CONFIG) --exists freetype2 && echo 1),1)
++        FREETYPE_CFLAGS ?= $(shell $(PKG_CONFIG) freetype2 --cflags)
++        FREETYPE_LIBS ?= $(shell $(PKG_CONFIG) freetype2 --libs)
+     endif
+ 
+     ifdef FREETYPE_LIBS
+@@ -176,8 +177,8 @@
+ ifdef OLD_WAV_LOADING
+     CFLAGS_c += -DOLD_WAV_LOADING
+ else
+-    SNDFILE_CFLAGS ?= $(shell pkg-config sndfile --cflags)
+-    SNDFILE_LIBS ?= $(shell pkg-config sndfile --libs)
++    SNDFILE_CFLAGS ?= $(shell $(PKG_CONFIG) sndfile --cflags)
++    SNDFILE_LIBS ?= $(shell $(PKG_CONFIG) sndfile --libs)
+     CFLAGS += $(SNDFILE_CFLAGS)
+     LIBS_c += $(SNDFILE_LIBS)
+ endif
+@@ -560,8 +561,8 @@
+ endif
+ 
+ #ifdef CONFIG_OGG
+-#    OGG_CFLAGS ?= $(shell pkg-config vorbisfile --cflags) -DWITH_OGG_VORBIS
+-#    OGG_LIBS ?= $(shell pkg-config vorbisfile --libs)
++#    OGG_CFLAGS ?= $(shell $(PKG_CONFIG) vorbisfile --cflags) -DWITH_OGG_VORBIS
++#    OGG_LIBS ?= $(shell $(PKG_CONFIG) vorbisfile --libs)
+ #    CFLAGS_c += $(OGG_CFLAGS)
+ #    LIBS_c += $(OGG_LIBS)
+ #endif
diff --minimal -Nru ezquake-3.6.4/debian/patches/series ezquake-3.6.4/debian/patches/series
--- ezquake-3.6.4/debian/patches/series	2024-01-15 05:26:53.000000000 +0100
+++ ezquake-3.6.4/debian/patches/series	2024-08-24 11:53:10.000000000 +0200
@@ -7,3 +7,4 @@
 fixes/spelling.patch
 fixes/format-string.patch
 warnings/incompatible-pointer-types.patch
+cross.patch
diff --minimal -Nru ezquake-3.6.4/debian/rules ezquake-3.6.4/debian/rules
--- ezquake-3.6.4/debian/rules	2024-01-15 05:25:07.000000000 +0100
+++ ezquake-3.6.4/debian/rules	2024-08-24 11:52:49.000000000 +0200
@@ -10,9 +10,22 @@
 
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 
+include /usr/share/dpkg/architecture.mk
+
+CPU_MAP_aarch64 = arm
+CPU_MAP_alpha = axp
+CPU_MAP_i686 = i386
+SYS_MAP_linux = Linux
+SYS_MAP_kfreebsd = FreeBSD
+
 %:
 	dh $@
 
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+override_dh_auto_build:
+	dh_auto_build -- CPU=$(or $(CPU_MAP_$(DEB_HOST_GNU_CPU)),$(DEB_HOST_GNU_CPU)) SYS=$(or $(SYS_MAP_$(DEB_HOST_ARCH_OS)),$(DEB_HOST_ARCH_OS))
+endif
+
 override_dh_install-arch:
 	cp ezquake-* ezquake
 	dh_install


More information about the Pkg-games-devel mailing list