summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-07-23 15:44:38 +0200
committerGitHub <noreply@github.com>2021-07-23 15:44:38 +0200
commitd0714a744c07d0ae2b59cd2e159b397d9be50aab (patch)
treed624e1502dffac881404bfd42477638bc1641804
parent7bad0b5e800ab58e3332c474d5fa16e0f1d62e13 (diff)
parent5ffb7c850046c94ec9ae58fb57b6ad9abe269013 (diff)
downloadnixpkgs-d0714a744c07d0ae2b59cd2e159b397d9be50aab.tar
nixpkgs-d0714a744c07d0ae2b59cd2e159b397d9be50aab.tar.gz
nixpkgs-d0714a744c07d0ae2b59cd2e159b397d9be50aab.tar.bz2
nixpkgs-d0714a744c07d0ae2b59cd2e159b397d9be50aab.tar.lz
nixpkgs-d0714a744c07d0ae2b59cd2e159b397d9be50aab.tar.xz
nixpkgs-d0714a744c07d0ae2b59cd2e159b397d9be50aab.tar.zst
nixpkgs-d0714a744c07d0ae2b59cd2e159b397d9be50aab.zip
Merge pull request #130166 from stevebob/init-bsnes-hd
-rw-r--r--maintainers/maintainer-list.nix6
-rw-r--r--pkgs/misc/emulators/bsnes-hd/default.nix55
-rw-r--r--pkgs/misc/emulators/bsnes-hd/macos-copy-app-to-prefix.patch18
-rw-r--r--pkgs/misc/emulators/bsnes-hd/macos-replace-sips-with-png2icns.patch13
-rw-r--r--pkgs/top-level/all-packages.nix5
5 files changed, 97 insertions, 0 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 8aa6fd540a3..8647fcc7d75 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -10134,6 +10134,12 @@
     githubId = 1829294;
     name = "Steve Chávez";
   };
