summary refs log tree commit diff
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2022-12-28 06:31:27 +0100
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2022-12-28 06:31:27 +0100
commit6be1c77f05332b635eef7a3e9d8c789eeb5291b8 (patch)
tree066f47f55a094fbe909e5683e8a099f470cb7162
parentd97726bb767167a9baf67979bd37b3a1d45aa83e (diff)
downloadnixpkgs-6be1c77f05332b635eef7a3e9d8c789eeb5291b8.tar
nixpkgs-6be1c77f05332b635eef7a3e9d8c789eeb5291b8.tar.gz
nixpkgs-6be1c77f05332b635eef7a3e9d8c789eeb5291b8.tar.bz2
nixpkgs-6be1c77f05332b635eef7a3e9d8c789eeb5291b8.tar.lz
nixpkgs-6be1c77f05332b635eef7a3e9d8c789eeb5291b8.tar.xz
nixpkgs-6be1c77f05332b635eef7a3e9d8c789eeb5291b8.tar.zst
nixpkgs-6be1c77f05332b635eef7a3e9d8c789eeb5291b8.zip
ares: add darwin support
-rw-r--r--pkgs/applications/emulators/bsnes/ares/002-sips-to-png2icns.patch39
-rw-r--r--pkgs/applications/emulators/bsnes/ares/003-fix-darwin-install.patch23
-rw-r--r--pkgs/applications/emulators/bsnes/ares/default.nix24
-rw-r--r--pkgs/top-level/all-packages.nix4
4 files changed, 85 insertions, 5 deletions
diff --git a/pkgs/applications/emulators/bsnes/ares/002-sips-to-png2icns.patch b/pkgs/applications/emulators/bsnes/ares/002-sips-to-png2icns.patch
new file mode 100644
index 00000000000..4c2259d63a3
--- /dev/null
+++ b/pkgs/applications/emulators/bsnes/ares/002-sips-to-png2icns.patch
@@ -0,0 +1,39 @@
+diff --git a/desktop-ui/GNUmakefile b/desktop-ui/GNUmakefile
+index 4515610d3..916c8fcd8 100644
+--- a/desktop-ui/GNUmakefile
++++ b/desktop-ui/GNUmakefile
+@@ -91,7 +91,7 @@ endif
+ 	cp resource/$(name).plist $(output.path)/$(name).app/Contents/Info.plist
+ 	cp -R $(ares.path)/Shaders $(output.path)/$(name).app/Contents/Resources/
+ 	cp -R $(mia.path)/Database $(output.path)/$(name).app/Contents/Resources/	
+-	sips -s format icns resource/$(name).png --out $(output.path)/$(name).app/Contents/Resources/$(name).icns
++	png2icns $(output.path)/$(name).app/Contents/Resources/$(name).icns resource/$(name).png
+ 	codesign --force --deep --options runtime --entitlements resource/$(name).selfsigned.entitlements --sign - $(output.path)/$(name).app
+ else ifeq ($(platform),windows)
+ 	$(call mkdir,$(output.path)/Shaders/)
+diff --git a/genius/GNUmakefile b/genius/GNUmakefile
+index 5287309a8..8d80f9306 100644
+--- a/genius/GNUmakefile
++++ b/genius/GNUmakefile
+@@ -24,7 +24,7 @@ ifeq ($(platform),macos)
+ 	mkdir -p $(output.path)/$(name).app/Contents/Resources/
+ 	mv $(output.path)/$(name) $(output.path)/$(name).app/Contents/MacOS/$(name)
+ 	cp data/$(name).plist $(output.path)/$(name).app/Contents/Info.plist
+-	sips -s format icns data/$(name).png --$(output.path) $(output.path)/$(name).app/Contents/Resources/$(name).icns
++	png2icns $(output.path)/$(name).app/Contents/Resources/$(name).icns data/$(name).png
+ endif
+ 
+ verbose: hiro.verbose nall.verbose all;
+diff --git a/mia/GNUmakefile b/mia/GNUmakefile
+index b6930b6df..7a51b5028 100644
+--- a/mia/GNUmakefile
++++ b/mia/GNUmakefile
+@@ -32,7 +32,7 @@ ifeq ($(platform),macos)
+ 	mkdir -p $(output.path)/$(name).app/Contents/Resources/
+ 	mv $(output.path)/$(name) $(output.path)/$(name).app/Contents/MacOS/$(name)
+ 	cp resource/$(name).plist $(output.path)/$(name).app/Contents/Info.plist
+-	sips -s format icns resource/$(name).png --out $(output.path)/$(name).app/Contents/Resources/$(name).icns
++	png2icns $(output.path)/$(name).app/Contents/Resources/$(name).icns resource/$(name).png
+ endif
+ 
+ verbose: hiro.verbose nall.verbose all;
diff --git a/pkgs/applications/emulators/bsnes/ares/003-fix-darwin-install.patch b/pkgs/applications/emulators/bsnes/ares/003-fix-darwin-install.patch
new file mode 100644
index 00000000000..5b216ac267e
--- /dev/null
+++ b/pkgs/applications/emulators/bsnes/ares/003-fix-darwin-install.patch
@@ -0,0 +1,23 @@
+diff --git a/desktop-ui/GNUmakefile b/desktop-ui/GNUmakefile
+index 916c8fcd8..b767c1335 100644
+--- a/desktop-ui/GNUmakefile
++++ b/desktop-ui/GNUmakefile
+@@ -92,7 +92,6 @@ endif
+ 	cp -R $(ares.path)/Shaders $(output.path)/$(name).app/Contents/Resources/
+ 	cp -R $(mia.path)/Database $(output.path)/$(name).app/Contents/Resources/	
+ 	png2icns $(output.path)/$(name).app/Contents/Resources/$(name).icns resource/$(name).png
+-	codesign --force --deep --options runtime --entitlements resource/$(name).selfsigned.entitlements --sign - $(output.path)/$(name).app
+ else ifeq ($(platform),windows)
+ 	$(call mkdir,$(output.path)/Shaders/)
+ 	$(call mkdir,$(output.path)/Database/)
+@@ -115,8 +114,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)/
+-	cp -R $(output.path)/$(name).app /Applications/$(name).app
++	mkdir -p $(prefix)/Applications/
++	cp -R $(output.path)/$(name).app $(prefix)/Applications/$(name).app
+ else ifneq ($(filter $(platform),linux bsd),)
+ 	mkdir -p $(prefix)/bin/
+ 	mkdir -p $(prefix)/share/applications/
diff --git a/pkgs/applications/emulators/bsnes/ares/default.nix b/pkgs/applications/emulators/bsnes/ares/default.nix
index 7a6dae5784c..e69befe7de5 100644
--- a/pkgs/applications/emulators/bsnes/ares/default.nix
+++ b/pkgs/applications/emulators/bsnes/ares/default.nix
@@ -3,6 +3,7 @@
 , fetchFromGitHub
 , pkg-config
 , wrapGAppsHook
