Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retroarch: 1.10.0 -> 1.10.2; libretro: unstable-2022-01-21 -> unstable-2022-03-30 #163497

Merged
merged 10 commits into from
Apr 9, 2022
58 changes: 15 additions & 43 deletions pkgs/applications/emulators/retroarch/cores.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
{ lib
, stdenv
, SDL
, alsa-lib
, boost
, buildPackages
, bzip2
, cmake
, curl
, fetchFromGitHub
, ffmpeg
, fluidsynth
, gcc10Stdenv
, gettext
, hexdump
, hidapi
, icu
, libaio
, libevdev
, libGL
, libGLU
, libevdev
, libjpeg
, libpcap
, libpng
Expand All @@ -32,6 +31,7 @@
, portaudio
, python3
, retroarch
, SDL
, sfml
, snappy
, udev
Expand All @@ -53,17 +53,19 @@ let
, description
# Check https://github.com/libretro/libretro-core-info for license information
, license
, stdenvOverride ? stdenv
, src ? (getCoreSrc core)
, broken ? false
, version ? "unstable-2022-01-21"
, version ? "unstable-2022-04-08"
, platforms ? retroarch.meta.platforms
# The resulting core file is based on core name
# Setting `normalizeCore` to `true` will convert `-` to `_` on the core filename
, normalizeCore ? true
, ...
}@args:
stdenv.mkDerivation (
stdenvOverride.mkDerivation (
let
inherit (stdenvOverride) hostPlatform;
d2u = if normalizeCore then (lib.replaceChars [ "-" ] [ "_" ]) else (x: x);
in
(rec {
Expand All @@ -79,12 +81,12 @@ let
linux = "unix";
darwin = "osx";
windows = "win";
}.${stdenv.hostPlatform.parsed.kernel.name} or stdenv.hostPlatform.parsed.kernel.name}"
}.${hostPlatform.parsed.kernel.name} or hostPlatform.parsed.kernel.name}"
"ARCH=${{
armv7l = "arm";
armv6l = "arm";
i686 = "x86";
}.${stdenv.hostPlatform.parsed.cpu.name} or stdenv.hostPlatform.parsed.cpu.name}"
}.${hostPlatform.parsed.cpu.name} or hostPlatform.parsed.cpu.name}"
] ++ (args.makeFlags or [ ]);

coreDir = "${placeholder "out"}/lib/retroarch/cores";
Expand All @@ -94,9 +96,9 @@ let

mkdir -p $out/bin
mkdir -p $coreDir
mv ${d2u args.core}_libretro${stdenv.hostPlatform.extensions.sharedLibrary} $coreDir
mv ${d2u args.core}_libretro${hostPlatform.extensions.sharedLibrary} $coreDir
makeWrapper ${retroarch}/bin/retroarch $out/bin/retroarch-${core} \
--add-flags "-L $coreDir/${d2u core}_libretro${stdenv.hostPlatform.extensions.sharedLibrary} $@"
--add-flags "-L $coreDir/${d2u core}_libretro${hostPlatform.extensions.sharedLibrary} $@"

runHook postInstall
'';
Expand Down Expand Up @@ -298,37 +300,11 @@ in
citra = mkLibRetroCore {
core = "citra";
description = "Port of Citra to libretro";
stdenvOverride = gcc10Stdenv;
license = lib.licenses.gpl2Plus;
extraNativeBuildInputs = [ cmake pkg-config ];
extraBuildInputs = [ libGLU libGL boost ];
makefile = "Makefile";
cmakeFlags = [
"-DENABLE_LIBRETRO=ON"
"-DENABLE_QT=OFF"
"-DENABLE_SDL2=OFF"
"-DENABLE_WEB_SERVICE=OFF"
"-DENABLE_DISCORD_PRESENCE=OFF"
];
preConfigure = "sed -e '77d' -i externals/cmake-modules/GetGitRevisionDescription.cmake";
postBuild = "cd src/citra_libretro";
};