+  stevebob = {
+    email = "stephen@sherra.tt";
+    github = "stevebob";
+    githubId = 417118;
+    name = "Stephen Sherratt";
+  };
   steveej = {
     email = "mail@stefanjunker.de";
     github = "steveej";
diff --git a/pkgs/misc/emulators/bsnes-hd/default.nix b/pkgs/misc/emulators/bsnes-hd/default.nix
new file mode 100644
index 00000000000..6494185958c
--- /dev/null
+++ b/pkgs/misc/emulators/bsnes-hd/default.nix
@@ -0,0 +1,55 @@
+{ lib, stdenv, fetchFromGitHub
+, pkg-config
+, libX11, libXv
+, udev
+, SDL2
+, gtk2, gtksourceview
+, alsa-lib, libao, openal, libpulseaudio
+, libicns, Cocoa, OpenAL
+}:
+
+stdenv.mkDerivation {
+  pname = "bsnes-hd";
+  version = "10.6-beta";
+
+  src = fetchFromGitHub {
+    owner = "DerKoun";
+    repo = "bsnes-hd";
+    rev = "beta_10_6";
+    sha256 = "0f3cd89fd0lqskzj98cc1pzmdbscq0psdjckp86w94rbchx7iw4h";
+  };
+
+  patches = [
+    # Replace invocation of `sips` with an equivalent invocation of `png2icns`
+    # while assembling the .app directory hierarchy in the macos build. The
+    # `sips` executable isn't in our environment during the build, but
+    # `png2icns` is available by way of the dependency on libicns.
+    ./macos-replace-sips-with-png2icns.patch
+
+    # During `make install` on macos the Makefile wants to move the .app into
+    # the current user's home directory. This patches the Makefile such that
+    # the .app ends up in $(prefix)/Applications. The $(prefix) variable will
+    # be set to $out, so this will result in the .app ending up in the
+    # Applications directory in the current nix profile.
+    ./macos-copy-app-to-prefix.patch
+  ];
+
+  nativeBuildInputs = [ pkg-config ]
+    ++ lib.optionals stdenv.isDarwin [ libicns ];
+
+  buildInputs = [ SDL2 libao ]
+    ++ lib.optionals stdenv.isLinux [ libX11 libXv udev gtk2 gtksourceview alsa-lib openal libpulseaudio ]
+    ++ lib.optionals stdenv.isDarwin [ Cocoa OpenAL ];
+
+  enableParallelBuilding = true;
+
+  makeFlags = [ "-C" "bsnes" "prefix=$(out)" ];
+
+  meta = with lib; {
+    description = "A fork of bsnes that adds HD video features";
+    homepage = "https://github.com/DerKoun/bsnes-hd";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ stevebob ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/misc/emulators/bsnes-hd/macos-copy-app-to-prefix.patch b/pkgs/misc/emulators/bsnes-hd/macos-copy-app-to-prefix.patch
new file mode 100644
index 00000000000..d38efbc99bc
--- /dev/null
+++ b/pkgs/misc/emulators/bsnes-hd/macos-copy-app-to-prefix.patch
@@ -0,0 +1,18 @@
+diff --git a/bsnes/target-bsnes/GNUmakefile b/bsnes/target-bsnes/GNUmakefile
+index 7a3ab9f..ec8a1a4 100644
+--- a/bsnes/target-bsnes/GNUmakefile
++++ b/bsnes/target-bsnes/GNUmakefile
+@@ -43,11 +43,8 @@ ifeq ($(platform),windows)
+ else ifeq ($(shell id -un),root)
+ 	$(error "make install should not be run as root")
+ else ifeq ($(platform),macos)
+-	mkdir -p ~/Library/Application\ Support/$(name)/
+-	mkdir -p ~/Library/Application\ Support/$(name)/Database/
+-	mkdir -p ~/Library/Application\ Support/$(name)/Firmware/
+-	mkdir -p ~/Library/Application\ Support/$(name)/Shaders/
+-	cp -R out/$(name).app /Applications/$(name).app
++	mkdir -p $(prefix)/Applications
++	cp -R out/$(name).app $(prefix)/Applications
+ else ifneq ($(filter $(platform),linux bsd),)
+ 	mkdir -p $(prefix)/bin/
+ 	mkdir -p $(prefix)/share/applications/
diff --git a/pkgs/misc/emulators/bsnes-hd/macos-replace-sips-with-png2icns.patch b/pkgs/misc/emulators/bsnes-hd/macos-replace-sips-with-png2icns.patch
new file mode 100644
index 00000000000..85adb33e3ab
--- /dev/null
+++ b/pkgs/misc/emulators/bsnes-hd/macos-replace-sips-with-png2icns.patch
@@ -0,0 +1,13 @@
+diff --git a/bsnes/target-bsnes/GNUmakefile b/bsnes/target-bsnes/GNUmakefile
+index 4c67bde..7a3ab9f 100644
+--- a/bsnes/target-bsnes/GNUmakefile
++++ b/bsnes/target-bsnes/GNUmakefile
+@@ -33,7 +33,7 @@ ifeq ($(platform),macos)
+ 	cp Database/* out/$(name).app/Contents/MacOS/Database/
+ 	cp -r ../shaders/* out/$(name).app/Contents/macOS/Shaders/
+ 	cp $(ui)/resource/$(name).plist out/$(name).app/Contents/Info.plist
+-	sips -s format icns $(ui)/resource/$(name).png --out out/$(name).app/Contents/Resources/$(name).icns
++	png2icns out/$(name).app/Contents/Resources/$(name).icns $(ui)/resource/$(name).png
+ endif
+ 
+ verbose: hiro.verbose ruby.verbose nall.verbose all;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1b4f487f582..777e328265e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -32133,6 +32133,11 @@ in
     inherit (darwin.apple_sdk.frameworks) Carbon Cocoa OpenGL OpenAL;
   };
 
+  bsnes-hd = callPackage ../misc/emulators/bsnes-hd {
+    inherit (gnome2) gtksourceview;
+    inherit (darwin.apple_sdk.frameworks) Cocoa OpenAL;
+  };
+
   yapesdl = callPackage ../misc/emulators/yapesdl { };
 
   x16-emulator = callPackage ../misc/emulators/commanderx16/emulator.nix { };