+, libicns
 , SDL2
 , alsa-lib
 , gtk3
@@ -15,6 +16,8 @@
 , libpulseaudio
 , openal
 , udev
+, Cocoa
+, OpenAL
 }:
 
 stdenv.mkDerivation (finalAttrs: {
@@ -31,15 +34,21 @@ stdenv.mkDerivation (finalAttrs: {
   patches = [
     ./000-dont-rebuild-on-install.patch
     ./001-fix-ruby.patch
+    ./002-sips-to-png2icns.patch
+    ./003-fix-darwin-install.patch
   ];
 
   nativeBuildInputs = [
     pkg-config
     wrapGAppsHook
+  ] ++ lib.optionals stdenv.isDarwin [
+    libicns
   ];
 
   buildInputs = [
     SDL2
+    libao
+  ] ++ lib.optionals stdenv.isLinux [
     alsa-lib
     gtk3
     gtksourceview3
@@ -47,29 +56,36 @@ stdenv.mkDerivation (finalAttrs: {
     libGLU
     libX11
     libXv
-    libao
     libpulseaudio
     openal
     udev
+  ] ++ lib.optionals stdenv.isDarwin [
+    Cocoa
+    OpenAL
   ];
 
   enableParallelBuilding = true;
 
-  makeFlags = [
+  makeFlags = lib.optionals stdenv.isLinux [
     "hiro=gtk3"
+  ] ++ lib.optionals stdenv.isDarwin [
+    "hiro=cocoa"
+    "vulkan=false"
+  ] ++ [
     "local=false"
     "openmp=true"
     "prefix=$(out)"
     "-C desktop-ui"
   ];
 
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-mmacosx-version-min=10.14";
+
   meta = with lib; {
     homepage = "https://ares-emu.net";
     description = "Open-source multi-system emulator with a focus on accuracy and preservation";
     license = licenses.isc;
     maintainers = with maintainers; [ Madouura AndersonTorres ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 })
 # TODO: select between Qt, GTK2 and GTK3
-# TODO: support Darwin
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 9b260e9ac45..f9d6a174f67 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2162,7 +2162,9 @@ with pkgs;
 
   ### APPLICATIONS/EMULATORS/BSNES
 
-  ares = callPackage ../applications/emulators/bsnes/ares { };
+  ares = darwin.apple_sdk_11_0.callPackage ../applications/emulators/bsnes/ares {
+    inherit (darwin.apple_sdk_11_0.frameworks) Cocoa OpenAL;
+  };
 
   bsnes-hd = callPackage ../applications/emulators/bsnes/bsnes-hd {
     inherit (darwin.apple_sdk.frameworks) Cocoa OpenAL;