retroarch: fix on macOS

This commit is contained in:
Matthew Bauer 2018-05-10 20:07:11 -05:00
parent 83cc86a7f3
commit 352f8cb6b6
2 changed files with 38 additions and 2 deletions

View File

@ -12,11 +12,20 @@
, udev ? null
, enableNvidiaCgToolkit ? false, nvidia_cg_toolkit ? null
, withVulkan ? stdenv.isLinux, vulkan-loader ? null
, targetPlatform, fetchurl
}:
with stdenv.lib;
stdenv.mkDerivation rec {
let
# ibtool is closed source so we have to download the blob
osx-MainMenu = fetchurl {
url = "https://github.com/matthewbauer/RetroArch/raw/b146a9ac6b2b516652a7bf05a9db5a804eab323d/pkg/apple/OSX/en.lproj/MainMenu.nib";
sha256 = "13k1l628wy0rp6wxrpwr4g1m9c997d0q8ks50f8zhmh40l5j2sp8";
};
in stdenv.mkDerivation rec {
name = "retroarch-bare-${version}";
version = "1.7.1";
@ -39,8 +48,31 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
postInstall = optional withVulkan ''
postInstall = optionalString withVulkan ''
wrapProgram $out/bin/retroarch --prefix LD_LIBRARY_PATH ':' ${vulkan-loader}/lib
'' + optionalString targetPlatform.isDarwin ''
EXECUTABLE_NAME=RetroArch
PRODUCT_NAME=RetroArch
MACOSX_DEPLOYMENT_TARGET=10.5
app=$out/Applications/$PRODUCT_NAME.app
install -D pkg/apple/OSX/Info.plist $app/Contents/Info.plist
echo "APPL????" > $app/Contents/PkgInfo
mkdir -p $app/Contents/MacOS
ln -s $out/bin/retroarch $app/Contents/MacOS/$EXECUTABLE_NAME
# Hack to fill in Info.plist template w/o using xcode
sed -i -e 's,''${EXECUTABLE_NAME}'",$EXECUTABLE_NAME," \
-e 's,''${MACOSX_DEPLOYMENT_TARGET}'",$MACOSX_DEPLOYMENT_TARGET," \
-e 's,''${PRODUCT_NAME}'",$PRODUCT_NAME," \
-e 's,''${PRODUCT_NAME:rfc1034identifier}'",$PRODUCT_NAME," \
$app/Contents/Info.plist
install -D ${osx-MainMenu} \
$app/Contents/Resources/en.lproj/MainMenu.nib
install -D pkg/apple/OSX/en.lproj/InfoPlist.strings \
$app/Contents/Resources/en.lproj/InfoPlist.strings
install -D media/retroarch.icns $app/Contents/Resources/retroarch.icns
'';
preFixup = "rm $out/bin/retroarch-cg2glsl";

View File

@ -21,6 +21,10 @@ stdenv.mkDerivation {
ln -s -t $out ${retroarch}/share
if [ -d ${retroarch}/Applications ]; then
ln -s -t $out ${retroarch}/Applications
fi
makeWrapper ${retroarch}/bin/retroarch $out/bin/retroarch \
--suffix-each LD_LIBRARY_PATH ':' "$cores" \
--add-flags "-L $out/lib/ --menu" \