retroarchBare: add with{Assets,CoreInfo} options

This commit is contained in:
Thiago Kenji Okada
2022-12-22 12:42:08 +00:00
parent cb93ebaeec
commit 8df7516450
3 changed files with 82 additions and 4 deletions
@@ -2,6 +2,8 @@
, stdenv
, nixosTests
, enableNvidiaCgToolkit ? false
, withAssets ? false
, withCoreInfo ? false
, withGamemode ? stdenv.isLinux
, withVulkan ? stdenv.isLinux
, withWayland ? stdenv.isLinux
@@ -30,6 +32,7 @@
, nvidia_cg_toolkit
, pkg-config
, python3
, retroarch-assets
, SDL2
, substituteAll
, udev
@@ -54,12 +57,16 @@ stdenv.mkDerivation rec {
rev = "v${version}";
};
patches = [
patches = lib.optional withAssets
(substituteAll {
src = ./move-retroarch-assets-to-retroarch_assets_path.patch;
retroarch_assets_path = retroarch-assets;
})
++ lib.optional withCoreInfo
(substituteAll {
src = ./use-fixed-path-for-libretro_core_info.patch;
libretro_info_path = libretro-core-info;
})
];
});
nativeBuildInputs = [ pkg-config ] ++
lib.optional withWayland wayland ++
@@ -103,6 +110,12 @@ stdenv.mkDerivation rec {
"--disable-builtinzlib"
"--disable-builtinflac"
] ++
lib.optionals withAssets [
"--disable-update_assets"
# TODO: investigate why we also need this patch:
# ./move-retroarch-assets-to-retroarch_assets_path.patch
"--with-assets_dir=${retroarch-assets}"
] ++
lib.optionals stdenv.isLinux [
"--enable-dbus"
"--enable-egl"
@@ -0,0 +1,60 @@
From b3ccf05014f4a79800d8bed05b0dcfdc010e191c Mon Sep 17 00:00:00 2001
From: Thiago Kenji Okada <thiagokokada@gmail.com>
Date: Sun, 18 Dec 2022 22:06:48 +0000
Subject: [PATCH 2/2] Move retroarch assets path to @retroarch_assets_path@
---
configuration.c | 2 +-
frontend/drivers/platform_unix.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/configuration.c b/configuration.c
index 06a99236c2..15b575d8a2 100644
--- a/configuration.c
+++ b/configuration.c
@@ -1539,7 +1539,7 @@ static struct config_path_setting *populate_settings_path(
SETTING_PATH("core_assets_directory",
settings->paths.directory_core_assets, true, NULL, true);
SETTING_PATH("assets_directory",
- settings->paths.directory_assets, true, NULL, true);
+ settings->paths.directory_assets, true, NULL, false);
SETTING_PATH("dynamic_wallpapers_directory",
settings->paths.directory_dynamic_wallpapers, true, NULL, true);
SETTING_PATH("thumbnails_directory",
diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c
index 43ea5f80c9..01b6cccbcc 100644
--- a/frontend/drivers/platform_unix.c
+++ b/frontend/drivers/platform_unix.c
@@ -1778,21 +1778,21 @@ static void frontend_unix_get_env(int *argc,
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], base_path,
"autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
- if (path_is_directory("/usr/local/share/retroarch/assets"))
+ if (path_is_directory("@retroarch_assets_path@/local/share/retroarch/assets"))
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
- "/usr/local/share/retroarch",
+ "@retroarch_assets_path@/local/share/retroarch",
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
- else if (path_is_directory("/usr/share/retroarch/assets"))
+ else if (path_is_directory("@retroarch_assets_path@/share/retroarch/assets"))
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
- "/usr/share/retroarch",
+ "@retroarch_assets_path@/share/retroarch",
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
- else if (path_is_directory("/usr/local/share/games/retroarch/assets"))
+ else if (path_is_directory("@retroarch_assets_path@/local/share/games/retroarch/assets"))
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
- "/usr/local/share/games/retroarch",
+ "@retroarch_assets_path@/local/share/games/retroarch",
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
- else if (path_is_directory("/usr/share/games/retroarch/assets"))
+ else if (path_is_directory("@retroarch_assets_path@/share/games/retroarch/assets"))
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
- "/usr/share/games/retroarch",
+ "@retroarch_assets_path@/share/games/retroarch",
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
else
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], base_path,
--
2.38.1
+6 -1
View File
@@ -2193,7 +2193,12 @@ with pkgs;
callPackage ../applications/emulators/retroarch/wrapper.nix
{ inherit retroarch; };
retroarch = wrapRetroArch { retroarch = retroarchBare; };
retroarch = wrapRetroArch {
retroarch = retroarchBare.override {
withAssets = true;
withCoreInfo = true;
};
};
retroarch-assets = callPackage ../applications/emulators/retroarch/retroarch-assets.nix { };