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,41 +48,21 @@ 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)
]; ];
postInstall =
''
mv $out/bin/ruffle_desktop $out/bin/ruffle
install -Dm644 LICENSE.md -t $out/share/doc/ruffle
install -Dm644 README.md -t $out/share/doc/ruffle
''
+ lib.optionalString stdenvNoCC.hostPlatform.isLinux ''
install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.desktop \
-t $out/share/applications/
install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.svg \
-t $out/share/icons/hicolor/scalable/apps/
install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.metainfo.xml \
-t $out/share/metainfo/
'';
# Prevents ruffle from downloading openh264 at runtime for Linux # Prevents ruffle from downloading openh264 at runtime for Linux
openh264-241 = openh264-241 =
if stdenvNoCC.hostPlatform.isLinux then if stdenv.hostPlatform.isLinux then
openh264.overrideAttrs (_: rec { openh264.overrideAttrs (_: rec {
version = "2.4.1"; version = "2.4.1";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -92,20 +71,37 @@ rustPlatform.buildRustPackage (finalAttrs: {
tag = "v${version}"; tag = "v${version}";
hash = "sha256-ai7lcGcQQqpsLGSwHkSs7YAoEfGCIbxdClO6JpGA+MI="; hash = "sha256-ai7lcGcQQqpsLGSwHkSs7YAoEfGCIbxdClO6JpGA+MI=";
}; };
postPatch = null;
}) })
else else
null; null;
preFixup = lib.optionalString stdenvNoCC.hostPlatform.isLinux '' runtimeDependencies = [
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [
libxkbcommon
finalAttrs.openh264-241
vulkan-loader
wayland wayland
] xorg.libXcursor
}) xorg.libXrandr
xorg.libXi
xorg.libX11
xorg.libxcb
libxkbcommon
vulkan-loader
finalAttrs.openh264-241
];
postInstall =
''
mv $out/bin/ruffle_desktop $out/bin/ruffle
install -Dm644 LICENSE.md -t $out/share/doc/ruffle
install -Dm644 README.md -t $out/share/doc/ruffle
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.desktop \
-t $out/share/applications/
install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.svg \
-t $out/share/icons/hicolor/scalable/apps/
install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.metainfo.xml \
-t $out/share/metainfo/
''; '';
passthru = { passthru = {