Source: goattracker
Version: 2.75-3
Tags: patch
User: [email protected]
Usertags: ftcbfs

goattracker fails to cross build from source for a number of reasons.
The immediately visible one is calling the build architecture strip on
host objects. Doing so is also bad, because it breaks generation of
-dbgsym packages as well as DEB_BUILD_OPTIONS=nostrip. The attached
patch makes the strip tool substitutable and lets debian/rules
substitute the true command. Then it fails running dat2inc. As it
happens, the src/bme directory only contains build tools and thus should
be compiled for the build architecture. Doing so makes it fail finding
SDL, which is only requested for the host architecture by Build-Depends.
However, it is easy to remove the need for SDL from these tools. After
doing that, goattracker cross builds successfully. Please consider
applying the attached patch.

Helmut
diff --minimal -Nru goattracker-2.75/debian/changelog 
goattracker-2.75/debian/changelog
--- goattracker-2.75/debian/changelog   2019-09-10 10:39:13.000000000 +0200
+++ goattracker-2.75/debian/changelog   2020-03-30 06:48:03.000000000 +0200
@@ -1,3 +1,14 @@
+goattracker (2.75-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + cross.patch: Make strip substitutable.
+    + Pass a non-stripping strip.
+    + Build build tools in the src/bme directory for the build architecture.
+    + cross.patch: Avoid unnecessary dependency of build tools on SDL.
+
+ -- Helmut Grohne <[email protected]>  Mon, 30 Mar 2020 06:48:03 +0200
+
 goattracker (2.75-3) unstable; urgency=medium
 
   * Apply dh_auto_build part of patch to fix FTCBFS. (Closes: 923888)
diff --minimal -Nru goattracker-2.75/debian/patches/cross.patch 
goattracker-2.75/debian/patches/cross.patch
--- goattracker-2.75/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 
+0100
+++ goattracker-2.75/debian/patches/cross.patch 2020-03-30 06:48:03.000000000 
+0200
@@ -0,0 +1,265 @@
+--- goattracker-2.75.orig/src/bme/makefile
++++ goattracker-2.75/src/bme/makefile
+@@ -1,15 +1,13 @@
+ CC?=gcc
+-CFLAGS+=`sdl-config --cflags`
+-LIBS+=`sdl-config --libs`
+-
++STRIP?=strip
+ 
+ all: dat2inc datafile
+ 
+ datafile: datafile.c bme_end.c
+       $(CC) $(CFLAGS) -o datafile datafile.c bme_end.c
+-      strip datafile
++      $(STRIP) datafile
+ 
+ dat2inc: dat2inc.c
+       $(CC) $(LIBS) -o dat2inc dat2inc.c
+-      strip dat2inc
++      $(STRIP) dat2inc
+ 
+--- goattracker-2.75.orig/src/bme/makefile.mos
++++ goattracker-2.75/src/bme/makefile.mos
+@@ -1,9 +1,11 @@
++STRIP?=strip
++
+ all: dat2inc datafile
+ 
+ datafile: datafile.c bme_end.c
+-      gcc `sdl-config --cflags` -o datafile datafile.c bme_end.c
+-      strip datafile
++      gcc -o datafile datafile.c bme_end.c
++      $(STRIP) datafile
+ 
+ dat2inc: dat2inc.c
+       gcc -o dat2inc dat2inc.c
+-      strip dat2inc
++      $(STRIP) dat2inc
+--- goattracker-2.75.orig/src/bme/makefile.win
++++ goattracker-2.75/src/bme/makefile.win
+@@ -1,10 +1,12 @@
++STRIP?=strip
++
+ all: dat2inc.exe datafile.exe
+ 
+ datafile.exe: datafile.c bme_end.c
+       gcc -o datafile.exe datafile.c bme_end.c
+-      strip datafile.exe
++      $(STRIP) datafile.exe
+ 
+ dat2inc.exe: dat2inc.c
+       gcc -o dat2inc.exe dat2inc.c
+-      strip dat2inc.exe
++      $(STRIP) dat2inc.exe
+ 
+--- goattracker-2.75.orig/src/makefile.common
++++ goattracker-2.75/src/makefile.common
+@@ -2,6 +2,7 @@
+ 
+ CC?=gcc
+ CXX?=g++
++STRIP?=strip
+ CFLAGS+=-Ibme -Iasm -O3 -fpermissive
+ CXXFLAGS+=$(CFLAGS)
+ 
+@@ -24,7 +25,7 @@
+ asm/pc.o asm/vec.o \
+ bme/bme_gfx.o bme/bme_snd.o bme/bme_win.o bme/bme_mou.o bme/bme_kbd.o 
bme/bme_io.o bme/bme_end.o bme/bme.o
+       $(CXX) -o $@ $^ $(LIBS)
+-      strip $@
++      $(STRIP) $@
+ 
+ # it would be nice not having to link things like resid, however the source is
+ # not ready for that
+@@ -39,19 +40,19 @@
+ asm/pc.o asm/vec.o \
+ bme/bme_gfx.o bme/bme_snd.o bme/bme_win.o bme/bme_mou.o bme/bme_kbd.o 
bme/bme_io.o bme/bme_end.o bme/bme.o
+       $(CXX) -DGT2RELOC -o $@ $^ $(LIBS)
+-      strip $@
++      $(STRIP) $@
+       
+ $(PREFIX)mod2sng$(SUFFIX): mod2sng.o bme/bme_end.o
+       $(CC) -o $@ $^
+-      strip $@
++      $(STRIP) $@
+ 
+ $(PREFIX)ins2snd2$(SUFFIX): ins2snd2.o bme/bme_end.o
+       $(CC) -o $@ $^
+-      strip $@
++      $(STRIP) $@
+ 
+ $(PREFIX)sngspli2$(SUFFIX): sngspli2.o bme/bme_end.o
+       $(CC) -o $@ $^
+-      strip $@
++      $(STRIP) $@
+ 
+ goattrk2.dat: player.s altplayer.s chargen.bin palette.bin cursor.bin 
bcursor.bin goattrk2.bmp goattrk2.seq
+       ./bme/datafile $@ goattrk2.seq
+--- goattracker-2.75.orig/src/makefile.win
++++ goattracker-2.75/src/makefile.win
+@@ -4,6 +4,7 @@
+ 
+ CC:=gcc
+ CXX:=g++
++STRIP?=strip
+ PREFIX=../win32/
+ SUFFIX=.exe
+ LIBS=-lmingw32 -lSDLmain -lSDL.dll -static-libstdc++ -static-libgcc -static
+@@ -23,4 +24,4 @@
+ bme/bme_gfx.o bme/bme_snd.o bme/bme_win.o bme/bme_mou.o bme/bme_kbd.o 
bme/bme_io.o bme/bme_end.o bme/bme.o
+       windres goattrk2.rc goaticon.o
+       $(CXX) -o $@ $^ goaticon.o -mwindows $(LIBS)
+-      strip $@
++      $(STRIP) $@
+--- goattracker-2.75.orig/src/makefile.xmingw32
++++ goattracker-2.75/src/makefile.xmingw32
+@@ -10,6 +10,7 @@
+ 
+ CC=$(MINGW32PREFIX)/bin/mingw32-gcc
+ CXX=$(MINGW32PREFIX)/bin/mingw32-g++
++STRIP?=$(STRIP)
+ WINDRES=$(MINGW32PREFIX)/bin/mingw32-windres
+ CFLAGS+=-O3 -Wall -Ibme -Iasm
+ CXXFLAGS=$(CFLAGS)
+@@ -35,7 +36,7 @@
+ bme/bme_gfx.o bme/bme_snd.o bme/bme_win.o bme/bme_mou.o bme/bme_kbd.o 
bme/bme_io.o bme/bme_end.o bme/bme.o
+       $(WINDRES) goattrk2.rc goaticon.o
+       $(CXX) -o $@ $^ goaticon.o $(LIBS)
+-      strip $@
++      $(STRIP) $@
+ 
+ # this compiles a seperate version of the relocator/packer that doesnt use the
+ # SDL interface
+@@ -55,23 +56,23 @@
+ asm/pc.o asm/vec.o \
+ bme/bme_gfx.o bme/bme_snd.o bme/bme_win.o bme/bme_mou.o bme/bme_kbd.o 
bme/bme_io.o bme/bme_end.o bme/bme.o
+       $(CXX) -DGT2RELOC -o $@ $^ $(LIBS)
+-      strip $@
++      $(STRIP) $@
+       
+ $(PREFIX)mod2sng$(SUFFIX): mod2sng.o bme/bme_end.o
+       $(CC) -o $@ $^
+-      strip $@
++      $(STRIP) $@
+ 
+ $(PREFIX)ins2snd2$(SUFFIX): ins2snd2.o bme/bme_end.o
+       $(CC) -o $@ $^
+-      strip $@
++      $(STRIP) $@
+ 
+ $(PREFIX)sngspli2$(SUFFIX): sngspli2.o bme/bme_end.o
+       $(CC) -o $@ $^
+-      strip $@
++      $(STRIP) $@
+ 
+ $(PREFIX)betaconv$(SUFFIX): betaconv.o bme/bme_end.o
+       $(CC) -o $@ $^
+-      strip $@
++      $(STRIP) $@
+ 
+ goattrk2.dat: player.s altplayer.s chargen.bin palette.bin cursor.bin 
bcursor.bin goattrk2.bmp goattrk2.seq
+       datafile $@ goattrk2.seq
+--- goattracker-2.75.orig/src/bme/bme_end.c
++++ goattracker-2.75/src/bme/bme_end.c
+@@ -1,9 +1,9 @@
++#include <stdint.h>
+ #include <stdio.h>
+-#include <SDL/SDL_types.h>
+ 
+ void fwrite8(FILE *file, unsigned data)
+ {
+-    Uint8 bytes[1];
++    uint8_t bytes[1];
+ 
+     bytes[0] = data;
+     fwrite(bytes, 1, 1, file);
+@@ -11,7 +11,7 @@
+ 
+ void fwritele16(FILE *file, unsigned data)
+ {
+-    Uint8 bytes[2];
++    uint8_t bytes[2];
+ 
+     bytes[0] = data;
+     bytes[1] = data >> 8;
+@@ -20,7 +20,7 @@
+ 
+ void fwritele32(FILE *file, unsigned data)
+ {
+-    Uint8 bytes[4];
++    uint8_t bytes[4];
+ 
+     bytes[0] = data;
+     bytes[1] = data >> 8;
+@@ -31,7 +31,7 @@
+ 
+ unsigned fread8(FILE *file)
+ {
+-    Uint8 bytes[1];
++    uint8_t bytes[1];
+ 
+     fread(bytes, 1, 1, file);
+     return bytes[0];
+@@ -39,7 +39,7 @@
+ 
+ unsigned freadle16(FILE *file)
+ {
+-    Uint8 bytes[2];
++    uint8_t bytes[2];
+ 
+     fread(bytes, 2, 1, file);
+     return (bytes[0]) | (bytes[1] << 8);
+@@ -47,7 +47,7 @@
+ 
+ unsigned freadle32(FILE *file)
+ {
+-    Uint8 bytes[4];
++    uint8_t bytes[4];
+ 
+     fread(bytes, 4, 1, file);
+     return (bytes[0]) | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24);
+@@ -55,7 +55,7 @@
+ 
+ unsigned freadhe16(FILE *file)
+ {
+-    Uint8 bytes[2];
++    uint8_t bytes[2];
+ 
+     fread(bytes, 2, 1, file);
+     return (bytes[1]) | (bytes[0] << 8);
+@@ -63,7 +63,7 @@
+ 
+ unsigned freadhe32(FILE *file)
+ {
+-    Uint8 bytes[4];
++    uint8_t bytes[4];
+ 
+     fread(bytes, 4, 1, file);
+     return (bytes[3]) | (bytes[2] << 8) | (bytes[1] << 16) | (bytes[0] << 24);
+--- goattracker-2.75.orig/src/bme/datafile.c
++++ goattracker-2.75/src/bme/datafile.c
+@@ -2,11 +2,11 @@
+ // Datafile creator
+ //
+ 
++#include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <ctype.h>
+-#include <SDL/SDL_types.h>
+ #include "bme_end.h"
+ 
+ #define MAXFILES 16384
+@@ -14,8 +14,8 @@
+ 
+ typedef struct
+ {
+-    Uint32 offset;
+-    Uint32 length;
++    uint32_t offset;
++    uint32_t length;
+     char name[13];
+ } HEADER;
+ 
diff --minimal -Nru goattracker-2.75/debian/patches/series 
goattracker-2.75/debian/patches/series
--- goattracker-2.75/debian/patches/series      2019-03-21 11:54:16.000000000 
+0100
+++ goattracker-2.75/debian/patches/series      2020-03-30 06:45:11.000000000 
+0200
@@ -1 +1,2 @@
 #makefile
+cross.patch
diff --minimal -Nru goattracker-2.75/debian/rules goattracker-2.75/debian/rules
--- goattracker-2.75/debian/rules       2019-09-10 10:39:13.000000000 +0200
+++ goattracker-2.75/debian/rules       2020-03-30 06:48:03.000000000 +0200
@@ -3,11 +3,13 @@
 #export DH_VERBOSE=1
 
 DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/architecture.mk
 include /usr/share/dpkg/buildflags.mk
 CFLAGS += -O3 -Ibme -Iasm
 
 export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+export STRIP=true
 
 build: build-arch build-indep
 
@@ -17,7 +19,7 @@
 
 build-stamp:
        dh_testdir
-       dh_auto_build --sourcedirectory=src/bme -- CFLAGS="$(CFLAGS)" 
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
+       dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_build 
--sourcedirectory=src/bme -- CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" 
LDFLAGS="$(LDFLAGS)"
        dh_auto_build --sourcedirectory=src -- CFLAGS="$(CFLAGS)" 
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
        touch $@
 
_______________________________________________
pkg-multimedia-maintainers mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to