citra-canary = mkLibRetroCore {
core = "citra-canary";
description = "Port of Citra Canary/Experimental to libretro";
license = lib.licenses.gpl2Plus;
extraNativeBuildInputs = [ cmake pkg-config ];
extraBuildInputs = [ libGLU libGL boost ];
extraBuildInputs = [ libGLU libGL boost ffmpeg nasm ];
makefile = "Makefile";
cmakeFlags = [
"-DENABLE_LIBRETRO=ON"
"-DENABLE_QT=OFF"
"-DENABLE_SDL2=OFF"
"-DENABLE_WEB_SERVICE=OFF"
"-DENABLE_DISCORD_PRESENCE=OFF"
];
preConfigure = "sed -e '77d' -i externals/cmake-modules/GetGitRevisionDescription.cmake";
postBuild = "cd src/citra_libretro";
makeFlags = [ "HAVE_FFMPEG_STATIC=0" ];
};

desmume = mkLibRetroCore {
Expand Down Expand Up @@ -476,19 +452,16 @@ in
description = "Port of Hatari to libretro";
license = lib.licenses.gpl2Only;
extraBuildInputs = [ SDL zlib ];
extraNativeBuildInputs = [ cmake which ];
dontUseCmakeConfigure = true;
extraNativeBuildInputs = [ which ];
dontConfigure = true;
makeFlags = [ "EXTERNAL_ZLIB=1" ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
};

mame = mkLibRetroCore {
core = "mame";
description = "Port of MAME to libretro";
license = with lib.licenses; [ bsd3 gpl2Plus ];
extraBuildInputs = [ alsa-lib libGLU libGL portaudio python3 xorg.libX11 ];
makefile = "Makefile.libretro";
};

mame2000 = mkLibRetroCore {
Expand Down Expand Up @@ -619,7 +592,6 @@ in
src = getCoreSrc core;
description = "Neko Project II kai libretro port";
license = lib.licenses.mit;
makefile = "Makefile.libretro";
makeFlags = [
# See https://github.com/AZO234/NP2kai/tags
"NP2KAI_VERSION=rev.22"
Expand Down
33 changes: 25 additions & 8 deletions pkgs/applications/emulators/retroarch/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
}:

let
version = "1.10.0";
version = "1.10.2";
libretroCoreInfo = fetchFromGitHub {
owner = "libretro";
repo = "libretro-core-info";
sha256 = "sha256-3j7fvcfbgyk71MmbUUKYi+/0cpQFNbYXO+DMDUjDqkQ=";
sha256 = "sha256-XOSIVH3BSwAFKUeRvyYc2OXDa+TLjoKVGl+b8fgnvtY=";
rev = "v${version}";
};
runtimeLibs = lib.optional withVulkan vulkan-loader
Expand All @@ -52,13 +52,13 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "libretro";
repo = "RetroArch";
sha256 = "sha256-bpTSzODVRKRs1OW6JafjbU3e/AqdQeGzWcg1lb9SIyo=";
sha256 = "sha256-fMsHMQiEoXeFKITxeEyRH829z5SCf8p0Hxq6ww1p3z4=";
rev = "v${version}";
};

patches = [
./0001-Disable-menu_show_core_updater.patch
./0002-Use-fixed-paths-on-libretro_info_path.patch
./disable-menu_show_core_updater.patch
./use-fixed-paths-on-libretro_info_path.patch
];

postPatch = ''
Expand Down Expand Up @@ -104,19 +104,36 @@ 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";
license = licenses.gpl3Plus;
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;
};
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 546b343294209abbb193883ab76b679b7f99c6d3 Mon Sep 17 00:00:00 2001
From: Thiago Kenji Okada <[email protected]>
Date: Sat, 20 Nov 2021 16:03:50 -0300
Subject: [PATCH 1/2] Disable "menu_show_core_updater"
Subject: [PATCH] Disable "menu_show_core_updater"

---
retroarch.cfg | 2 +-
Expand Down
Loading