Merge pull request #208061 from wegank/ares-darwin

ares: add darwin support
This commit is contained in:
Anderson Torres 2022-12-28 12:23:37 -03:00 committed by GitHub
commit 0ad5b19765
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 85 additions and 5 deletions

View file

@ -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;

View file

@ -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/

View file

@ -3,6 +3,7 @@
, fetchFromGitHub
, pkg-config
, wrapGAppsHook
, libicns
, SDL2
, alsa-lib
, gtk3
@ -15,8 +16,12 @@
, libpulseaudio
, openal
, udev
, darwin
}:
let
inherit (darwin.apple_sdk_11_0.frameworks) Cocoa OpenAL;
in
stdenv.mkDerivation (finalAttrs: {
pname = "ares";
version = "130.1";
@ -31,15 +36,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 +58,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

View file

@ -2173,7 +2173,7 @@ with pkgs;
### APPLICATIONS/EMULATORS/BSNES
ares = callPackage ../applications/emulators/bsnes/ares { };
ares = darwin.apple_sdk_11_0.callPackage ../applications/emulators/bsnes/ares { };
bsnes-hd = callPackage ../applications/emulators/bsnes/bsnes-hd {
inherit (darwin.apple_sdk.frameworks) Cocoa OpenAL;