Skip to content

Commit

Permalink
ares: add darwin support
Browse files Browse the repository at this point in the history
  • Loading branch information
wegank committed Dec 28, 2022
1 parent d97726b commit 6be1c77
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 5 deletions.
39 changes: 39 additions & 0 deletions pkgs/applications/emulators/bsnes/ares/002-sips-to-png2icns.patch
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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/
24 changes: 20 additions & 4 deletions pkgs/applications/emulators/bsnes/ares/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
, fetchFromGitHub
, pkg-config
, wrapGAppsHook
, libicns
, SDL2
, alsa-lib
, gtk3
Expand All @@ -15,6 +16,8 @@
, libpulseaudio
, openal
, udev
, Cocoa
, OpenAL
}:

stdenv.mkDerivation (finalAttrs: {
Expand All @@ -31,45 +34,58 @@ 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
libGL
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
4 changes: 3 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6be1c77

Please sign in to comment.