nixpkgs/pkgs/misc/emulators/retroarch/default.nix

88 lines
3.0 KiB
Nix
Raw Normal View History

2018-03-03 02:09:35 +00:00
{ stdenv, fetchFromGitHub, which, pkgconfig, makeWrapper
, ffmpeg, libGLU_combined, freetype, libxml2, python3
2018-03-03 23:09:44 +00:00
, libobjc, AppKit, Foundation
2018-03-03 02:09:35 +00:00
, alsaLib ? null
, libpulseaudio ? null
, libv4l ? null
, libX11 ? null
, libXdmcp ? null
, libXext ? null
, libXxf86vm ? null
, SDL2 ? null
, udev ? null
, enableNvidiaCgToolkit ? false, nvidia_cg_toolkit ? null
2018-03-03 02:09:35 +00:00
, withVulkan ? stdenv.isLinux, vulkan-loader ? null
, fetchurl
}:
with stdenv.lib;
2013-06-26 12:25:09 +01:00
2018-05-11 02:07:11 +01:00
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}";
2018-12-13 05:10:02 +00:00
version = "1.7.5";
2013-06-26 12:25:09 +01:00
src = fetchFromGitHub {
owner = "libretro";
repo = "RetroArch";
2018-12-13 05:10:02 +00:00
sha256 = "1jfpgl34jjxn3dvxd1kd564swkw7v98hnn562v998b7vllz3dxdm";
rev = "v${version}";
2013-06-26 12:25:09 +01:00
};
2018-03-03 02:09:35 +00:00
nativeBuildInputs = [ pkgconfig ]
++ optional withVulkan [ makeWrapper ];
2013-06-26 12:25:09 +01:00
buildInputs = [ ffmpeg freetype libxml2 libGLU_combined python3 SDL2 which ]
2018-03-03 02:09:35 +00:00
++ optional enableNvidiaCgToolkit nvidia_cg_toolkit
++ optional withVulkan [ vulkan-loader ]
2018-03-03 23:09:44 +00:00
++ optionals stdenv.isDarwin [ libobjc AppKit Foundation ]
2018-03-03 02:09:35 +00:00
++ optionals stdenv.isLinux [ alsaLib libpulseaudio libv4l libX11
libXdmcp libXext libXxf86vm udev ];
2018-03-03 02:09:35 +00:00
enableParallelBuilding = true;
2018-05-11 02:07:11 +01:00
postInstall = optionalString withVulkan ''
2018-03-03 02:09:35 +00:00
wrapProgram $out/bin/retroarch --prefix LD_LIBRARY_PATH ':' ${vulkan-loader}/lib
'' + optionalString stdenv.targetPlatform.isDarwin ''
2018-05-11 02:07:11 +01:00
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
'';
2018-03-03 02:09:35 +00:00
preFixup = "rm $out/bin/retroarch-cg2glsl";
meta = {
2018-03-03 02:09:35 +00:00
homepage = https://libretro.com;
description = "Multi-platform emulator frontend for libretro cores";
license = licenses.gpl3;
platforms = platforms.all;
maintainers = with maintainers; [ MP2E edwtjo matthewbauer ];
2013-06-26 12:25:09 +01:00
};
}