git.iko.soy/typeable/nixpkgs
on master help sign in
zsnes: use Debian patches, fix segfault on saving state
commit30facde98c9e1b7a5d27a11d7eb0c87cbc8cbd1a authorNikolay Amiantov <ab@fmap.me> dateFri 10 Jul 2015, 13:42 (11 years ago) parentc60ce5f
3 files changed+23−100
pkgs/misc/emulators/zsnes/default.nix+23−8 pkgs/misc/emulators/zsnes/zsnes-1.51-libpng15.patch−12 pkgs/misc/emulators/zsnes/zsnes.patch−80
pkgs/misc/emulators/zsnes/default.nix+23−8
@@ -1,4 +1,4 @@
1−{stdenv, fetchurl, nasm, SDL, zlib, libpng, ncurses, mesa}:
1+{stdenv, fetchurl, fetchpatch, nasm, SDL, zlib, libpng, ncurses, mesa}:
22
33stdenv.mkDerivation {
44 name = "zsnes-1.51";
@@ -8,12 +8,27 @@ stdenv.mkDerivation {
88 sha256 = "08s64qsxziv538vmfv38fg1rfrz5k95dss5zdkbfxsbjlbdxwmi8";
99 };
1010
11− # copied from arch linux, fixes gcc-4.8 compatibility
12− patches = [ ./zsnes.patch ];
13−
14− postPatch = ''
15− patch -p0 < ${./zsnes-1.51-libpng15.patch}
16− '';
11+ patches = [ (fetchpatch {
12+ url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/0003-gcc-4.3-ftbfs.patch";
13+ sha256 = "1rlqjxnx21iz03414bamqrpysaxbvmfacfnk111233yxjd4vhq89";
14+ })
15+ (fetchpatch {
16+ url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/0009-hat-events.patch";
17+ sha256 = "1az5vxjff22hqlsv0nmliax3ziwcr9kc75na805v9f66s8fmj5rf";
18+ })
19+ (fetchpatch {
20+ url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/0010-Fix-build-with-libpng-1.5.patch";
21+ sha256 = "1vjfraxjw6f496j3w8r581m3lbn16s0nx3hskzj14hl9ycfskhnr";
22+ })
23+ (fetchpatch {
24+ url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/0012-Fix-build-with-gcc-4.7.patch";
25+ sha256 = "1d8m0vxi8wf9z4wfjx2cc48p1wy2qadgvcm88dg1jncg334jwfrg";
26+ })
27+ (fetchpatch {
28+ url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/zsnes-linux-resume-freeze-fix.patch";
29+ sha256 = "0gvf6gsqxxfah1s80ya2l5yils2kv9xa6faajdyby7xipzkc6qc7";
30+ })
31+ ];
1732
1833 buildInputs = [ nasm SDL zlib libpng ncurses mesa ];
1934
@@ -22,7 +37,7 @@ stdenv.mkDerivation {
2237 sed -i "/^STRIP/d" configure
2338 '';
2439
25− configureFlags = "--enable-release";
40+ configureFlags = [ "--enable-release" ];
2641
2742 meta = {
2843 description = "A Super Nintendo Entertainment System Emulator";
pkgs/misc/emulators/zsnes/zsnes-1.51-libpng15.patchdeleted−12
@@ -1,12 +0,0 @@
1−Use existing png_set_IHDR() and stop accessing PNG structure members directly
2−
3−--- src/zip/zpng.c
4−+++ src/zip/zpng.c
5−@@ -129,7 +129,6 @@
6− png_set_IHDR(png_ptr, info_ptr, width, height, 8,
7− PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
8− PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
9−- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
10−
11− //Allocate an array of scanline pointers
12− row_pointers = (png_bytep*)malloc(height*sizeof(png_bytep));
pkgs/misc/emulators/zsnes/zsnes.patchdeleted−80
@@ -1,80 +0,0 @@
1−diff -aur zsnes_1_51//src/Makefile.in zsnes_1_51_new//src/Makefile.in
2−--- zsnes_1_51//src/Makefile.in 2007-01-24 21:54:12.000000000 +0100
3−+++ zsnes_1_51_new//src/Makefile.in 2010-09-06 00:03:04.715810431 +0200
4−@@ -95,7 +95,7 @@
5− %.o: %.cpp
6− @CXX@ @CXXFLAGS@ -o $@ -c $<
7− %.o %.h: %.psr $(PSR)
8−- ./$(PSR) @PSRFLAGS@ -gcc @CC@ -compile -flags "@CFLAGS@ -O1" -cheader $*.h -fname $* $*.o $<
9−+ ./$(PSR) @PSRFLAGS@ -gcc "@CC@" -compile -flags "@CFLAGS@ -O1 -D_FORTIFY_SOURCE=0" -cheader $*.h -fname $* $*.o $<
10−
11− default: main
12− all: main tools
13−@@ -133,7 +133,7 @@
14−
15− include makefile.dep
16− makefile.dep: $(TOOL_D)/depbuild Makefile
17−- $(TOOL_D)/depbuild @CC@ "@CFLAGS@" @NASMPATH@ "@NFLAGS@" $(Z_OBJS) > makefile.dep
18−+ $(TOOL_D)/depbuild "@CC@" "@CFLAGS@" "@NASMPATH@" "@NFLAGS@" $(Z_OBJS) > makefile.dep
19−
20− Makefile: Makefile.in config.status
21− ./config.status
22−diff -aur zsnes_1_51//src/parsegen.cpp zsnes_1_51_new//src/parsegen.cpp
23−--- zsnes_1_51//src/parsegen.cpp 2007-10-31 05:30:26.000000000 +0100
24−+++ zsnes_1_51_new//src/parsegen.cpp 2010-09-05 15:48:36.903333444 +0200
25−@@ -19,6 +19,9 @@
26− Config file handler creator by Nach (C) 2005-2007
27− */
28−
29−+#include <cstring>
30−+#include <cstdlib>
31−+
32− #if !defined(__GNUC__) && !defined(_MSC_VER)
33− #error You are using an unsupported compiler
34− #endif
35−@@ -1822,7 +1825,7 @@
36− }
37− }
38−
39−-int main(size_t argc, const char *const *const argv)
40−+int main(int argc, const char *const *const argv)
41− {
42− const char *cheader_file = 0;
43− bool compile = false;
44−diff -aur zsnes_1_51//src/tools/depbuild.cpp zsnes_1_51_new//src/tools/depbuild.cpp
45−--- zsnes_1_51//src/tools/depbuild.cpp 2006-12-27 12:04:05.000000000 +0100
46−+++ zsnes_1_51_new//src/tools/depbuild.cpp 2010-09-05 15:48:36.903333444 +0200
47−@@ -183,7 +183,7 @@
48− }
49− }
50−
51−-int main(size_t argc, const char *const *const argv)
52−+int main(int argc, const char *const *const argv)
53− {
54− if (argc < 5)
55− {
56−diff -aur zsnes_1_51//src/tools/strutil.h zsnes_1_51_new//src/tools/strutil.h
57−--- zsnes_1_51//src/tools/strutil.h 2006-12-27 12:04:05.000000000 +0100
58−+++ zsnes_1_51_new//src/tools/strutil.h 2010-09-05 15:48:36.903333444 +0200
59−@@ -15,6 +15,9 @@
60− Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
61− */
62−
63−+#include <cstring>
64−+#include <cstdlib>
65−+
66− /*
67− This is part of a toolkit used to assist in ZSNES development
68− */
69−diff -u -r zsnes_1_51/src/tools/depbuild.cpp zsnes_1_51-fix/src/tools/depbuild.cpp
70−--- zsnes_1_51/src/tools/depbuild.cpp 2006-12-27 12:04:05.000000000 +0100
71−+++ zsnes_1_51-fix/src/tools/depbuild.cpp 2012-07-14 16:20:17.759886250 +0200
72−@@ -26,6 +26,8 @@
73− #include <cstdio>
74− using namespace std;
75−
76−+#include <unistd.h>
77−+
78− #include "fileutil.h"
79− #include "strutil.h"
80−