Source: tuxpuck Version: 0.8.2-8 Tags: patch User: helm...@debian.org Usertags: rebootstrap
tuxpuck fails to cross build from source. The failure looks innocent initially, it fails finding freetype.pc. Simple enough, use the right pkg-config, but then it runs the damn thing. Thus I noticed that the utils folder actually only contains build tools. It's not meant to be build with a cross compiler. So rename CC to CC_FOR_BUILD (to avoid dh_auto_build replacing it with a cross compiler). Only thing is: We now need libsdl1.2-dev for both the build architecture and the host architecture. That doesn't work, because libsdl1.2-dev is not Multi-Arch: same and cannot be (due to sdl-config). So I figured that the utils don't actually need sdl. All they use sdl for is declaring integer types with particular widths and signedness. That can easily be converted to using <inttypes.h> removing the need for libsdl1.2-dev (for the build architecture). The freetype depdency is only needed for the build architecture (thus annotate with :native) and then it also finds freetype.pc. So with all these changes, tuxpuck actually cross builds. The patch is a bit bigger, but I hope you can still take it. Helmut
diff --minimal -Nru tuxpuck-0.8.2/debian/changelog tuxpuck-0.8.2/debian/changelog --- tuxpuck-0.8.2/debian/changelog 2018-03-08 22:15:21.000000000 +0100 +++ tuxpuck-0.8.2/debian/changelog 2018-03-20 06:31:48.000000000 +0100 @@ -1,3 +1,13 @@ +tuxpuck (0.8.2-8.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: (Closes: #-1) + + Build the utils folder with the build architecture compiler. + + Remove dependency on sdl from utils/*.c. + + Switch the freetype dependency to the build architecture. + + -- Helmut Grohne <hel...@subdivi.de> Tue, 20 Mar 2018 06:31:48 +0100 + tuxpuck (0.8.2-8) unstable; urgency=medium * Use compat level 11. diff --minimal -Nru tuxpuck-0.8.2/debian/control tuxpuck-0.8.2/debian/control --- tuxpuck-0.8.2/debian/control 2018-03-08 22:15:21.000000000 +0100 +++ tuxpuck-0.8.2/debian/control 2018-03-20 06:31:48.000000000 +0100 @@ -6,7 +6,7 @@ Markus Koschany <a...@debian.org> Build-Depends: debhelper (>= 11), - libfreetype6-dev, + libfreetype6-dev:native, libjpeg-dev, libpng-dev, libsdl1.2-dev, diff --minimal -Nru tuxpuck-0.8.2/debian/patches/cross.patch tuxpuck-0.8.2/debian/patches/cross.patch --- tuxpuck-0.8.2/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100 +++ tuxpuck-0.8.2/debian/patches/cross.patch 2018-03-20 06:31:48.000000000 +0100 @@ -0,0 +1,155 @@ +Index: tuxpuck-0.8.2/utils/Makefile +=================================================================== +--- tuxpuck-0.8.2.orig/utils/Makefile ++++ tuxpuck-0.8.2/utils/Makefile +@@ -1,18 +1,18 @@ + # Makefile for TuxPuck Utils , Copyright Jacob Kroon 2001-2002 +-CC = gcc ++CC_FOR_BUILD = gcc + CFLAGS += -g -Wall -Werror + ############################################################# + + all : ttf2font data2c anim + + ttf2font : ttf2font.c +- $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) ttf2font.c `pkg-config --cflags --libs freetype2` -o ttf2font ++ $(CC_FOR_BUILD) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) ttf2font.c `pkg-config --cflags --libs freetype2` -o ttf2font + + data2c : data2c.c +- $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) data2c.c `sdl-config --cflags --libs` -o data2c ++ $(CC_FOR_BUILD) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) data2c.c -o data2c + + anim : anim.c +- $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) anim.c `sdl-config --cflags --libs` -o anim ++ $(CC_FOR_BUILD) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) anim.c -o anim + + clean : + rm -f *~ data2c ttf2font anim +Index: tuxpuck-0.8.2/utils/anim.c +=================================================================== +--- tuxpuck-0.8.2.orig/utils/anim.c ++++ tuxpuck-0.8.2/utils/anim.c +@@ -1,11 +1,10 @@ + /* anim.c - Copyright (C) 2001-2002 Jacob Kroon, see COPYING for details */ + ++#include <inttypes.h> + #include <stdlib.h> + #include <string.h> + #include <stdio.h> + #include <sys/stat.h> +-#include <SDL_endian.h> +-#include <SDL_types.h> + + void errorc(char *msg) + { +@@ -23,15 +22,15 @@ + { + FILE *in = NULL; + struct stat theStat; +- Uint8 *data; +- Uint32 size; ++ uint8_t *data; ++ uint32_t size; + + if ((in = fopen(filename, "rb")) == NULL) + errorcc("Couldn't open file, ", filename); + stat(filename, &theStat); +- data = (Uint8 *) malloc(theStat.st_size); ++ data = (uint8_t *) malloc(theStat.st_size); + size = theStat.st_size; +- fwrite(&size, sizeof(Uint32), 1, out); ++ fwrite(&size, sizeof(uint32_t), 1, out); + if (fread(data, theStat.st_size, 1, in) != 1) + errorcc("Error reading from file, ", filename); + fwrite(data, theStat.st_size, 1, out); +@@ -45,8 +44,8 @@ + char buffer1[100]; + char buffer2[100]; + char *ptr; +- Uint8 nbrOfFrames, nbrOfAnimations; +- Uint32 uint32; ++ uint8_t nbrOfFrames, nbrOfAnimations; ++ uint32_t uint32; + int j = 0, i = 0; + + if (argc != 3) +@@ -57,7 +56,7 @@ + errorcc("Couldn't open file for writing: ", argv[2]); + if (fscanf(in, "NbrOfFrames: %d\n", &uint32) != 1) + errorc("Wrong number of frames!"); +- nbrOfFrames = (Uint8) uint32; ++ nbrOfFrames = (uint8_t) uint32; + fwrite(&nbrOfFrames, 1, 1, out); + ptr = strrchr(argv[1], '/'); + if (ptr) +@@ -72,26 +71,26 @@ + } + if (fscanf(in, "NbrOfAnimations: %d\n", &uint32) != 1) + errorc("Wrong number of animations!"); +- nbrOfAnimations = (Uint8) uint32; ++ nbrOfAnimations = (uint8_t) uint32; + fwrite(&nbrOfAnimations, 1, 1, out); + for (i = 0; i < nbrOfAnimations; i++) { +- Uint32 n; +- Uint8 n2; ++ uint32_t n; ++ uint8_t n2; + + if (fscanf(in, "%d\n", &n) != 1) + errorc("Couldnt read number of frames in animation!"); +- n2 = (Uint8) n; ++ n2 = (uint8_t) n; + fwrite(&n2, 1, 1, out); + for (j = 0; j < n2; j++) { +- Uint32 frame; +- Uint32 time; +- Uint8 frame2; +- Uint16 time2; ++ uint32_t frame; ++ uint32_t time; ++ uint8_t frame2; ++ uint16_t time2; + + if (fscanf(in, "%d %d\n", &frame, &time) != 2) + errorc("Error reading frames"); +- frame2 = (Uint8) frame; +- time2 = (Uint16) time; ++ frame2 = (uint8_t) frame; ++ time2 = (uint16_t) time; + fwrite(&frame2, 1, 1, out); + fwrite(&time2, sizeof(time2), 1, out); + } +Index: tuxpuck-0.8.2/utils/data2c.c +=================================================================== +--- tuxpuck-0.8.2.orig/utils/data2c.c ++++ tuxpuck-0.8.2/utils/data2c.c +@@ -1,10 +1,9 @@ + /* data2c - Copyright (C) 2001-2002 Jacob Kroon, see COPYING for details */ + ++#include <inttypes.h> + #include <stdlib.h> + #include <stdio.h> + #include <sys/stat.h> +-#include <SDL_types.h> +-#include <SDL_endian.h> + + void errorc(char *msg) + { +@@ -24,7 +23,7 @@ + char buffer[100]; + unsigned char ch; + int i = 0; +- Uint32 size; ++ uint32_t size; + struct stat theStat; + + if (argc != 3) +@@ -39,7 +38,7 @@ + fprintf(out, "/* %s */\n", buffer); + fprintf(out, "unsigned char %s[] = {\n", argv[2]); + for (i = 0; i < 4; i++) +- fprintf(out, "%d,", ((Uint8 *) & size)[i]); ++ fprintf(out, "%d,", ((uint8_t *) & size)[i]); + while (fread(&ch, 1, 1, in) != 0) + fprintf(out, "%d,", ch); + fseek(out, -1, SEEK_CUR); diff --minimal -Nru tuxpuck-0.8.2/debian/patches/series tuxpuck-0.8.2/debian/patches/series --- tuxpuck-0.8.2/debian/patches/series 2018-03-08 22:15:21.000000000 +0100 +++ tuxpuck-0.8.2/debian/patches/series 2018-03-20 06:31:48.000000000 +0100 @@ -3,3 +3,4 @@ libpng-transition.patch FTBFS-with-fread.patch clang-FTBFS.patch +cross.patch