From 48c78f89914e26505830e1dfe13d5b461946f509 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Wed, 24 Jan 2024 15:30:46 -0300 Subject: [PATCH 1/2] nestopia-ue: migrate to by-name --- .../nestopia => by-name/ne/nestopia-ue}/build-fix.patch | 0 .../emulators/nestopia => by-name/ne/nestopia-ue}/gcc6.patch | 0 .../nestopia/default.nix => by-name/ne/nestopia-ue/package.nix} | 0 pkgs/top-level/aliases.nix | 2 +- pkgs/top-level/all-packages.nix | 2 -- 5 files changed, 1 insertion(+), 3 deletions(-) rename pkgs/{applications/emulators/nestopia => by-name/ne/nestopia-ue}/build-fix.patch (100%) rename pkgs/{applications/emulators/nestopia => by-name/ne/nestopia-ue}/gcc6.patch (100%) rename pkgs/{applications/emulators/nestopia/default.nix => by-name/ne/nestopia-ue/package.nix} (100%) diff --git a/pkgs/applications/emulators/nestopia/build-fix.patch b/pkgs/by-name/ne/nestopia-ue/build-fix.patch similarity index 100% rename from pkgs/applications/emulators/nestopia/build-fix.patch rename to pkgs/by-name/ne/nestopia-ue/build-fix.patch diff --git a/pkgs/applications/emulators/nestopia/gcc6.patch b/pkgs/by-name/ne/nestopia-ue/gcc6.patch similarity index 100% rename from pkgs/applications/emulators/nestopia/gcc6.patch rename to pkgs/by-name/ne/nestopia-ue/gcc6.patch diff --git a/pkgs/applications/emulators/nestopia/default.nix b/pkgs/by-name/ne/nestopia-ue/package.nix similarity index 100% rename from pkgs/applications/emulators/nestopia/default.nix rename to pkgs/by-name/ne/nestopia-ue/package.nix diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 98c3c66e780f..cada874a211e 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -685,7 +685,7 @@ mapAliases ({ ### N ### ncdu_2 = ncdu; # Added 2022-07-22 - + nestopia = throw "nestopia was forked; use nestopia-ue instead"; # Added 2024-01-24 net_snmp = throw "'net_snmp' has been renamed to/replaced by 'net-snmp'"; # Converted to throw 2023-09-10 netbox_3_3 = throw "netbox 3.3 series has been removed as it was EOL"; # Added 2023-09-02 netbox_3_5 = throw "netbox 3.5 series has been removed as it was EOL"; # Added 2024-01-22 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 32b6cc46bb5d..71eaac46c8d0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2780,8 +2780,6 @@ with pkgs; mupen64plus = callPackage ../applications/emulators/mupen64plus { }; - nestopia = callPackage ../applications/emulators/nestopia { }; - np2kai = callPackage ../applications/emulators/np2kai { }; nuked-md = callPackage ../applications/emulators/nuked-md { }; From 3c9692d5cd44724bc98cfe5f01757d3fb2816a30 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Wed, 24 Jan 2024 17:33:38 -0300 Subject: [PATCH 2/2] nestopia-ue: 1.47 -> 1.52.0 - finalAttrs design pattern - github repo updated - strictDeps - meta.changelog --- pkgs/by-name/ne/nestopia-ue/build-fix.patch | 18 ---- pkgs/by-name/ne/nestopia-ue/gcc6.patch | 92 --------------------- pkgs/by-name/ne/nestopia-ue/package.nix | 75 +++++++++-------- 3 files changed, 40 insertions(+), 145 deletions(-) delete mode 100644 pkgs/by-name/ne/nestopia-ue/build-fix.patch delete mode 100644 pkgs/by-name/ne/nestopia-ue/gcc6.patch diff --git a/pkgs/by-name/ne/nestopia-ue/build-fix.patch b/pkgs/by-name/ne/nestopia-ue/build-fix.patch deleted file mode 100644 index a7d82ead15ca..000000000000 --- a/pkgs/by-name/ne/nestopia-ue/build-fix.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -wbBur rdanbrook-nestopia-f1dde9b/Makefile rdanbrook-nestopia-f1dde9b.my/Makefile ---- rdanbrook-nestopia-f1dde9b/Makefile 2013-01-20 20:10:25.000000000 +0400 -+++ rdanbrook-nestopia-f1dde9b.my/Makefile 2013-01-21 15:18:54.727577673 +0400 -@@ -197,11 +197,11 @@ - install -m 0644 NstDatabase.xml $(DATADIR) - install -m 0644 source/unix/icons/*.png $(DATADIR)/icons - install -m 0644 source/unix/icons/*.svg $(DATADIR)/icons -- install -m 0644 source/unix/icons/nestopia.svg $(PREFIX)/share/pixmaps -- xdg-desktop-menu install --novendor $(DATADIR)/nestopia.desktop -+ install -m 0644 source/unix/icons/nestopia.svg $(PREFIX)/share/pixmaps/nestopia.svg -+ install -Dm0644 $(DATADIR)/nestopia.desktop $(PREFIX)/share/applications/nestopia.desktop - - uninstall: -- xdg-desktop-menu uninstall $(DATADIR)/nestopia.desktop -+ rm $(PREFIX)/share/applications/nestopia.desktop - rm $(PREFIX)/share/pixmaps/nestopia.svg - rm $(BINDIR)/$(BIN) - rm -rf $(DATADIR) diff --git a/pkgs/by-name/ne/nestopia-ue/gcc6.patch b/pkgs/by-name/ne/nestopia-ue/gcc6.patch deleted file mode 100644 index 65dcc72c0c25..000000000000 --- a/pkgs/by-name/ne/nestopia-ue/gcc6.patch +++ /dev/null @@ -1,92 +0,0 @@ -From f4bc74ac4954328b25e961e7afb7337377084079 Mon Sep 17 00:00:00 2001 -From: David Seifert -Date: Sat, 31 Dec 2016 18:21:18 +0200 -Subject: [PATCH] Fix compiling in C++14 mode - -* Left shifting a negative signed is undefined behaviour -* Fix incorrect printf() specifiers found with -Wformat ---- - source/core/NstCore.hpp | 4 ++-- - source/unix/gtkui/gtkui.cpp | 2 +- - source/unix/gtkui/gtkui.h | 1 - - source/unix/gtkui/gtkui_cheats.cpp | 8 ++++---- - source/unix/video.cpp | 2 +- - 5 files changed, 8 insertions(+), 9 deletions(-) - -diff --git a/source/core/NstCore.hpp b/source/core/NstCore.hpp -index 50e20f6..420cc4a 100644 ---- a/source/core/NstCore.hpp -+++ b/source/core/NstCore.hpp -@@ -279,14 +279,14 @@ namespace Nes - template - inline long signed_shl(T v,uint c) - { -- enum {NATIVE = T(-7) << 1 == -14}; -+ enum {NATIVE = -(T(7) << 1) == -14}; - return Helper::ShiftSigned::Left( v, c ); - } - - template - inline long signed_shr(T v,uint c) - { -- enum {NATIVE = T(-7) >> 1 == -4 || T(-7) >> 1 == -3}; -+ enum {NATIVE = -(T(7) >> 1) == -4 || -(T(7) >> 1) == -3}; - return Helper::ShiftSigned::Right( v, c ); - } - -diff --git a/source/unix/gtkui/gtkui.cpp b/source/unix/gtkui/gtkui.cpp -index 3cfeeab..d4a5e2d 100644 ---- a/source/unix/gtkui/gtkui.cpp -+++ b/source/unix/gtkui/gtkui.cpp -@@ -438,7 +438,7 @@ void gtkui_message(const char* message) { - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, -- message); -+ "%s", message); - gtk_dialog_run(GTK_DIALOG(messagewindow)); - gtk_widget_destroy(messagewindow); - } -diff --git a/source/unix/gtkui/gtkui_cheats.cpp b/source/unix/gtkui/gtkui_cheats.cpp -index afc01b0..e7b691a 100644 ---- a/source/unix/gtkui/gtkui_cheats.cpp -+++ b/source/unix/gtkui/gtkui_cheats.cpp -@@ -373,7 +373,7 @@ void gtkui_cheats_fill_tree(char *filename) { - else if (node.GetChild(L"address")) { // Raw - char rawbuf[11]; - snprintf(rawbuf, sizeof(rawbuf), -- "%04x %02x %02x", -+ "%04lu %02lu %02lu", - node.GetChild(L"address").GetUnsignedValue(), - node.GetChild(L"value").GetUnsignedValue(), - node.GetChild(L"compare").GetUnsignedValue()); -@@ -545,13 +545,13 @@ gboolean gtkui_cheats_scan_list(GtkTreeModel *model, GtkTreePath *path, GtkTreeI - int addr, value, compare; - char buf[5]; - -- snprintf(buf, sizeof(buf), "%c%c%c%c\0", rawcode[0], rawcode[1], rawcode[2], rawcode[3]); -+ snprintf(buf, sizeof(buf), "%c%c%c%c", rawcode[0], rawcode[1], rawcode[2], rawcode[3]); - sscanf(buf, "%x", &addr); - -- snprintf(buf, sizeof(buf), "%c%c\0", rawcode[5], rawcode[6]); -+ snprintf(buf, sizeof(buf), "%c%c", rawcode[5], rawcode[6]); - sscanf(buf, "%x", &value); - -- snprintf(buf, sizeof(buf), "%c%c\0", rawcode[8], rawcode[9]); -+ snprintf(buf, sizeof(buf), "%c%c", rawcode[8], rawcode[9]); - sscanf(buf, "%x", &compare); - - code.address = addr; -diff --git a/source/unix/video.cpp b/source/unix/video.cpp -index 3eff19d..c34bb22 100644 ---- a/source/unix/video.cpp -+++ b/source/unix/video.cpp -@@ -757,7 +757,7 @@ void video_screenshot(const char* filename) { - if (filename == NULL) { - // Set the filename - char sshotpath[512]; -- snprintf(sshotpath, sizeof(sshotpath), "%sscreenshots/%s-%d-%d.png", nstpaths.nstdir, nstpaths.gamename, time(NULL), rand() % 899 + 100); -+ snprintf(sshotpath, sizeof(sshotpath), "%sscreenshots/%s-%ld-%d.png", nstpaths.nstdir, nstpaths.gamename, time(NULL), rand() % 899 + 100); - - // Save the file - lodepng_encode32_file(sshotpath, (const unsigned char*)pixels, rendersize.w, rendersize.h); diff --git a/pkgs/by-name/ne/nestopia-ue/package.nix b/pkgs/by-name/ne/nestopia-ue/package.nix index b42a5786394e..c0d94f315fd5 100644 --- a/pkgs/by-name/ne/nestopia-ue/package.nix +++ b/pkgs/by-name/ne/nestopia-ue/package.nix @@ -1,47 +1,62 @@ -{ lib, stdenv, fetchFromGitHub, pkg-config, SDL2, alsa-lib, gtk3 -, makeWrapper, libGLU, libGL, libarchive, libao, unzip, xdg-utils -, libepoxy, gdk-pixbuf, gnome, wrapGAppsHook +{ lib +, SDL2 +, alsa-lib +, autoconf-archive +, autoreconfHook +, fetchFromGitHub +, fltk +, libGL +, libGLU +, libao +, libarchive +, libepoxy +, makeWrapper +, pkg-config +, stdenv +, unzip +, wrapGAppsHook +, xdg-utils }: -stdenv.mkDerivation rec { - version = "1.47"; +stdenv.mkDerivation (finalAttrs: { pname = "nestopia"; + version = "1.52.0"; src = fetchFromGitHub { - owner = "rdanbrook"; + owner = "0ldsk00l"; repo = "nestopia"; - rev = version; - sha256 = "0frr0gvjh5mxzdhj0ii3sh671slgnzlm8naqlc4h87rx4p4sz2y2"; + rev = finalAttrs.version; + hash = "sha256-kd5hZ88fCLL8ysGMj7HsrSA7eCI5SL2xxiRXJiZqBZ8="; }; - # nondeterministic failures when creating directories - enableParallelBuilding = false; - - hardeningDisable = [ "format" ]; - buildInputs = [ SDL2 alsa-lib + fltk libepoxy - gtk3 - gdk-pixbuf - libGLU libGL + + libGLU + libGL libarchive libao xdg-utils - gnome.adwaita-icon-theme ]; nativeBuildInputs = [ + SDL2 + autoconf-archive + autoreconfHook + fltk pkg-config makeWrapper wrapGAppsHook unzip ]; - installPhase = '' + strictDeps = true; + + preInstall = '' mkdir -p $out/{bin,share/nestopia} - make install PREFIX=$out ''; preFixup = '' @@ -51,23 +66,13 @@ stdenv.mkDerivation rec { done ''; - patches = [ - #(fetchpatch { - # url = "https://github.com/rdanbrook/nestopia/commit/f4bc74ac4954328b25e961e7afb7337377084079.patch"; - # name = "gcc6.patch"; - # sha256 = "1jy0c85xsfk9hrv5a6v0kk48d94864qb62yyni9fp93kyl33y2p4"; - #}) - ./gcc6.patch - ./build-fix.patch - ]; - meta = { homepage = "http://0ldsk00l.ca/nestopia/"; - description = "NES emulator with a focus on accuracy"; - license = lib.licenses.gpl2; - platforms = lib.platforms.linux; - maintainers = with lib.maintainers; [ MP2E ]; + description = "Cross-platform Nestopia emulator core with a GUI"; + changelog = "https://raw.githubusercontent.com/0ldsk00l/nestopia/${finalAttrs.src.rev}/ChangeLog"; + license = lib.licenses.gpl2Plus; mainProgram = "nestopia"; + maintainers = with lib.maintainers; [ AndersonTorres ]; + platforms = lib.platforms.linux; }; -} - +})