git.iko.soy/typeable/nixpkgs
on master help sign in
nestopia: 1.46.2 -> 1.47
commit7d54467ad0fbe16f2ef9690a13e77631471d5e15 authorSamuel Leathers <sam@appliedtrust.com> dateSun 3 Sep 2017, 08:22 (9 years ago) parent35f8941
2 files changed+129−9
pkgs/misc/emulators/nestopia/default.nix+37−9 pkgs/misc/emulators/nestopia/gcc6.patch+92
pkgs/misc/emulators/nestopia/default.nix+37−9
@@ -1,11 +1,17 @@
1−{ stdenv, fetchurl, pkgconfig, SDL2, alsaLib, gtk3, mesa_glu, makeWrapper
2−, mesa, libarchive, libao, unzip, xdg_utils, gsettings_desktop_schemas }:
1+{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig, SDL2, alsaLib, gtk3, mesa_glu,
2+ makeWrapper, mesa, libarchive, libao, unzip, xdg_utils, gsettings_desktop_schemas,
3+ epoxy, gdk_pixbuf
4+}:
35
46stdenv.mkDerivation rec {
5− name = "nestopia-1.46.2";
6− src = fetchurl {
7− url = https://github.com/rdanbrook/nestopia/archive/1.46.2.tar.gz;
8− sha256 = "07h49xwvg61dx20rk5p4r3ax2ar5y0ppvm60cqwqljyi9rdfbh7p";
7+ version = "1.47";
8+ name = "nestopia-${version}";
9+
10+ src = fetchFromGitHub {
11+ owner = "rdanbrook";
12+ repo = "nestopia";
13+ rev = "${version}";
14+ sha256 = "0frr0gvjh5mxzdhj0ii3sh671slgnzlm8naqlc4h87rx4p4sz2y2";
915 };
1016
1117 # nondeterministic failures when creating directories
@@ -13,8 +19,22 @@ stdenv.mkDerivation rec {
1319
1420 hardeningDisable = [ "format" ];
1521
16− buildInputs = [ pkgconfig SDL2 alsaLib gtk3 mesa_glu mesa makeWrapper
17− libarchive libao unzip xdg_utils gsettings_desktop_schemas ];
22+ buildInputs = [
23+ pkgconfig
24+ SDL2
25+ alsaLib
26+ epoxy
27+ gtk3
28+ gdk_pixbuf
29+ mesa_glu
30+ mesa
31+ makeWrapper
32+ libarchive
33+ libao
34+ unzip
35+ xdg_utils
36+ gsettings_desktop_schemas
37+ ];
1838
1939 installPhase = ''
2040 mkdir -p $out/{bin,share/nestopia}
@@ -28,7 +48,15 @@ stdenv.mkDerivation rec {
2848 done
2949 '';
3050
31− patches = [ ./build-fix.patch ];
51+ patches = [
52+ #(fetchpatch {
53+ # url = "https://github.com/rdanbrook/nestopia/commit/f4bc74ac4954328b25e961e7afb7337377084079.patch";
54+ # name = "gcc6.patch";
55+ # sha256 = "1jy0c85xsfk9hrv5a6v0kk48d94864qb62yyni9fp93kyl33y2p4";
56+ #})
57+ ./gcc6.patch
58+ ./build-fix.patch
59+ ];
3260
3361 meta = {
3462 homepage = http://0ldsk00l.ca/nestopia/;
pkgs/misc/emulators/nestopia/gcc6.patchnew file+92
@@ -0,0 +1,92 @@
1+From f4bc74ac4954328b25e961e7afb7337377084079 Mon Sep 17 00:00:00 2001
2+From: David Seifert <soap@gentoo.org>
3+Date: Sat, 31 Dec 2016 18:21:18 +0200
4+Subject: [PATCH] Fix compiling in C++14 mode
5+
6+* Left shifting a negative signed is undefined behaviour
7+* Fix incorrect printf() specifiers found with -Wformat
8+---
9+ source/core/NstCore.hpp | 4 ++--
10+ source/unix/gtkui/gtkui.cpp | 2 +-
11+ source/unix/gtkui/gtkui.h | 1 -
12+ source/unix/gtkui/gtkui_cheats.cpp | 8 ++++----
13+ source/unix/video.cpp | 2 +-
14+ 5 files changed, 8 insertions(+), 9 deletions(-)
15+
16+diff --git a/source/core/NstCore.hpp b/source/core/NstCore.hpp
17+index 50e20f6..420cc4a 100644
18+--- a/source/core/NstCore.hpp
19++++ b/source/core/NstCore.hpp
20+@@ -279,14 +279,14 @@ namespace Nes
21+ template<typename T>
22+ inline long signed_shl(T v,uint c)
23+ {
24+- enum {NATIVE = T(-7) << 1 == -14};
25++ enum {NATIVE = -(T(7) << 1) == -14};
26+ return Helper::ShiftSigned<T,NATIVE>::Left( v, c );
27+ }
28+
29+ template<typename T>
30+ inline long signed_shr(T v,uint c)
31+ {
32+- enum {NATIVE = T(-7) >> 1 == -4 || T(-7) >> 1 == -3};
33++ enum {NATIVE = -(T(7) >> 1) == -4 || -(T(7) >> 1) == -3};
34+ return Helper::ShiftSigned<T,NATIVE>::Right( v, c );
35+ }
36+
37+diff --git a/source/unix/gtkui/gtkui.cpp b/source/unix/gtkui/gtkui.cpp
38+index 3cfeeab..d4a5e2d 100644
39+--- a/source/unix/gtkui/gtkui.cpp
40++++ b/source/unix/gtkui/gtkui.cpp
41+@@ -438,7 +438,7 @@ void gtkui_message(const char* message) {
42+ GTK_DIALOG_DESTROY_WITH_PARENT,
43+ GTK_MESSAGE_INFO,
44+ GTK_BUTTONS_OK,
45+- message);
46++ "%s", message);
47+ gtk_dialog_run(GTK_DIALOG(messagewindow));
48+ gtk_widget_destroy(messagewindow);
49+ }
50+diff --git a/source/unix/gtkui/gtkui_cheats.cpp b/source/unix/gtkui/gtkui_cheats.cpp
51+index afc01b0..e7b691a 100644
52+--- a/source/unix/gtkui/gtkui_cheats.cpp
53++++ b/source/unix/gtkui/gtkui_cheats.cpp
54+@@ -373,7 +373,7 @@ void gtkui_cheats_fill_tree(char *filename) {
55+ else if (node.GetChild(L"address")) { // Raw
56+ char rawbuf[11];
57+ snprintf(rawbuf, sizeof(rawbuf),
58+- "%04x %02x %02x",
59++ "%04lu %02lu %02lu",
60+ node.GetChild(L"address").GetUnsignedValue(),
61+ node.GetChild(L"value").GetUnsignedValue(),
62+ node.GetChild(L"compare").GetUnsignedValue());
63+@@ -545,13 +545,13 @@ gboolean gtkui_cheats_scan_list(GtkTreeModel *model, GtkTreePath *path, GtkTreeI
64+ int addr, value, compare;
65+ char buf[5];
66+
67+- snprintf(buf, sizeof(buf), "%c%c%c%c\0", rawcode[0], rawcode[1], rawcode[2], rawcode[3]);
68++ snprintf(buf, sizeof(buf), "%c%c%c%c", rawcode[0], rawcode[1], rawcode[2], rawcode[3]);
69+ sscanf(buf, "%x", &addr);
70+
71+- snprintf(buf, sizeof(buf), "%c%c\0", rawcode[5], rawcode[6]);
72++ snprintf(buf, sizeof(buf), "%c%c", rawcode[5], rawcode[6]);
73+ sscanf(buf, "%x", &value);
74+
75+- snprintf(buf, sizeof(buf), "%c%c\0", rawcode[8], rawcode[9]);
76++ snprintf(buf, sizeof(buf), "%c%c", rawcode[8], rawcode[9]);
77+ sscanf(buf, "%x", &compare);
78+
79+ code.address = addr;
80+diff --git a/source/unix/video.cpp b/source/unix/video.cpp
81+index 3eff19d..c34bb22 100644
82+--- a/source/unix/video.cpp
83++++ b/source/unix/video.cpp
84+@@ -757,7 +757,7 @@ void video_screenshot(const char* filename) {
85+ if (filename == NULL) {
86+ // Set the filename
87+ char sshotpath[512];
88+- snprintf(sshotpath, sizeof(sshotpath), "%sscreenshots/%s-%d-%d.png", nstpaths.nstdir, nstpaths.gamename, time(NULL), rand() % 899 + 100);
89++ snprintf(sshotpath, sizeof(sshotpath), "%sscreenshots/%s-%ld-%d.png", nstpaths.nstdir, nstpaths.gamename, time(NULL), rand() % 899 + 100);
90+
91+ // Save the file
92+ lodepng_encode32_file(sshotpath, (const unsigned char*)pixels, rendersize.w, rendersize.h);