zsnes: patches for modern gcc & libpng
builds fine on stdenv-updates now needs gcc 4.8+, so keep this commit on stdenv-updates until merge
This commit is contained in:
parent
1772bcebc1
commit
ef3cc83d1e
@ -2,33 +2,27 @@
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "zsnes-1.51";
|
||||
|
||||
|
||||
src = fetchurl {
|
||||
url = mirror://sourceforge/zsnes/zsnes151src.tar.bz2;
|
||||
sha256 = "08s64qsxziv538vmfv38fg1rfrz5k95dss5zdkbfxsbjlbdxwmi8";
|
||||
};
|
||||
|
||||
buildInputs = [ nasm SDL zlib libpng ncurses mesa ];
|
||||
|
||||
# copied from arch linux, fixes gcc-4.8 compatibility
|
||||
patches = [ ./zsnes.patch ];
|
||||
|
||||
postPatch = ''
|
||||
patch -p0 < ${./zsnes-1.51-libpng15.patch}
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
cd src
|
||||
|
||||
# Fix for undefined strncasecmp()
|
||||
echo '#include <strings.h>' > tmp.cpp
|
||||
cat tmp.cpp tools/strutil.h > tools/strutil.h.new
|
||||
mv tools/strutil.h.new tools/strutil.h
|
||||
|
||||
# Fix for undefined system()
|
||||
echo '#include <stdlib.h>' > tmp.cpp
|
||||
cat tmp.cpp tools/depbuild.cpp > tools/depbuild.cpp.new
|
||||
mv tools/depbuild.cpp.new tools/depbuild.cpp
|
||||
|
||||
# Fix for lots of undefined strcmp, strncmp etc.
|
||||
echo '#include <string.h>' > tmp.cpp
|
||||
cat tmp.cpp parsegen.cpp > parsegen.cpp.new
|
||||
mv parsegen.cpp.new parsegen.cpp
|
||||
'';
|
||||
|
||||
|
||||
buildInputs = [ nasm SDL zlib libpng ncurses mesa ];
|
||||
|
||||
configureFlags = "--enable-release";
|
||||
|
||||
meta = {
|
||||
description = "A Super Nintendo Entertainment System Emulator";
|
||||
license = "GPLv2+";
|
||||
|
12
pkgs/misc/emulators/zsnes/zsnes-1.51-libpng15.patch
Normal file
12
pkgs/misc/emulators/zsnes/zsnes-1.51-libpng15.patch
Normal file
@ -0,0 +1,12 @@
|
||||
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));
|
80
pkgs/misc/emulators/zsnes/zsnes.patch
Normal file
80
pkgs/misc/emulators/zsnes/zsnes.patch
Normal file
@ -0,0 +1,80 @@
|
||||
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"
|
||||
|
@ -10130,9 +10130,7 @@ let
|
||||
|
||||
znc = callPackage ../applications/networking/znc { };
|
||||
|
||||
zsnes = callPackage_i686 ../misc/emulators/zsnes {
|
||||
libpng = libpng12;
|
||||
};
|
||||
zsnes = callPackage_i686 ../misc/emulators/zsnes { };
|
||||
|
||||
misc = import ../misc/misc.nix { inherit pkgs stdenv; };
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user