Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / tennix / fix_FTBFS.patch
blobd58aa3a8129f32bbeeacb86ba2442d6c367a56b9
1 From: Thomas Perl <m@thp.io>
2 Description: Fix FTBFS
3 Origin: upstream, https://repo.or.cz/w/tennix.git/commitdiff/6144cb7626dfdc0820a0036af83a531e8e68bae6
4 Bug-Debian: https://bugs.debian.org/664907
6 --- tennix-1.1.orig/archivetool.cc
7 +++ tennix-1.1/archivetool.cc
8 @@ -24,6 +24,7 @@
9 #include <assert.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 +#include <libgen.h>
13 #include <sys/stat.h>
15 #include "archive.hh"
16 --- tennix-1.1.orig/game.c
17 +++ tennix-1.1/game.c
18 @@ -388,6 +388,9 @@ void step(GameState* s) {
19 s->ball.move_x = 4.0 + 3.0*PLAYER(s, p).power/PLAYER_POWER_MAX;
20 s->ball.move_z = 1.1*PLAYER(s, p).power/PLAYER_POWER_MAX;
21 break;
22 + default:
23 + assert(false);
24 + break;
26 s->ball.move_y = get_move_y( s, p);
27 s->sound_events ^= SOUND_EVENT_RACKET;
28 --- tennix-1.1.orig/network.h
29 +++ tennix-1.1/network.h
30 @@ -103,19 +103,19 @@ void
31 net_serialize_ball(const Ball* src, NetworkBall* dest);
33 void
34 -net_unserialize_ball(const NetworkBall* src, Ball* dest);
35 +net_unserialize_ball(NetworkBall* src, Ball* dest);
37 void
38 net_serialize_player(const Player* src, NetworkPlayer* dest);
40 void
41 -net_unserialize_player(const NetworkPlayer* src, Player* dest);
42 +net_unserialize_player(NetworkPlayer* src, Player* dest);
44 void
45 net_serialize_gamestate(const GameState* src, NetworkGameState* dest);
47 void
48 -net_unserialize_gamestate(const NetworkGameState* src, GameState* dest);
49 +net_unserialize_gamestate(NetworkGameState* src, GameState* dest);
51 #endif
53 --- tennix-1.1.orig/locations.h
54 +++ tennix-1.1/locations.h
55 @@ -155,7 +155,7 @@ static Location locations[] = {
56 #endif
58 /* End marker */
59 - { NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, false }
60 + { NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, false, false, 0, 0 }
63 unsigned int location_count()
64 --- tennix-1.1.orig/tennix.cc
65 +++ tennix-1.1/tennix.cc
66 @@ -461,7 +461,7 @@ int main( int argc, char** argv) {
67 start_fade();
68 gameloop(current_game, connection);
69 SDL_Delay(150);
70 - while(SDL_PollEvent(&e));
71 + while (SDL_PollEvent(&e)) {};
72 #ifdef ENABLE_FPS_LIMIT
73 frames = 0;
74 ft = SDL_GetTicks();
75 --- tennix-1.1.orig/SDL_rotozoom.c
76 +++ tennix-1.1/SDL_rotozoom.c
77 @@ -365,6 +365,9 @@ int zoomSurfaceRGBA(SDL_Surface * src, S
79 int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy)
81 + (void)flipx;
82 + (void)flipy;
84 Uint32 x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy;
85 Uint8 *sp, *dp, *csp;
86 int dgap;
87 @@ -393,7 +396,7 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
89 csx = 0;
90 csax = sax;
91 - for (x = 0; x < dst->w; x++) {
92 + for (x = 0; x < (Uint32)dst->w; x++) {
93 csx += sx;
94 *csax = (csx >> 16);
95 csx &= 0xffff;
96 @@ -401,7 +404,7 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
98 csy = 0;
99 csay = say;
100 - for (y = 0; y < dst->h; y++) {
101 + for (y = 0; y < (Uint32)dst->h; y++) {
102 csy += sy;
103 *csay = (csy >> 16);
104 csy &= 0xffff;
105 @@ -410,13 +413,13 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
107 csx = 0;
108 csax = sax;
109 - for (x = 0; x < dst->w; x++) {
110 + for (x = 0; x < (Uint32)dst->w; x++) {
111 csx += (*csax);
112 csax++;
114 csy = 0;
115 csay = say;
116 - for (y = 0; y < dst->h; y++) {
117 + for (y = 0; y < (Uint32)dst->h; y++) {
118 csy += (*csay);
119 csay++;
121 @@ -432,10 +435,10 @@ int zoomSurfaceY(SDL_Surface * src, SDL_
122 * Draw
124 csay = say;
125 - for (y = 0; y < dst->h; y++) {
126 + for (y = 0; y < (Uint32)dst->h; y++) {
127 csax = sax;
128 sp = csp;
129 - for (x = 0; x < dst->w; x++) {
130 + for (x = 0; x < (Uint32)dst->w; x++) {
132 * Draw
134 @@ -801,6 +804,8 @@ SDL_Surface* rotateSurface90Degrees(SDL_
135 void rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight,
136 double *canglezoom, double *sanglezoom)
138 + (void)zoomy;
140 double x, y, cx, cy, sx, sy;
141 double radangle;
142 int dstwidthhalf, dstheighthalf;
143 --- tennix-1.1.orig/network.c
144 +++ tennix-1.1/network.c
145 @@ -183,7 +183,7 @@ net_serialize_ball(const Ball* src, Netw
148 void
149 -net_unserialize_ball(const NetworkBall* src, Ball* dest)
150 +net_unserialize_ball(NetworkBall* src, Ball* dest)
152 assert(src != NULL && dest != NULL);
153 dest->x = unpack_float(SDLNet_Read32(&(src->x)), -WIDTH, WIDTH*2);
154 @@ -213,7 +213,7 @@ net_serialize_player(const Player* src,
157 void
158 -net_unserialize_player(const NetworkPlayer* src, Player* dest)
159 +net_unserialize_player(NetworkPlayer* src, Player* dest)
161 assert(src != NULL && dest != NULL);
162 dest->x = unpack_float(SDLNet_Read32(&(src->x)), 0, WIDTH*1.2);
163 @@ -221,7 +221,7 @@ net_unserialize_player(const NetworkPlay
164 dest->power = unpack_float(SDLNet_Read32(&(src->power)), 0, 110);
165 dest->use_power = src->use_power;
166 dest->score = src->score;
167 - dest->desire = src->desire;
168 + dest->desire = (PlayerDesire)src->desire;
169 dest->game = src->game;
170 memcpy(dest->sets, src->sets, sizeof(unsigned char)*(SETS_TO_WIN*2));
171 dest->accelerate = unpack_float(SDLNet_Read32(&(src->accelerate)), 0, 200);
172 @@ -250,7 +250,7 @@ net_serialize_gamestate(const GameState*
175 void
176 -net_unserialize_gamestate(const NetworkGameState* src, GameState* dest)
177 +net_unserialize_gamestate(NetworkGameState* src, GameState* dest)
179 int p;
181 --- tennix-1.1.orig/makefile
182 +++ tennix-1.1/makefile
183 @@ -27,24 +27,23 @@ ifeq ($(MKCALLGRAPH),1)
184 LD = nccld
185 endif
187 -RELEASE = 1.1
189 -UNAME = $(shell uname)
190 +RELEASE = 1.1.1
192 PREFIX ?= /usr/local
193 BINDIR ?= $(PREFIX)/bin
194 DATAROOTDIR ?= $(PREFIX)/share
195 DATADIR ?= $(DATAROOTDIR)/games
197 -LIBS =
198 -CFLAGS += -W -Wall -ansi -pedantic -Wcast-qual -Wwrite-strings -DVERSION=\"$(RELEASE)\" -O2 -DPREFIX=\"$(PREFIX)\" -g
199 +CFLAGS += -W -Wall -DVERSION=\"$(RELEASE)\" -O2 -DPREFIX=\"$(PREFIX)\"
200 CXXFLAGS += $(CFLAGS)
202 USE_PYTHON ?= 1
204 ifeq ($(USE_PYTHON),1)
205 - CFLAGS += `python-config --includes` -DTENNIX_PYTHON
206 - LIBS += `python-config --libs`
207 + PYTHON_INCLUDES := $(shell python-config --includes)
208 + PYTHON_LIBS := $(shell python-config --libs)
209 + CFLAGS += $(PYTHON_INCLUDES) -DTENNIX_PYTHON
210 + LIBS += $(PYTHON_LIBS)
211 endif
213 ifeq ($(NONFREE_LOCATIONS),1)
214 @@ -67,17 +66,14 @@ ifeq ($(MAEMO),1)
215 CFLAGS += -DMAEMO
216 endif
218 -ifeq ($(UNAME),Darwin)
219 - SDLLIBS=$$(sdl-config --prefix)/lib
220 - LIBS += $$(sdl-config --static-libs) $(SDLLIBS)/libSDL_mixer.a $(SDLLIBS)/libSDL_image.a $(SDLLIBS)/libSDL_ttf.a $(SDLLIBS)/libSDL_net.a $$(freetype-config --prefix)/lib/libfreetype.a
221 - CFLAGS += $$(sdl-config --cflags) -lz
222 -else
223 - LIBS += $$(sdl-config --libs) -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_net
224 - CFLAGS += $$(sdl-config --cflags)
225 -endif
226 +SDL_LIBS := $(shell sdl-config --libs)
227 +SDL_CFLAGS := $(shell sdl-config --cflags)
229 +LIBS += $(SDL_LIBS) -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_net
230 +CFLAGS += $(SDL_CFLAGS)
232 -SRC = tennix.cc game.c graphics.cc input.c util.c sound.cc animation.c network.c
233 OBJ = tennix.o game.o graphics.o input.o util.o sound.o animation.o archive.o SDL_rotozoom.o network.o
235 ifeq ($(MSYSTEM),MINGW32)
236 OBJ += tennixres.o
237 endif
238 --- tennix-1.1.orig/game.h
239 +++ tennix-1.1/game.h
240 @@ -98,6 +98,13 @@ typedef struct {
241 bool inhibit_gravity;
242 } Ball;
244 +enum PlayerDesire {
245 + DESIRE_NORMAL,
246 + DESIRE_TOPSPIN,
247 + DESIRE_SMASH,
248 + DESIRE_MAX
251 typedef struct {
252 InputDevice* input;
253 char input_device_index;
254 @@ -106,9 +113,9 @@ typedef struct {
255 float power;
256 bool use_power;
257 unsigned char score;
258 - unsigned char desire;
259 + PlayerDesire desire;
260 bool type; /* is this player ai-controlled or human? */
261 - char game; /* score for the current game */
262 + int game; /* score for the current game */
263 unsigned char sets[SETS_TO_WIN*2]; /* score for each set */
264 float accelerate; /* a value [0..1] how fast the user accelerates */
265 } Player;
266 @@ -118,13 +125,6 @@ enum {
267 PLAYER_TYPE_AI
270 -enum {
271 - DESIRE_NORMAL,
272 - DESIRE_TOPSPIN,
273 - DESIRE_SMASH,
274 - DESIRE_MAX
277 /* wait 2 seconds before we score the game */
278 #define SCORING_DELAY 1000
280 @@ -161,7 +161,7 @@ enum {
282 typedef struct {
283 const Location* location;
284 - char current_location; /* index of loc. in global location table */
285 + int current_location; /* index of loc. in global location table */
286 Ball ball;
287 Player players[MAXPLAYERS];
288 unsigned char serving_player;