Source: darkplaces Version: 0~20140513+svn12208-7 Tags: patch User: helm...@debian.org Usertags: rebootstrap
darkplaces fails to cross build from source, because it uses the build architecture toolchain. The first step towards cross building is passing cross tools to make and the easiest way of doing so is dh_auto_build. That mostly works except for the makefile hard coding the build architecture pkg-config. Then it mostly builds, except for building some file with -msse2. The armhf compiler didn't particularly like that flag. Turns out the upstream makefile uses uname to vary what is being built, so we need to pass DP_MAKE_TARGET and DP_MACHINE. Pretending that DP_MAKE_TARGET is linux works at least for linux-any, kfreebsd-any and hurd-any. Using DEB_HOST_GNU_CPU for DP_MACHINE also works sufficiently well, because the makefile only checks for x86_64 and x*86. Then darkplaces cross builds successfully. Please consider applying the attached patch. Helmut
--- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +darkplaces (0~20140513+svn12208-7.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: (Closes: #-1) + + Let dh_auto_build pass cross tools to make. + + Also pass DP_MAKE_TARGET and DP_MACHINE to avoid uname calls. + + cross.patch: Make pkg-config substitutable. + + -- Helmut Grohne <hel...@subdivi.de> Mon, 11 Jun 2018 17:51:09 +0200 + darkplaces (0~20140513+svn12208-7) unstable; urgency=medium * darkplaces: Explicitly depend on libgl1. In this game engine it's --- a/debian/patches/cross.patch +++ b/debian/patches/cross.patch @@ -0,0 +1,67 @@ +--- a/makefile ++++ b/makefile +@@ -386,8 +386,8 @@ + + # vorbis + ifeq ($(DP_LINK_VORBIS), shared) +- CFLAGS_LIBVORBIS=-DLINK_TO_LIBVORBIS `pkg-config --cflags vorbisfile` +- LIB_VORBIS=`pkg-config --libs vorbisfile` ++ CFLAGS_LIBVORBIS=-DLINK_TO_LIBVORBIS `$(PKG_CONFIG) --cflags vorbisfile` ++ LIB_VORBIS=`$(PKG_CONFIG) --libs vorbisfile` + endif + ifeq ($(DP_LINK_VORBIS), dlopen) + CFLAGS_LIBVORBIS= +@@ -396,8 +396,8 @@ + + # theora + ifeq ($(DP_LINK_THEORA), shared) +- CFLAGS_LIBTHEORA=-DLINK_TO_THEORA `pkg-config --cflags theora vorbis vorbisenc ogg` +- LIB_THEORA=`pkg-config --libs theora vorbis vorbisenc ogg` ++ CFLAGS_LIBTHEORA=-DLINK_TO_THEORA `$(PKG_CONFIG) --cflags theora vorbis vorbisenc ogg` ++ LIB_THEORA=`$(PKG_CONFIG) --libs theora vorbis vorbisenc ogg` + endif + ifeq ($(DP_LINK_THEORA), dlopen) + CFLAGS_LIBTHEORA= +@@ -406,8 +406,8 @@ + + # png + ifeq ($(DP_LINK_PNG), shared) +- CFLAGS_LIBPNG=-DLINK_TO_PNG `pkg-config --cflags libpng` +- LIB_PNG=`pkg-config --libs libpng` ++ CFLAGS_LIBPNG=-DLINK_TO_PNG `$(PKG_CONFIG) --cflags libpng` ++ LIB_PNG=`$(PKG_CONFIG) --libs libpng` + endif + ifeq ($(DP_LINK_PNG), dlopen) + CFLAGS_LIBPNG= +@@ -416,8 +416,8 @@ + + # curl + ifeq ($(DP_LINK_CURL), shared) +- CFLAGS_LIBCURL=-DLINK_TO_CURL `pkg-config --cflags libcurl` +- LIB_CURL=`pkg-config --libs libcurl` ++ CFLAGS_LIBCURL=-DLINK_TO_CURL `$(PKG_CONFIG) --cflags libcurl` ++ LIB_CURL=`$(PKG_CONFIG) --libs libcurl` + endif + ifeq ($(DP_LINK_CURL), dlopen) + CFLAGS_LIBCURL= +@@ -425,8 +425,8 @@ + endif + + ifeq ($(DP_LINK_FREETYPE2), shared) +- CFLAGS_LIBFREETYPE2=-DLINK_TO_FREETYPE2 `pkg-config --cflags freetype2` +- LIB_FREETYPE2=`pkg-config --libs freetype2` ++ CFLAGS_LIBFREETYPE2=-DLINK_TO_FREETYPE2 `$(PKG_CONFIG) --cflags freetype2` ++ LIB_FREETYPE2=`$(PKG_CONFIG) --libs freetype2` + endif + ifeq ($(DP_LINK_FREETYPE2), dlopen) + CFLAGS_LIBFREETYPE2= +--- a/makefile.inc ++++ b/makefile.inc +@@ -25,6 +25,7 @@ + CPUOPTIMIZATIONS?=-fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fno-trapping-math + # NOTE: *never* *ever* use the -ffast-math or -funsafe-math-optimizations flag + ++PKG_CONFIG?=pkg-config + SDL_CONFIG?=sdl-config + SDL2_CONFIG?=sdl2-config + SDLCONFIG_UNIXCFLAGS?=`$(SDL_CONFIG) --cflags` --- a/debian/patches/series +++ b/debian/patches/series @@ -12,3 +12,4 @@ Fix-various-typos.patch Don-t-build-SSE-only-software-rasterizer-on-non-x86-.patch Disable-gpu-skinning-for-skeletal-models.patch +cross.patch --- a/debian/rules +++ b/debian/rules @@ -38,11 +38,13 @@ # LDFLAGS_* are used to compile builddate.c, so yes, they do need to include # the CPPFLAGS. override_dh_auto_build: - $(MAKE) \ + dh_auto_build -- \ CFLAGS_RELEASE="$(CPPFLAGS) $(CFLAGS)" \ CFLAGS_DEBUG="$(CPPFLAGS) $(CFLAGS)" \ LDFLAGS_RELEASE="$(CPPFLAGS) $(CFLAGS) $(LDFLAGS)" \ LDFLAGS_DEBUG="$(CPPFLAGS) $(CFLAGS) $(LDFLAGS)" \ + DP_MAKE_TARGET=linux \ + DP_MACHINE=$(DEB_HOST_GNU_CPU) \ DP_LINK_CURL=shared \ DP_LINK_FREETYPE2=shared \ DP_LINK_JPEG=shared \