retroarchBare: re-add support to Darwin

This still doesn't fix our wrapped retroarch binary, but should be
sufficient to build retroarch+cores in Darwin.
This commit is contained in:
Thiago Kenji Okada 2022-03-05 01:00:30 +00:00
parent 503c8093be
commit 6b4c7368fa
2 changed files with 30 additions and 9 deletions

View File

@ -104,10 +104,30 @@ stdenv.mkDerivation rec {
'' + lib.optionalString (runtimeLibs != [ ]) ''
wrapProgram $out/bin/retroarch \
--prefix LD_LIBRARY_PATH ':' ${lib.makeLibraryPath runtimeLibs}
'' + lib.optionalString stdenv.isDarwin ''
# https://github.com/libretro/RetroArch/blob/master/retroarch-apple-packaging.sh
app=$out/Applications/RetroArch.app
mkdir -p $app/Contents/MacOS
cp -r pkg/apple/OSX/* $app/Contents
cp $out/bin/retroarch $app/Contents/MacOS
# FIXME: using Info_Metal.plist results in input not working
# mv $app/Contents/Info_Metal.plist $app/Contents/Info.plist
substituteInPlace $app/Contents/Info.plist \
--replace '${"\${EXECUTABLE_NAME}"}' 'RetroArch' \
--replace '$(PRODUCT_BUNDLE_IDENTIFIER)' 'com.libretro.RetroArch' \
--replace '${"\${PRODUCT_NAME}"}' 'RetroArch' \
--replace '${"\${MACOSX_DEPLOYMENT_TARGET}"}' '10.13'
cp media/retroarch.icns $app/Contents/Resources/
'';
preFixup = "rm $out/bin/retroarch-cg2glsl";
# Workaround for the following error affecting newer versions of Clang:
# ./config.def.h:xxx:x: error: 'TARGET_OS_TV' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
NIX_CFLAGS_COMPILE = lib.optional stdenv.cc.isClang [ "-Wno-undef-prefix" ];
meta = with lib; {
homepage = "https://libretro.com";
description = "Multi-platform emulator frontend for libretro cores";
@ -115,8 +135,5 @@ stdenv.mkDerivation rec {
platforms = platforms.unix;
changelog = "https://github.com/libretro/RetroArch/blob/v${version}/CHANGES.md";
maintainers = with maintainers; [ MP2E edwtjo matthewbauer kolbycrouch thiagokokada ];
# FIXME: exits with error on macOS:
# No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting
broken = stdenv.isDarwin;
};
}

View File

@ -8,8 +8,7 @@ stdenv.mkDerivation {
buildCommand = ''
mkdir -p $out/lib
for coreDir in $cores
do
for coreDir in $cores; do
ln -s $coreDir/* $out/lib/.
done
@ -29,9 +28,14 @@ stdenv.mkDerivation {
meta = with retroarch.meta; {
inherit changelog description homepage license maintainers platforms;
longDescription =
"RetroArch is the reference frontend for the libretro API. The following cores are included: "
+ lib.concatStringsSep ", " (map (x: "${x.name}") cores)
+ ".";
longDescription = ''
RetroArch is the reference frontend for the libretro API.
The following cores are included:
${lib.concatStringsSep "\n" (map (x: " - ${x.name}") cores)}
'';
# FIXME: exits with error on macOS:
# No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting
broken = stdenv.isDarwin;
};
}