Unverified Commit f063e40d authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

ruffle: remove unneeded dependencies (#407724)

parents a78f91b5 d18a0c4b
Loading
Loading
Loading
Loading
+35 −39
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  stdenv,
  rustPlatform,
  withRuffleTools ? false,
  fetchFromGitHub,
  jre_minimal,
  pkg-config,
  wrapGAppsHook3,
  autoPatchelfHook,
  alsa-lib,
  gtk3,
  openssl,
  wayland,
  xorg,
  vulkan-loader,
  udev,
  libxkbcommon,
@@ -49,41 +48,21 @@ rustPlatform.buildRustPackage (finalAttrs: {

  nativeBuildInputs =
    [ jre_minimal ]
    ++ lib.optionals stdenvNoCC.hostPlatform.isLinux [
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      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
    gtk3
    openssl
    wayland
    vulkan-loader
    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
  openh264-241 =
    if stdenvNoCC.hostPlatform.isLinux then
    if stdenv.hostPlatform.isLinux then
      openh264.overrideAttrs (_: rec {
        version = "2.4.1";
        src = fetchFromGitHub {
@@ -92,20 +71,37 @@ rustPlatform.buildRustPackage (finalAttrs: {
          tag = "v${version}";
          hash = "sha256-ai7lcGcQQqpsLGSwHkSs7YAoEfGCIbxdClO6JpGA+MI=";
        };
        postPatch = null;
      })
    else
      null;

  preFixup = lib.optionalString stdenvNoCC.hostPlatform.isLinux ''
    gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${
      lib.makeLibraryPath [
  runtimeDependencies = [
    wayland
    xorg.libXcursor
    xorg.libXrandr
    xorg.libXi
    xorg.libX11
    xorg.libxcb
    libxkbcommon
        finalAttrs.openh264-241
    vulkan-loader
        wayland
      ]
    })
    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 = {