zsnes: use Debian patches, fix segfault on saving state

This commit is contained in:
Nikolay Amiantov 2015-07-10 13:42:39 +03:00
parent c60ce5fa9b
commit 30facde98c
3 changed files with 23 additions and 100 deletions

View file

@ -1,4 +1,4 @@
{stdenv, fetchurl, nasm, SDL, zlib, libpng, ncurses, mesa}:
{stdenv, fetchurl, fetchpatch, nasm, SDL, zlib, libpng, ncurses, mesa}:
stdenv.mkDerivation {
name = "zsnes-1.51";
@ -8,12 +8,27 @@ stdenv.mkDerivation {
sha256 = "08s64qsxziv538vmfv38fg1rfrz5k95dss5zdkbfxsbjlbdxwmi8";
};
# copied from arch linux, fixes gcc-4.8 compatibility
patches = [ ./zsnes.patch ];
postPatch = ''
patch -p0 < ${./zsnes-1.51-libpng15.patch}
'';
patches = [ (fetchpatch {
url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/0003-gcc-4.3-ftbfs.patch";
sha256 = "1rlqjxnx21iz03414bamqrpysaxbvmfacfnk111233yxjd4vhq89";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/0009-hat-events.patch";
sha256 = "1az5vxjff22hqlsv0nmliax3ziwcr9kc75na805v9f66s8fmj5rf";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/0010-Fix-build-with-libpng-1.5.patch";
sha256 = "1vjfraxjw6f496j3w8r581m3lbn16s0nx3hskzj14hl9ycfskhnr";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/0012-Fix-build-with-gcc-4.7.patch";
sha256 = "1d8m0vxi8wf9z4wfjx2cc48p1wy2qadgvcm88dg1jncg334jwfrg";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/emillon/zsnes/fc160b2538738995f600f8405d23a66b070dac02/debian/patches/zsnes-linux-resume-freeze-fix.patch";
sha256 = "0gvf6gsqxxfah1s80ya2l5yils2kv9xa6faajdyby7xipzkc6qc7";
})
];
buildInputs = [ nasm SDL zlib libpng ncurses mesa ];
@ -22,7 +37,7 @@ stdenv.mkDerivation {
sed -i "/^STRIP/d" configure
'';
configureFlags = "--enable-release";
configureFlags = [ "--enable-release" ];
meta = {
description = "A Super Nintendo Entertainment System Emulator";

View file

@ -1,12 +0,0 @@
Use existing png_set_IHDR() and stop accessing PNG structure members directly
--- src/zip/zpng.c
+++ src/zip/zpng.c
@@ -129,7 +129,6 @@
png_set_IHDR(png_ptr, info_ptr, width, height, 8,
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
//Allocate an array of scanline pointers
row_pointers = (png_bytep*)malloc(height*sizeof(png_bytep));

View file

@ -1,80 +0,0 @@
diff -aur zsnes_1_51//src/Makefile.in zsnes_1_51_new//src/Makefile.in
--- zsnes_1_51//src/Makefile.in 2007-01-24 21:54:12.000000000 +0100
+++ zsnes_1_51_new//src/Makefile.in 2010-09-06 00:03:04.715810431 +0200
@@ -95,7 +95,7 @@
%.o: %.cpp
@CXX@ @CXXFLAGS@ -o $@ -c $<
%.o %.h: %.psr $(PSR)
- ./$(PSR) @PSRFLAGS@ -gcc @CC@ -compile -flags "@CFLAGS@ -O1" -cheader $*.h -fname $* $*.o $<
+ ./$(PSR) @PSRFLAGS@ -gcc "@CC@" -compile -flags "@CFLAGS@ -O1 -D_FORTIFY_SOURCE=0" -cheader $*.h -fname $* $*.o $<
default: main
all: main tools
@@ -133,7 +133,7 @@
include makefile.dep
makefile.dep: $(TOOL_D)/depbuild Makefile
- $(TOOL_D)/depbuild @CC@ "@CFLAGS@" @NASMPATH@ "@NFLAGS@" $(Z_OBJS) > makefile.dep
+ $(TOOL_D)/depbuild "@CC@" "@CFLAGS@" "@NASMPATH@" "@NFLAGS@" $(Z_OBJS) > makefile.dep
Makefile: Makefile.in config.status
./config.status
diff -aur zsnes_1_51//src/parsegen.cpp zsnes_1_51_new//src/parsegen.cpp
--- zsnes_1_51//src/parsegen.cpp 2007-10-31 05:30:26.000000000 +0100
+++ zsnes_1_51_new//src/parsegen.cpp 2010-09-05 15:48:36.903333444 +0200
@@ -19,6 +19,9 @@
Config file handler creator by Nach (C) 2005-2007
*/
+#include <cstring>
+#include <cstdlib>
+
#if !defined(__GNUC__) && !defined(_MSC_VER)
#error You are using an unsupported compiler
#endif
@@ -1822,7 +1825,7 @@
}
}
-int main(size_t argc, const char *const *const argv)
+int main(int argc, const char *const *const argv)
{
const char *cheader_file = 0;
bool compile = false;
diff -aur zsnes_1_51//src/tools/depbuild.cpp zsnes_1_51_new//src/tools/depbuild.cpp
--- zsnes_1_51//src/tools/depbuild.cpp 2006-12-27 12:04:05.000000000 +0100
+++ zsnes_1_51_new//src/tools/depbuild.cpp 2010-09-05 15:48:36.903333444 +0200
@@ -183,7 +183,7 @@
}
}
-int main(size_t argc, const char *const *const argv)
+int main(int argc, const char *const *const argv)
{
if (argc < 5)
{
diff -aur zsnes_1_51//src/tools/strutil.h zsnes_1_51_new//src/tools/strutil.h
--- zsnes_1_51//src/tools/strutil.h 2006-12-27 12:04:05.000000000 +0100
+++ zsnes_1_51_new//src/tools/strutil.h 2010-09-05 15:48:36.903333444 +0200
@@ -15,6 +15,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <cstring>
+#include <cstdlib>
+
/*
This is part of a toolkit used to assist in ZSNES development
*/
diff -u -r zsnes_1_51/src/tools/depbuild.cpp zsnes_1_51-fix/src/tools/depbuild.cpp
--- zsnes_1_51/src/tools/depbuild.cpp 2006-12-27 12:04:05.000000000 +0100
+++ zsnes_1_51-fix/src/tools/depbuild.cpp 2012-07-14 16:20:17.759886250 +0200
@@ -26,6 +26,8 @@
#include <cstdio>
using namespace std;
+#include <unistd.h>
+
#include "fileutil.h"
#include "strutil.h"