git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #28930 from disassembler/nestopia

nestopia: 1.46.2 -> 1.47

commit52c99ad6164907c8d235030663de1c5d1ed40478 authorJörg Thalheim <Mic92@users.noreply.github.com> dateSun 3 Sep 2017, 17:13 (9 years ago) parentc8c0cd44b10de8
2 files changed+133−9
pkgs/misc/emulators/nestopia/default.nix+41−9 pkgs/misc/emulators/nestopia/gcc6.patch+92
pkgs/misc/emulators/nestopia/default.nix+41−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, gnome3, wrapGAppsHook
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,26 @@ 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+ SDL2
24+ alsaLib
25+ epoxy
26+ gtk3
27+ gdk_pixbuf
28+ mesa_glu
29+ mesa
30+ libarchive
31+ libao
32+ unzip
33+ xdg_utils
34+ gnome3.adwaita-icon-theme
35+ ];
36+
37+ nativeBuildInputs = [
38+ pkgconfig
39+ makeWrapper
40+ wrapGAppsHook
41+ ];
1842
1943 installPhase = ''
2044 mkdir -p $out/{bin,share/nestopia}
@@ -28,7 +52,15 @@ stdenv.mkDerivation rec {
2852 done
2953 '';
3054
31− patches = [ ./build-fix.patch ];
55+ patches = [
56+ #(fetchpatch {
57+ # url = "https://github.com/rdanbrook/nestopia/commit/f4bc74ac4954328b25e961e7afb7337377084079.patch";
58+ # name = "gcc6.patch";
59+ # sha256 = "1jy0c85xsfk9hrv5a6v0kk48d94864qb62yyni9fp93kyl33y2p4";
60+ #})
61+ ./gcc6.patch
62+ ./build-fix.patch
63+ ];
3264
3365 meta = {
3466 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);