ruffle: drop openh264 override; add x11 argument; fix version (#448931)

This commit is contained in:
Colin
2025-10-11 03:29:41 +00:00
committed by GitHub

View File

@@ -2,14 +2,17 @@
lib,
stdenv,
rustPlatform,
withRuffleTools ? false,
fetchFromGitHub,
jre_minimal,
pkg-config,
autoPatchelfHook,
alsa-lib,
wayland,
xorg,
libXcursor,
libXrandr,
libXi,
libX11,
libxcb,
vulkan-loader,
udev,
libxkbcommon,
@@ -18,25 +21,41 @@
curl,
jq,
nix-update,
withX11 ? true,
withRuffleTools ? false,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "ruffle";
version = "0.2-nightly-2025-10-05";
version = "0.2.0-nightly-2025-10-05";
src = fetchFromGitHub {
owner = "ruffle-rs";
repo = "ruffle";
tag = lib.strings.removePrefix "0.2-" finalAttrs.version;
tag = lib.strings.removePrefix "0.2.0-" finalAttrs.version;
hash = "sha256-u12Qfc0fmcs7TU35/gqfRxjSpw9SDbc4+ebR7lGpvJI=";
};
postPatch =
let
versionList = lib.versions.splitVersion openh264.version;
major = lib.elemAt versionList 0;
minor = lib.elemAt versionList 1;
patch = lib.elemAt versionList 2;
in
''
substituteInPlace video/external/src/decoder/openh264.rs \
--replace-fail "OpenH264Version(2, 4, 1)" \
"OpenH264Version(${major}, ${minor}, ${patch})"
'';
cargoHash = "sha256-v/3vf7YYJiz+PMBsznvOJsNLtv6bEQ9pffAI33rLVuw=";
cargoBuildFlags = lib.optional withRuffleTools "--workspace";
env =
let
tag = lib.strings.removePrefix "0.2-" finalAttrs.version;
versionDate = lib.strings.removePrefix "0.2-nightly-" finalAttrs.version;
tag = lib.strings.removePrefix "0.2.0-" finalAttrs.version;
versionDate = lib.strings.removePrefix "0.2.0-nightly-" finalAttrs.version;
in
{
VERGEN_IDEMPOTENT = "1";
@@ -60,32 +79,21 @@ rustPlatform.buildRustPackage (finalAttrs: {
(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 = lib.optionals stdenv.hostPlatform.isLinux [
runtimeDependencies = lib.optionals stdenv.hostPlatform.isLinux (
[
wayland
xorg.libXcursor
xorg.libXrandr
xorg.libXi
xorg.libX11
xorg.libxcb
libxkbcommon
vulkan-loader
finalAttrs.openh264-241
];
openh264
]
++ lib.optionals withX11 [
libXcursor
libXrandr
libXi
libX11
libxcb
]
);
postInstall = ''
mv $out/bin/ruffle_desktop $out/bin/ruffle
@@ -116,7 +124,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
curl https://api.github.com/repos/ruffle-rs/ruffle/releases?per_page=1 | \
jq -r ".[0].tag_name" \
)"
exec nix-update --version "0.2-$version" ruffle
exec nix-update --version "0.2.0-$version" ruffle
'';
});
};
@@ -135,11 +143,11 @@ rustPlatform.buildRustPackage (finalAttrs: {
'';
homepage = "https://ruffle.rs/";
downloadPage = "https://ruffle.rs/downloads";
changelog = "https://github.com/ruffle-rs/ruffle/releases/tag/${lib.strings.removePrefix "0.2" finalAttrs.version}";
license = [
lib.licenses.mit
lib.licenses.asl20
];
changelog = "https://github.com/ruffle-rs/ruffle/releases/tag/${lib.strings.removePrefix "0.2.0-" finalAttrs.version}";
maintainers = [
lib.maintainers.jchw
lib.maintainers.normalcea