Source: quakespasm
Version: 0.93.0+dfsg-2
Tags: patch
User: [email protected]
Usertags: rebootstrap

quakespasm fails to cross build from source, because it uses the build
architecture toolchain. For the makefile buildsystem being used here,
the simplest solution is to let dh_auto_build pass cross tools to make.
While doing so, I figured that debian/rules could be simplified by
passing --sourcedirectory to dh. Next, the upstream build system hard
codes the build architecture pkg-config. The attached patch fixes both
of these issues, but it doesn't make quakespasm cross buildable, because
it runs into #899138 and thus fails finding opusfile.pc. Please consider
applying the attached patch anyway and closing this bug when doing so.

Helmut
diff --minimal -Nru quakespasm-0.93.0+dfsg/debian/changelog 
quakespasm-0.93.0+dfsg/debian/changelog
--- quakespasm-0.93.0+dfsg/debian/changelog     2018-01-16 10:23:33.000000000 
+0100
+++ quakespasm-0.93.0+dfsg/debian/changelog     2018-05-27 19:19:16.000000000 
+0200
@@ -1,3 +1,12 @@
+quakespasm (0.93.0+dfsg-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross buildability: (Closes: #-1)
+    + Let dh_auto_build pass cross tools to make.
+    + cross.patch: Make pkg-config substitutable.
+
+ -- Helmut Grohne <[email protected]>  Sun, 27 May 2018 19:19:16 +0200
+
 quakespasm (0.93.0+dfsg-2) unstable; urgency=medium
 
   * Move git hosting to salsa.debian.org
diff --minimal -Nru quakespasm-0.93.0+dfsg/debian/patches/cross.patch 
quakespasm-0.93.0+dfsg/debian/patches/cross.patch
--- quakespasm-0.93.0+dfsg/debian/patches/cross.patch   1970-01-01 
01:00:00.000000000 +0100
+++ quakespasm-0.93.0+dfsg/debian/patches/cross.patch   2018-05-27 
19:19:16.000000000 +0200
@@ -0,0 +1,21 @@
+--- quakespasm-0.93.0+dfsg.orig/Quake/Makefile
++++ quakespasm-0.93.0+dfsg/Quake/Makefile
+@@ -46,6 +46,7 @@
+ LINKER = $(CC)
+ 
+ STRIP ?= strip
++PKG_CONFIG ?= pkg-config
+ 
+ #CPUFLAGS= -mtune=i686
+ #CPUFLAGS= -march=pentium4
+@@ -152,8 +153,8 @@
+ # but they include the headers without the opus directory
+ # prefix and rely on pkg-config. ewww...
+ CFLAGS+= -DUSE_CODEC_OPUS
+-CFLAGS+= $(shell pkg-config --cflags opusfile)
+-CODECLIBS+= $(shell pkg-config --libs   opusfile)
++CFLAGS+= $(shell $(PKG_CONFIG) --cflags opusfile)
++CODECLIBS+= $(shell $(PKG_CONFIG) --libs   opusfile)
+ endif
+ ifeq ($(USE_CODEC_VORBIS),1)
+ CFLAGS+= -DUSE_CODEC_VORBIS $(cpp_vorbisdec)
diff --minimal -Nru quakespasm-0.93.0+dfsg/debian/patches/series 
quakespasm-0.93.0+dfsg/debian/patches/series
--- quakespasm-0.93.0+dfsg/debian/patches/series        2018-01-16 
10:23:33.000000000 +0100
+++ quakespasm-0.93.0+dfsg/debian/patches/series        2018-05-27 
19:19:16.000000000 +0200
@@ -4,3 +4,4 @@
 mkpak-bashism.patch
 reproducible-build.patch
 spelling-fixes.patch
+cross.patch
diff --minimal -Nru quakespasm-0.93.0+dfsg/debian/rules 
quakespasm-0.93.0+dfsg/debian/rules
--- quakespasm-0.93.0+dfsg/debian/rules 2018-01-16 10:23:33.000000000 +0100
+++ quakespasm-0.93.0+dfsg/debian/rules 2018-05-27 19:18:37.000000000 +0200
@@ -8,7 +8,7 @@
 CXXFLAGS+=$(CPPFLAGS)
 
 %:
-       dh $@
+       dh $@ --sourcedirectory=Quake
 
 ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
 maybe_debug = DEBUG=0
@@ -16,11 +16,8 @@
 maybe_debug = DEBUG=1
 endif
 
-override_dh_auto_clean:
-       make -C Quake clean
-
 override_dh_auto_build:
-       make -C Quake \
+       dh_auto_build -- \
                $(maybe_debug) \
                STRIP=": do not strip:" \
                DO_USERDIRS=1 \
@@ -29,7 +26,9 @@
                USE_CODEC_OPUS=1 \
                USE_CODEC_MIKMOD=1 \
                USE_CODEC_UMX=1
-       make -C Misc/qs_pak
+       dh_auto_build --sourcedirectory=Misc/qs_pak
 
 override_dh_strip:
        dh_strip --ddeb-migration='quakespasm-dbg (<< 0.90.1+dfsg-2~)'
+
+override_dh_auto_install:

Reply via email to