diff options
author | Luca D'Amico | 2023-05-12 16:26:59 +0200 |
---|---|---|
committer | Luca D'Amico | 2023-05-12 16:26:59 +0200 |
commit | 749b1599fea4d3707de38c4abfb8edcbe3be9f9b (patch) | |
tree | 839f00157e20a0e1824ece32c85bd2def361206f | |
parent | 127a3947e47d4126690bd826233ec377d1ecfc4e (diff) | |
download | aur-tuxpuck.tar.gz |
updated to latest version
-rw-r--r-- | .SRCINFO | 27 | ||||
-rw-r--r-- | FTBFS-with-fread.patch | 27 | ||||
-rw-r--r-- | Makefile.patch | 77 | ||||
-rw-r--r-- | PKGBUILD | 66 | ||||
-rw-r--r-- | buffer-overflow.patch | 25 | ||||
-rw-r--r-- | clang-FTBFS.patch | 27 | ||||
-rw-r--r-- | cross.patch | 155 | ||||
-rw-r--r-- | install_path.patch | 12 | ||||
-rw-r--r-- | libpng-transition.patch | 114 | ||||
-rw-r--r-- | tuxpuck-0.8.2-ldflags.patch | 11 | ||||
-rw-r--r-- | tuxpuck-0.8.2-libpng15.patch | 63 | ||||
-rw-r--r-- | tuxpuck.desktop | 11 |
12 files changed, 513 insertions, 102 deletions
@@ -1,8 +1,8 @@ pkgbase = tuxpuck - pkgdesc = Airhockey with tux (Shufflepuck Cafe clone) + pkgdesc = Airhockey with tux (Shufflepuck Café clone) pkgver = 0.8.2 - pkgrel = 6 - url = http://home.no.net/munsuun/tuxpuck/ + pkgrel = 12 + url = https://wiki.debian.org/Games/TuxPuck arch = i686 arch = x86_64 license = GPL2 @@ -13,11 +13,22 @@ pkgbase = tuxpuck depends = libvorbis options = !makeflags source = http://ftp.de.debian.org/debian/pool/main/t/tuxpuck/tuxpuck_0.8.2.orig.tar.gz - source = tuxpuck-0.8.2-ldflags.patch - source = tuxpuck-0.8.2-libpng15.patch + source = buffer-overflow.patch + source = clang-FTBFS.patch + source = cross.patch + source = FTBFS-with-fread.patch + source = libpng-transition.patch + source = Makefile.patch + source = install_path.patch + source = tuxpuck.desktop sha256sums = 62d9604ed69c27b9ca2be1312bc705b36de8ed509c539c6d81193e7846272f18 - sha256sums = 0a5f8610ef0001b5c98834f850ec9a3ade5437703ea04cb363f7cc6f5b39fec5 - sha256sums = cf9a3a51876fd00e1b4fd34afe1ca79763facd6b0326628186b342da0fd9b68f + sha256sums = 85435a4217f768bc7077afc0b651f180b8de675c67a3910724a59c95012e9293 + sha256sums = e9d6221c7c789880316f7b3e78574b40ebb9e953bb88410d7d5e9a3ac0868b6b + sha256sums = 93ef7e07638b4dcbae30cda092f8b81df1167c1daafd1aa239ad3cb2ed44c1a0 + sha256sums = 03ffd5ba4be212371e6b084c36be42531db878b7d89bf20a051462f6473bd17b + sha256sums = 0b2244747334a0821d78df9b8fe527e9ff669ea9f817600d1b5a3a4d32839c9b + sha256sums = ccbb2943c25b829c1632562bd8d7aab5b3cdfd25b0697f61b9a373e524182c36 + sha256sums = 6802e51447313ef46c7152b8ee007ccd42146386fcd0e53457021f8fe2422be3 + sha256sums = ce77a401f5dfc4904050f3d3b1ae3d7b9511cb5ecb2bdb28be719c0f78cb20bf pkgname = tuxpuck - diff --git a/FTBFS-with-fread.patch b/FTBFS-with-fread.patch new file mode 100644 index 000000000000..cb572b8b5644 --- /dev/null +++ b/FTBFS-with-fread.patch @@ -0,0 +1,27 @@ +From: Ilya Barygin <barygin@gmail.com> +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/Makefile.patch b/Makefile.patch new file mode 100644 index 000000000000..7b29a4943d87 --- /dev/null +++ b/Makefile.patch @@ -0,0 +1,77 @@ +From: Markus Koschany <apo@debian.org> +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 @@ -1,37 +1,61 @@ -# Maintainer: carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG +# Maintainer: Luca D'Amico <damico.luca91@live.it> +# Contributor: carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG # Contributor: Tobias Powalowski <tpowa@archlinux.org> # Contributor: Andrea Scarpino <andrea@archlinux.org> pkgname=tuxpuck pkgver=0.8.2 -pkgrel=6 -pkgdesc="Airhockey with tux (Shufflepuck Cafe clone)" +pkgrel=12 +pkgdesc="Airhockey with tux (Shufflepuck Café clone)" arch=('i686' 'x86_64') -url="http://home.no.net/munsuun/tuxpuck/" +url="https://wiki.debian.org/Games/TuxPuck" license=('GPL2') depends=('libjpeg' 'sdl' 'libpng' 'libvorbis') makedepends=('freetype2') options=('!makeflags') source=("http://ftp.de.debian.org/debian/pool/main/t/${pkgname}/${pkgname}_$pkgver.orig.tar.gz" - "$pkgname-$pkgver-ldflags.patch" - "$pkgname-$pkgver-libpng15.patch") + "buffer-overflow.patch" + "clang-FTBFS.patch" + "cross.patch" + "FTBFS-with-fread.patch" + "libpng-transition.patch" + "Makefile.patch" + "install_path.patch" + "tuxpuck.desktop") sha256sums=('62d9604ed69c27b9ca2be1312bc705b36de8ed509c539c6d81193e7846272f18' - '0a5f8610ef0001b5c98834f850ec9a3ade5437703ea04cb363f7cc6f5b39fec5' - 'cf9a3a51876fd00e1b4fd34afe1ca79763facd6b0326628186b342da0fd9b68f') + '85435a4217f768bc7077afc0b651f180b8de675c67a3910724a59c95012e9293' + 'e9d6221c7c789880316f7b3e78574b40ebb9e953bb88410d7d5e9a3ac0868b6b' + '93ef7e07638b4dcbae30cda092f8b81df1167c1daafd1aa239ad3cb2ed44c1a0' + '03ffd5ba4be212371e6b084c36be42531db878b7d89bf20a051462f6473bd17b' + '0b2244747334a0821d78df9b8fe527e9ff669ea9f817600d1b5a3a4d32839c9b' + 'ccbb2943c25b829c1632562bd8d7aab5b3cdfd25b0697f61b9a373e524182c36' + '6802e51447313ef46c7152b8ee007ccd42146386fcd0e53457021f8fe2422be3' + 'd07d5a1d3b6278e0794371e3a3baf860fe36ae0b4b220aeaa4175381399a95c3') prepare() { cd $pkgname-$pkgver - - # fix path - sed 's|usr/man|usr/share/man|' -i Makefile - # do not abort on error - sed 's/-Werror//' -i utils/Makefile - # do not use hardcoded gcc binary - sed '/^CC/d' -i Makefile utils/Makefile data/Makefile - # add our ldflags - patch -Np0 < ../$pkgname-$pkgver-ldflags.patch - # allow building with newer libpng - patch -Np0 < ../$pkgname-$pkgver-libpng15.patch + + # buffer overflow fix patch + echo "Applying buffer overflow fix patch" + patch -Np1 < ../buffer-overflow.patch + # clang FTBFS fix patch + echo "Applying clang FTBFS fix patch" + patch -Np1 < ../clang-FTBFS.patch + # FTBFS with fread fix patch + echo "Applying FTBFS with fread fix patch" + patch -Np1 < ../FTBFS-with-fread.patch + # libpng patch + echo "Applying libpng patch" + patch -Np1 < ../libpng-transition.patch + # Makefile patch + echo "Applying akefile patch" + patch -Np1 < ../Makefile.patch + # cross patch + echo "Applying cross patch" + patch -Np1 < ../cross.patch + # install path patch + echo "Applying install path patch" + patch -Np0 < ../install_path.patch } build() { @@ -40,4 +64,6 @@ build() { package() { make -C $pkgname-$pkgver DESTDIR="$pkgdir/" install -} + install -D -m 644 tuxpuck.desktop $pkgdir/usr/share/applications/tuxpuck.desktop + install -D -m 644 $pkgname-$pkgver/data/icons/tuxpuck.ico $pkgdir/usr/share/pixmaps/tuxpuck.ico +} diff --git a/buffer-overflow.patch b/buffer-overflow.patch new file mode 100644 index 000000000000..cc60be52fbed --- /dev/null +++ b/buffer-overflow.patch @@ -0,0 +1,25 @@ +From: Steve Kemp <skx@debian.org> +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/clang-FTBFS.patch b/clang-FTBFS.patch new file mode 100644 index 000000000000..f9449689c698 --- /dev/null +++ b/clang-FTBFS.patch @@ -0,0 +1,27 @@ +From: Alexander <sanek23994@gmail.com> +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/cross.patch b/cross.patch new file mode 100644 index 000000000000..e01883078701 --- /dev/null +++ b/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 <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 --git a/install_path.patch b/install_path.patch new file mode 100644 index 000000000000..e9d8a4f70e79 --- /dev/null +++ b/install_path.patch @@ -0,0 +1,12 @@ +--- Makefile.orig 2023-05-12 15:13:18.154870777 +0200 ++++ Makefile 2023-05-12 15:27:01.299659718 +0200 +@@ -52,7 +52,7 @@ + rm -Rf $(NAME)-$(VERSION) + + install : $(NAME) +- install -d $(DESTDIR)/usr/games ++ install -d $(DESTDIR)/usr/bin + install -d $(DESTDIR)/usr/share/man/man6 +- install -m755 $(NAME) $(DESTDIR)/usr/games ++ install -m755 $(NAME) $(DESTDIR)/usr/bin + install -m644 man/$(NAME).6.gz $(DESTDIR)/usr/share/man/man6 diff --git a/libpng-transition.patch b/libpng-transition.patch new file mode 100644 index 000000000000..1d355015128a --- /dev/null +++ b/libpng-transition.patch @@ -0,0 +1,114 @@ +From: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> +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/tuxpuck-0.8.2-ldflags.patch b/tuxpuck-0.8.2-ldflags.patch deleted file mode 100644 index 28fcef48a7ec..000000000000 --- a/tuxpuck-0.8.2-ldflags.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Makefile.old 2010-10-05 10:34:57.000000000 +0200 -+++ Makefile 2010-10-05 10:35:28.000000000 +0200 -@@ -20,7 +20,7 @@ - - $(NAME) : $(OBJS) - cd data; $(MAKE) -- $(CC) $(CFLAGS) $(OBJS) data/libdata.a `sdl-config --libs` -lm -lpng \ -+ $(CC) $(LDFLAGS) $(CFLAGS) $(OBJS) data/libdata.a `sdl-config --libs` -lm -lpng \ - -ljpeg -lz -lvorbisfile -lvorbis -logg -o $(NAME) - - w32icon.o : data/icons/tuxpuck.ico diff --git a/tuxpuck-0.8.2-libpng15.patch b/tuxpuck-0.8.2-libpng15.patch deleted file mode 100644 index ca9539f39e51..000000000000 --- a/tuxpuck-0.8.2-libpng15.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- png.c.old 2011-09-14 16:25:54.415338149 +0200 -+++ png.c 2011-09-14 17:41:02.190803110 +0200 -@@ -38,6 +38,8 @@ - png_color_16 *transv; - SDL_RWops *src = NULL; - Uint32 size; -+ int num_palette; -+ png_colorp png_palette; - - memcpy(&size, data, sizeof(Uint32)); - if (memcounter) -@@ -74,7 +76,7 @@ - * the normal method of doing things with libpng). REQUIRED unless you - * set up your own error handlers in png_create_read_struct() earlier. - */ -- if (setjmp(png_ptr->jmpbuf)) { -+ if (setjmp(png_jmpbuf(png_ptr))) { - SDL_SetError("Error reading the PNG file."); - goto done; - } -@@ -142,9 +144,9 @@ - Rmask = 0x000000FF; - Gmask = 0x0000FF00; - Bmask = 0x00FF0000; -- Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0; -+ Amask = (png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0; - } else { -- int s = (info_ptr->channels == 4) ? 0 : 8; -+ int s = (png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8; - Rmask = 0xFF000000 >> s; - Gmask = 0x00FF0000 >> s; - Bmask = 0x0000FF00 >> s; -@@ -152,7 +154,7 @@ - } - } - surface = SDL_AllocSurface(SDL_SWSURFACE, width, height, -- bit_depth * info_ptr->channels, Rmask, Gmask, -+ bit_depth * png_get_channels(png_ptr, info_ptr), Rmask, Gmask, - Bmask, Amask); - if (surface == NULL) { - SDL_SetError("Out of memory"); -@@ -197,12 +199,15 @@ - palette->colors[i].g = i; - palette->colors[i].b = i; - } -- } 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; -+ } else { -+ png_get_PLTE(png_ptr, info_ptr, &png_palette, &num_palette); -+ 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; -+ } - } - } - } diff --git a/tuxpuck.desktop b/tuxpuck.desktop new file mode 100644 index 000000000000..7d64f58d016b --- /dev/null +++ b/tuxpuck.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=TuxPuck +GenericName=TuxPuck +Comment=Airhockey with tux (Shufflepuck Café clone) +Exec=/usr/bin/tuxpuck +Icon=/usr/share/pixmaps/tuxpuck.ico +StartupNotify=true +Terminal=false +Type=Application +Categories=Application;Game; |