From 3e77df99289add39fa4ccabdd4ad438e9db3524f Mon Sep 17 00:00:00 2001 From: liberodark Date: Sat, 22 Feb 2025 21:10:15 +0100 Subject: [PATCH] ruffle: nightly-2025-01-25 -> nightly-2025-03-28 --- pkgs/by-name/ru/ruffle/package.nix | 221 +++++++++--------- .../ruffle/remove-deterministic-feature.patch | 52 ----- 2 files changed, 108 insertions(+), 165 deletions(-) delete mode 100644 pkgs/by-name/ru/ruffle/remove-deterministic-feature.patch diff --git a/pkgs/by-name/ru/ruffle/package.nix b/pkgs/by-name/ru/ruffle/package.nix index 5bda1d81b3c6..a6d38c66de49 100644 --- a/pkgs/by-name/ru/ruffle/package.nix +++ b/pkgs/by-name/ru/ruffle/package.nix @@ -1,31 +1,90 @@ { - alsa-lib, - fetchFromGitHub, - makeWrapper, - openssl, - pkg-config, - python3, - rustPlatform, - stdenvNoCC, lib, + stdenvNoCC, + rustPlatform, + withRuffleTools ? false, + fetchFromGitHub, + jre_minimal, + pkg-config, + wrapGAppsHook3, + darwin, + alsa-lib, + gtk3, + openssl, wayland, - xorg, vulkan-loader, udev, - jre_minimal, - cairo, - gtk3, - wrapGAppsHook3, - gsettings-desktop-schemas, - glib, libxkbcommon, openh264, - darwin, + writeShellApplication, + curl, + jq, + nix-update, }: -let +rustPlatform.buildRustPackage (finalAttrs: { pname = "ruffle"; - version = "nightly-2025-01-25"; - # TODO: Remove overridden derivation once ruffle accepts upstream openh264-2.5.0 + version = "0-nightly-2025-03-28"; + + src = fetchFromGitHub { + owner = "ruffle-rs"; + repo = "ruffle"; + tag = lib.strings.removePrefix "0-" finalAttrs.version; + hash = "sha256-p2EEoHXseIXms4Xjyi3aNWCU0W9slXkeqrCrPvq1BjI="; + }; + + useFetchCargoVendor = true; + cargoHash = "sha256-RcCIt6xVZaQA7eSgKngHtsGafHFwv1bISK0XKWoNWtI="; + cargoBuildFlags = lib.optional withRuffleTools "--workspace"; + + env = + let + tag = lib.strings.removePrefix "0-" finalAttrs.version; + versionDate = lib.strings.removePrefix "0-nightly-" finalAttrs.version; + in + { + VERGEN_IDEMPOTENT = "1"; + VERGEN_GIT_SHA = tag; + VERGEN_GIT_COMMIT_DATE = versionDate; + VERGEN_GIT_COMMIT_TIMESTAMP = "${versionDate}T00:00:00Z"; + }; + + nativeBuildInputs = + [ jre_minimal ] + ++ lib.optionals stdenvNoCC.hostPlatform.isLinux [ + pkg-config + wrapGAppsHook3 + ] + ++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [ rustPlatform.bindgenHook ]; + + buildInputs = + lib.optionals stdenvNoCC.hostPlatform.isLinux [ + alsa-lib + gtk3 + openssl + wayland + vulkan-loader + udev + ] + ++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.AppKit ]; + + 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 openh264-241 = if stdenvNoCC.hostPlatform.isLinux then openh264.overrideAttrs (_: rec { @@ -40,99 +99,35 @@ let }) else null; -in -rustPlatform.buildRustPackage { - inherit pname version; - - src = fetchFromGitHub { - owner = "ruffle-rs"; - repo = pname; - tag = version; - hash = "sha256-JLh0tatP70rYo2QXLKu6M9jJ1gFpY76sYaUJqW9U4E0="; - }; - - patches = [ ./remove-deterministic-feature.patch ]; - - useFetchCargoVendor = true; - cargoHash = "sha256-PbNp/V+xmU6Lo24a6pd9XoT/LQmINztjOHKoikG9N4Y="; - - nativeBuildInputs = - [ jre_minimal ] - ++ lib.optionals stdenvNoCC.hostPlatform.isLinux [ - glib - gsettings-desktop-schemas - makeWrapper - pkg-config - python3 - wrapGAppsHook3 - ] - ++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [ rustPlatform.bindgenHook ]; - - buildInputs = - lib.optionals stdenvNoCC.hostPlatform.isLinux [ - alsa-lib - cairo - gtk3 - openssl - wayland - xorg.libX11 - xorg.libXcursor - xorg.libXi - xorg.libxcb - xorg.libXrender - vulkan-loader - udev - ] - ++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.AppKit ]; - - cargoBuildFlags = [ "--workspace" ]; - - postInstall = - '' - # Namespace binaries with "ruffle_" - mv $out/bin/exporter $out/bin/ruffle_exporter - mv $out/bin/mocket $out/bin/ruffle_mocket - mv $out/bin/stub-report $out/bin/ruffle_stub-report - mv $out/bin/build_playerglobal $out/bin/ruffle_build_playerglobal - - # This name is too specific - mv $out/bin/ruffle_desktop $out/bin/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/ - - rm $out/bin/ruffle_web_safari - ''; preFixup = lib.optionalString stdenvNoCC.hostPlatform.isLinux '' - patchelf $out/bin/ruffle \ - --add-needed libxkbcommon-x11.so \ - --add-needed libwayland-client.so \ - --add-needed libopenh264.so \ - --add-rpath ${libxkbcommon}/lib:${wayland}/lib:${openh264-241}/lib + gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${ + lib.makeLibraryPath [ + libxkbcommon + finalAttrs.openh264-241 + vulkan-loader + wayland + ] + }) ''; - dontWrapGApps = true; - - postFixup = lib.optionalString stdenvNoCC.hostPlatform.isLinux '' - vulkanWrapperArgs+=( - --prefix LD_LIBRARY_PATH ':' ${vulkan-loader}/lib - ) - - wrapProgram $out/bin/ruffle_exporter \ - "''${vulkanWrapperArgs[@]}" - - wrapProgram $out/bin/ruffle \ - "''${vulkanWrapperArgs[@]}" \ - "''${gappsWrapperArgs[@]}" - ''; + passthru = { + updateScript = lib.getExe (writeShellApplication { + name = "ruffle-update"; + runtimeInputs = [ + curl + jq + nix-update + ]; + text = '' + version="$( \ + curl https://api.github.com/repos/ruffle-rs/ruffle/releases?per_page=1 | \ + jq -r ".[0].tag_name" \ + )" + exec nix-update --version "0-$version" ruffle + ''; + }); + }; meta = { description = "Cross platform Adobe Flash Player emulator"; @@ -142,13 +137,13 @@ rustPlatform.buildRustPackage { and 3 programs with machine-native performance thanks to being written in the Rust programming language. - This package for ruffle also includes the `exporter` and - `scanner` utilities which allow for generating screenshots as - PNGs and parsing `.swf` files in bulk respectively. + Additionally, overriding the `withRuffleTools` input to + `true` will build all the available packages in the ruffle + project, including the `exporter` and `scanner` utilities. ''; homepage = "https://ruffle.rs/"; downloadPage = "https://ruffle.rs/downloads"; - changelog = "https://github.com/ruffle-rs/ruffle/releases/tag/${version}"; + changelog = "https://github.com/ruffle-rs/ruffle/releases/tag/${lib.strings.removePrefix "0-" finalAttrs.version}"; license = [ lib.licenses.mit lib.licenses.asl20 @@ -160,4 +155,4 @@ rustPlatform.buildRustPackage { mainProgram = "ruffle"; platforms = lib.platforms.linux ++ lib.platforms.darwin; }; -} +}) diff --git a/pkgs/by-name/ru/ruffle/remove-deterministic-feature.patch b/pkgs/by-name/ru/ruffle/remove-deterministic-feature.patch deleted file mode 100644 index 804bc46c22be..000000000000 --- a/pkgs/by-name/ru/ruffle/remove-deterministic-feature.patch +++ /dev/null @@ -1,52 +0,0 @@ -diff --git a/exporter/Cargo.toml b/exporter/Cargo.toml -index 93066a30d..0f8b71ae4 100644 ---- a/exporter/Cargo.toml -+++ b/exporter/Cargo.toml -@@ -13,7 +13,7 @@ workspace = true - [dependencies] - clap = { workspace = true } - futures = { workspace = true } --ruffle_core = { path = "../core", features = ["deterministic", "default_font"] } -+ruffle_core = { path = "../core", features = ["default_font"] } - ruffle_render_wgpu = { path = "../render/wgpu", features = ["clap"] } - image = { workspace = true, features = ["png"] } - walkdir = { workspace = true } -diff --git a/scanner/Cargo.toml b/scanner/Cargo.toml -index 59781ba79..40cf54c24 100644 ---- a/scanner/Cargo.toml -+++ b/scanner/Cargo.toml -@@ -12,7 +12,7 @@ workspace = true - - [dependencies] - clap = { workspace = true } --ruffle_core = { path = "../core", features = ["deterministic"] } -+ruffle_core = { path = "../core" } - log = { workspace = true } - walkdir = { workspace = true } - serde = { workspace = true, features = ["derive"] } -diff --git a/tests/Cargo.toml b/tests/Cargo.toml -index 26bfc9a89..b7342b662 100644 ---- a/tests/Cargo.toml -+++ b/tests/Cargo.toml -@@ -27,7 +27,7 @@ ruffle_render_wgpu = { path = "../render/wgpu", optional = true } - regex = "1.11.1" - - [dev-dependencies] --ruffle_core = { path = "../core", features = ["deterministic", "timeline_debug", "avm_debug", "audio", "mp3", "aac", "default_font", "test_only_as3"] } -+ruffle_core = { path = "../core", features = ["timeline_debug", "avm_debug", "audio", "mp3", "aac", "default_font", "test_only_as3"] } - ruffle_test_framework = { path = "framework" } - libtest-mimic = "0.8.1" - walkdir = { workspace = true } -diff --git a/tests/framework/Cargo.toml b/tests/framework/Cargo.toml -index ffc59e25b..639028578 100644 ---- a/tests/framework/Cargo.toml -+++ b/tests/framework/Cargo.toml -@@ -11,7 +11,7 @@ version.workspace = true - workspace = true - - [dependencies] --ruffle_core = { path = "../../core", features = ["deterministic", "timeline_debug", "avm_debug", "audio", "mp3", "aac", "default_font", "serde"] } -+ruffle_core = { path = "../../core", features = ["timeline_debug", "avm_debug", "audio", "mp3", "aac", "default_font", "serde"] } - ruffle_render = { path = "../../render", features = ["serde"] } - ruffle_input_format = { path = "../input-format" } - ruffle_socket_format = { path = "../socket-format" } \ No newline at end of file