ruffle: refactor to correct dependencies

(cherry picked from commit d18a0c4b36)
This commit is contained in:
JS (normalc/ea) 2025-05-16 16:39:59 -04:00 committed by github-actions[bot]
parent a59eb78007
commit 12637abcd4

View file

@ -1,16 +1,15 @@
{ {
lib, lib,
stdenvNoCC, stdenv,
rustPlatform, rustPlatform,
withRuffleTools ? false, withRuffleTools ? false,
fetchFromGitHub, fetchFromGitHub,
jre_minimal, jre_minimal,
pkg-config, pkg-config,
wrapGAppsHook3, autoPatchelfHook,
alsa-lib, alsa-lib,
gtk3,
openssl,
wayland, wayland,
xorg,
vulkan-loader, vulkan-loader,
udev, udev,
libxkbcommon, libxkbcommon,
@ -49,19 +48,43 @@ rustPlatform.buildRustPackage (finalAttrs: {
nativeBuildInputs = nativeBuildInputs =
[ jre_minimal ] [ jre_minimal ]
++ lib.optionals stdenvNoCC.hostPlatform.isLinux [ ++ lib.optionals stdenv.hostPlatform.isLinux [
pkg-config pkg-config
wrapGAppsHook3 autoPatchelfHook
] ]
++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [ rustPlatform.bindgenHook ]; ++ lib.optionals stdenv.hostPlatform.isDarwin [ rustPlatform.bindgenHook ];
buildInputs = lib.optionals stdenvNoCC.hostPlatform.isLinux [ buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib alsa-lib
gtk3
openssl
wayland
vulkan-loader
udev udev
(lib.getLib stdenv.cc.cc)
];
# Prevents ruffle from downloading openh264 at runtime for Linux
openh264-241 =
if stdenv.hostPlatform.isLinux then
openh264.overrideAttrs (_: rec {
version = "2.4.1";
src = fetchFromGitHub {
owner = "cisco";
repo = "openh264";
tag = "v${version}";
hash = "sha256-ai7lcGcQQqpsLGSwHkSs7YAoEfGCIbxdClO6JpGA+MI=";
};
})
else
null;
runtimeDependencies = [
wayland
xorg.libXcursor
xorg.libXrandr
xorg.libXi
xorg.libX11
xorg.libxcb
libxkbcommon
vulkan-loader
finalAttrs.openh264-241
]; ];
postInstall = postInstall =
@ -70,7 +93,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
install -Dm644 LICENSE.md -t $out/share/doc/ruffle install -Dm644 LICENSE.md -t $out/share/doc/ruffle
install -Dm644 README.md -t $out/share/doc/ruffle install -Dm644 README.md -t $out/share/doc/ruffle
'' ''
+ lib.optionalString stdenvNoCC.hostPlatform.isLinux '' + lib.optionalString stdenv.hostPlatform.isLinux ''
install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.desktop \ install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.desktop \
-t $out/share/applications/ -t $out/share/applications/
@ -81,33 +104,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
-t $out/share/metainfo/ -t $out/share/metainfo/
''; '';
# Prevents ruffle from downloading openh264 at runtime for Linux
openh264-241 =
if stdenvNoCC.hostPlatform.isLinux then
openh264.overrideAttrs (_: rec {
version = "2.4.1";
src = fetchFromGitHub {
owner = "cisco";
repo = "openh264";
tag = "v${version}";
hash = "sha256-ai7lcGcQQqpsLGSwHkSs7YAoEfGCIbxdClO6JpGA+MI=";
};
postPatch = null;
})
else
null;
preFixup = lib.optionalString stdenvNoCC.hostPlatform.isLinux ''
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [
libxkbcommon
finalAttrs.openh264-241
vulkan-loader
wayland
]
})
'';
passthru = { passthru = {
updateScript = lib.getExe (writeShellApplication { updateScript = lib.getExe (writeShellApplication {
name = "ruffle-update"; name = "ruffle-update";