diff --git a/games-arcade/tuxpuck/patches/FTBFS-with-fread.patch b/games-arcade/tuxpuck/patches/FTBFS-with-fread.patch new file mode 100644 index 000000000..cb572b8b5 --- /dev/null +++ b/games-arcade/tuxpuck/patches/FTBFS-with-fread.patch @@ -0,0 +1,27 @@ +From: Ilya Barygin +Date: Sat, 22 Mar 2014 22:16:49 +0100 +Subject: FTBFS with fread + +Fix FTBFS due to unused return value of fread in anim.c. Check that fread +actually returns a value under all circumstances. + +Bug: https://bugs.debian.org/552022 +Forwarded: no +--- + utils/anim.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/utils/anim.c b/utils/anim.c +index 8a2871f..ca631a5 100644 +--- a/utils/anim.c ++++ b/utils/anim.c +@@ -32,7 +32,8 @@ void write_file(FILE * out, char *filename) + data = (Uint8 *) malloc(theStat.st_size); + size = theStat.st_size; + fwrite(&size, sizeof(Uint32), 1, out); +- fread(data, theStat.st_size, 1, in); ++ if (fread(data, theStat.st_size, 1, in) != 1) ++ errorcc("Error reading from file, ", filename); + fwrite(data, theStat.st_size, 1, out); + free(data); + fclose(in); diff --git a/games-arcade/tuxpuck/patches/Makefile.patch b/games-arcade/tuxpuck/patches/Makefile.patch new file mode 100644 index 000000000..7b29a4943 --- /dev/null +++ b/games-arcade/tuxpuck/patches/Makefile.patch @@ -0,0 +1,77 @@ +From: Markus Koschany +Date: Sat, 22 Mar 2014 16:04:03 +0100 +Subject: Makefile + +Forwarded: no +--- + Makefile | 14 +++++++------- + data/Makefile | 2 +- + utils/Makefile | 6 +++--- + 3 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/Makefile b/Makefile +index f1192bc..a7044ba 100644 +--- a/Makefile ++++ b/Makefile +@@ -17,12 +17,12 @@ ifdef COMSPEC + endif + + %.o : %.c +- $(CC) $(CFLAGS) `sdl-config --cflags` -c -o $@ $< ++ $(CC) $(CFLAGS) $(CPPFLAGS) `sdl-config --cflags` -c -o $@ $< + + $(NAME) : $(OBJS) + cd data; $(MAKE) +- $(CC) $(CFLAGS) $(OBJS) data/libdata.a `sdl-config --libs` -lm -lpng \ +- -ljpeg -lz -lvorbisfile -lvorbis -logg -o $(NAME) ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJS) data/libdata.a `sdl-config --libs` -lm -lpng \ ++ -ljpeg -lvorbisfile -o $(NAME) + + w32icon.o : data/icons/tuxpuck.ico + echo AppIcon ICON "data/icons/tuxpuck.ico" > temp.rc +@@ -52,7 +52,7 @@ dist : + rm -Rf $(NAME)-$(VERSION) + + install : $(NAME) +- install -d $(DESTDIR)/usr/bin +- install -d $(DESTDIR)/usr/man/man6 +- install -m755 $(NAME) $(DESTDIR)/usr/bin +- install -m644 man/$(NAME).6.gz $(DESTDIR)/usr/man/man6 ++ install -d $(DESTDIR)/usr/games ++ install -d $(DESTDIR)/usr/share/man/man6 ++ install -m755 $(NAME) $(DESTDIR)/usr/games ++ install -m644 man/$(NAME).6.gz $(DESTDIR)/usr/share/man/man6 +diff --git a/data/Makefile b/data/Makefile +index b9215e4..5eff29e 100644 +--- a/data/Makefile ++++ b/data/Makefile +@@ -10,7 +10,7 @@ SOURCES = pad_png.c puck_png.c tux_png.c glass_png.c scoreboard_png.c \ + OBJS=$(SOURCES:.c=.o) + + %.o : %.c +- $(CC) $(CFLAGS) -c -o $@ $< ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + + libdata.a : $(OBJS) + ar r libdata.a $(OBJS) +diff --git a/utils/Makefile b/utils/Makefile +index 0566f28..9295d77 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -6,13 +6,13 @@ CFLAGS += -g -Wall -Werror + all : ttf2font data2c anim + + ttf2font : ttf2font.c +- $(CC) $(CFLAGS) ttf2font.c `freetype-config --cflags --libs` -o ttf2font ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) ttf2font.c `pkg-config --cflags --libs freetype2` -o ttf2font + + data2c : data2c.c +- $(CC) $(CFLAGS) data2c.c `sdl-config --cflags --libs` -o data2c ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) data2c.c `sdl-config --cflags --libs` -o data2c + + anim : anim.c +- $(CC) $(CFLAGS) anim.c `sdl-config --cflags --libs` -o anim ++ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) anim.c `sdl-config --cflags --libs` -o anim + + clean : + rm -f *~ data2c ttf2font anim diff --git a/games-arcade/tuxpuck/patches/buffer-overflow.patch b/games-arcade/tuxpuck/patches/buffer-overflow.patch new file mode 100644 index 000000000..cc60be52f --- /dev/null +++ b/games-arcade/tuxpuck/patches/buffer-overflow.patch @@ -0,0 +1,25 @@ +From: Steve Kemp +Date: Sat, 22 Mar 2014 16:04:16 +0100 +Subject: buffer overflow + +Bug: https://bugs.debian.org/203508 +Forwarded: no +--- + tuxpuck.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tuxpuck.c b/tuxpuck.c +index 4c0d6d7..76ecbb6 100644 +--- a/tuxpuck.c ++++ b/tuxpuck.c +@@ -250,7 +250,9 @@ static void _tuxpuck_init(void) + _settings->mouse_speed = 5; + #ifndef windows + homeDir = getenv("HOME"); +- sprintf(_settings_file, "%s/.tuxpuckrc", homeDir); ++ /* Buffer overflow fixed! ++ * sprintf(_settings_file, "%s/.tuxpuckrc", homeDir); */ ++ snprintf(_settings_file, sizeof(_settings_file)-1, "%s/.tuxpuckrc", homeDir); + #endif + _read_settings(); + audio_set_mute(!_settings->sound); diff --git a/games-arcade/tuxpuck/patches/clang-FTBFS.patch b/games-arcade/tuxpuck/patches/clang-FTBFS.patch new file mode 100644 index 000000000..f9449689c --- /dev/null +++ b/games-arcade/tuxpuck/patches/clang-FTBFS.patch @@ -0,0 +1,27 @@ +From: Alexander +Date: Sat, 5 Jul 2014 22:13:12 +0200 +Subject: clang FTBFS + +Fix a FTBFS with the clang compiler due to uninitialized variables in +ttf2font.c. + +Bug: https://bugs.debian.org/753064 +Forwarded: no +--- + utils/ttf2font.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/utils/ttf2font.c b/utils/ttf2font.c +index 01ce00a..5300708 100644 +--- a/utils/ttf2font.c ++++ b/utils/ttf2font.c +@@ -47,7 +47,8 @@ int main(int argc, char **argv) + { + FT_Library ftl; + FT_Face face; +- FT_UInt xsize, ysize; ++ FT_UInt xsize = 0; ++ FT_UInt ysize = 0; + unsigned char ch; + FILE *out = NULL; + diff --git a/games-arcade/tuxpuck/patches/cross.patch b/games-arcade/tuxpuck/patches/cross.patch new file mode 100644 index 000000000..e01883078 --- /dev/null +++ b/games-arcade/tuxpuck/patches/cross.patch @@ -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 + #include + #include + #include + #include +-#include +-#include + + 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 + #include + #include + #include +-#include +-#include + + 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 --git a/games-arcade/tuxpuck/patches/haiku.patch b/games-arcade/tuxpuck/patches/haiku.patch new file mode 100644 index 000000000..f3ecf79c8 --- /dev/null +++ b/games-arcade/tuxpuck/patches/haiku.patch @@ -0,0 +1,14 @@ +diff --git a/tuxpuck.h b/tuxpuck.h +index 4a68aae..3e48d81 100644 +--- a/tuxpuck.h ++++ b/tuxpuck.h +@@ -146,6 +146,9 @@ void sprite_erase(Sprite *); + Uint8 sprite_update(Sprite *, Uint32); + void sprite_set_position(Sprite *, Uint32, Uint32); + void sprite_set_animation(Sprite *, Uint8); ++#ifdef __HAIKU__ ++#define timer_create timer_create_tp ++#endif + Timer *timer_create(void); + void timer_free(Timer *); + void timer_reset(Timer *); diff --git a/games-arcade/tuxpuck/patches/libpng-transition.patch b/games-arcade/tuxpuck/patches/libpng-transition.patch new file mode 100644 index 000000000..1d3550151 --- /dev/null +++ b/games-arcade/tuxpuck/patches/libpng-transition.patch @@ -0,0 +1,114 @@ +From: Nobuhiro Iwamatsu +Date: Sat, 22 Mar 2014 21:05:02 +0100 +Subject: libpng transition + +Bug: https://bugs.debian.org/cgi-bin/649809 +Forwarded: no +--- + png.c | 38 ++++++++++++++++++++++++++++++++++---- + 1 file changed, 34 insertions(+), 4 deletions(-) + +diff --git a/png.c b/png.c +index c0c26bc..e4e96f1 100644 +--- a/png.c ++++ b/png.c +@@ -20,6 +20,15 @@ static void png_read_data(png_structp ctx, png_bytep area, png_size_t size) + SDL_RWread(src, area, size, 1); + } + ++#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4 ++static int my_png_get_channels(png_const_structp png_ptr, png_const_infop info_ptr) { ++ return png_get_channels(png_ptr, info_ptr); ++#else ++static int my_png_get_channels(png_structp png_ptr, png_infop info_ptr) { ++ return(info_ptr->channels); ++#endif ++} ++ + SDL_Surface *loadPNG(Uint8 * data, Uint32 * memcounter) + { + SDL_Surface *volatile surface; +@@ -38,6 +47,7 @@ SDL_Surface *loadPNG(Uint8 * data, Uint32 * memcounter) + png_color_16 *transv; + SDL_RWops *src = NULL; + Uint32 size; ++ int png_channels; + + memcpy(&size, data, sizeof(Uint32)); + if (memcounter) +@@ -74,7 +84,11 @@ SDL_Surface *loadPNG(Uint8 * data, Uint32 * memcounter) + * the normal method of doing things with libpng). REQUIRED unless you + * set up your own error handlers in png_create_read_struct() earlier. + */ ++#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4 ++ if (setjmp(png_jmpbuf(png_ptr))) { ++#else + if (setjmp(png_ptr->jmpbuf)) { ++#endif + SDL_SetError("Error reading the PNG file."); + goto done; + } +@@ -137,14 +151,15 @@ SDL_Surface *loadPNG(Uint8 * data, Uint32 * memcounter) + + /* Allocate the SDL surface to hold the image */ + Rmask = Gmask = Bmask = Amask = 0; ++ png_channels = my_png_get_channels(png_ptr, info_ptr); + if (color_type != PNG_COLOR_TYPE_PALETTE) { + if (SDL_BYTEORDER == SDL_LIL_ENDIAN) { + Rmask = 0x000000FF; + Gmask = 0x0000FF00; + Bmask = 0x00FF0000; +- Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0; ++ Amask = (png_channels == 4) ? 0xFF000000 : 0; + } else { +- int s = (info_ptr->channels == 4) ? 0 : 8; ++ int s = (png_channels == 4) ? 0 : 8; + Rmask = 0xFF000000 >> s; + Gmask = 0x00FF0000 >> s; + Bmask = 0x0000FF00 >> s; +@@ -152,7 +167,7 @@ SDL_Surface *loadPNG(Uint8 * data, Uint32 * memcounter) + } + } + surface = SDL_AllocSurface(SDL_SWSURFACE, width, height, +- bit_depth * info_ptr->channels, Rmask, Gmask, ++ bit_depth * png_channels, Rmask, Gmask, + Bmask, Amask); + if (surface == NULL) { + SDL_SetError("Out of memory"); +@@ -190,6 +205,11 @@ SDL_Surface *loadPNG(Uint8 * data, Uint32 * memcounter) + /* Load the palette, if any */ + palette = surface->format->palette; + if (palette) { ++#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4 ++ int num_palette; ++ png_colorp png_palette; ++ png_get_PLTE(png_ptr, info_ptr, &png_palette, &num_palette); ++#endif + if (color_type == PNG_COLOR_TYPE_GRAY) { + palette->ncolors = 256; + for (i = 0; i < 256; i++) { +@@ -197,13 +217,23 @@ SDL_Surface *loadPNG(Uint8 * data, Uint32 * memcounter) + palette->colors[i].g = i; + palette->colors[i].b = i; + } +- } else if (info_ptr->num_palette > 0) { ++#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4 ++ } else if (num_palette > 0) { ++ palette->ncolors = num_palette; ++ for (i = 0; i < num_palette; ++i) { ++ palette->colors[i].b = png_palette[i].blue; ++ palette->colors[i].g = png_palette[i].green; ++ palette->colors[i].r = png_palette[i].red; ++ } ++#else ++ } else if (info_ptr->num_palette > 0) { + palette->ncolors = info_ptr->num_palette; + for (i = 0; i < info_ptr->num_palette; ++i) { + palette->colors[i].b = info_ptr->palette[i].blue; + palette->colors[i].g = info_ptr->palette[i].green; + palette->colors[i].r = info_ptr->palette[i].red; + } ++#endif + } + } + diff --git a/games-arcade/tuxpuck/tuxpuck-0.8.2.recipe b/games-arcade/tuxpuck/tuxpuck-0.8.2.recipe new file mode 100644 index 000000000..e83ccbc02 --- /dev/null +++ b/games-arcade/tuxpuck/tuxpuck-0.8.2.recipe @@ -0,0 +1,59 @@ +SUMMARY="Airhockey with tux (Shufflepuck Café clone)" +DESCRIPTION="Open source Shufflepuck Café clone, with tux and arcana" +HOMEPAGE="https://wiki.debian.org/Games/TuxPuck" +COPYRIGHT="2000-2002 Jacob Kroon" +LICENSE="GNU GPL v2" +REVISION="1" +SOURCE_URI="http://ftp.de.debian.org/debian/pool/main/t/tuxpuck/tuxpuck_$portVersion.orig.tar.gz" +CHECKSUM_SHA256="62d9604ed69c27b9ca2be1312bc705b36de8ed509c539c6d81193e7846272f18" +SOURCE_DIR="tuxpuck-$portVersion" +PATCHES="buffer-overflow.patch + clang-FTBFS.patch + FTBFS-with-fread.patch + libpng-transition.patch + Makefile.patch + cross.patch + haiku.patch" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + tuxpuck$secondaryArchSuffix = $portVersion + app:TuxPuck = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libSDL_1.2$secondaryArchSuffix + lib:libfreetype$secondaryArchSuffix + lib:libjpeg$secondaryArchSuffix + lib:libpng16$secondaryArchSuffix + lib:libvorbis$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libSDL_1.2$secondaryArchSuffix + devel:libfreetype$secondaryArchSuffix + devel:libjpeg$secondaryArchSuffix + devel:libpng$secondaryArchSuffix + devel:libvorbis$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:gcc$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + " + +BUILD() +{ + make +} + +INSTALL() +{ + mkdir -p $appsDir $manDir/man6 + cp tuxpuck $appsDir/TuxPuck + cp man/tuxpuck.6.gz $manDir/man6 + addAppDeskbarSymlink $appsDir/TuxPuck +} \ No newline at end of file