Unverified Commit c32f4a1f authored by K900's avatar K900 Committed by GitHub
Browse files

Merge pull request #280465 from K900/gamescope-refactor

gamescope: 3.12.5 -> 3.13.19, refactor
parents c9a80739 a1aae1ff
Loading
Loading
Loading
Loading
+56 −49
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@
, vulkan-loader
, vulkan-headers
, wayland
, wayland-scanner
, wayland-protocols
, libxkbcommon
, glm
@@ -16,11 +15,8 @@
, libcap
, SDL2
, pipewire
, udev
, pixman
, libinput
, seatd
, xwayland
, glslang
, hwdata
, openvr
@@ -30,32 +26,51 @@
, libdisplay-info
, lib
, makeBinaryWrapper
, enableExecutable ? true
, enableWsi ? true
}:
let
  pname = "gamescope";
  version = "3.12.5";

  vkroots = fetchFromGitHub {
  joshShaders = fetchFromGitHub {
    owner = "Joshua-Ashton";
    repo = "vkroots";
    rev = "26757103dde8133bab432d172b8841df6bb48155";
    hash = "sha256-eet+FMRO2aBQJcCPOKNKGuQv5oDIrgdVPRO00c5gkL0=";
    repo = "GamescopeShaders";
    rev = "v0.1";
    hash = "sha256-gR1AeAHV/Kn4ntiEDUSPxASLMFusV6hgSGrTbMCBUZA=";
  };
in
stdenv.mkDerivation {
  inherit pname version;
stdenv.mkDerivation (finalAttrs: {
  pname = "gamescope";
  version = "3.13.19";

  src = fetchFromGitHub {
    owner = "ValveSoftware";
    repo = "gamescope";
    rev = "refs/tags/${version}";
    hash = "sha256-u4pnKd5ZEC3CS3E2i8E8Wposd8Tu4ZUoQXFmr0runwE=";
    rev = "refs/tags/${finalAttrs.version}";
    fetchSubmodules = true;
    hash = "sha256-WKQgVbuHvTbZnvTU5imV35AKZ4AF0EDsdESBZwVH7+M=";
  };

  patches = [
    # Unvendor dependencies
    ./use-pkgconfig.patch

    # Make it look for shaders in the right place
    ./shaders-path.patch
  ];

  # We can't substitute the patch itself because substituteAll is itself a derivation,
  # so `placeholder "out"` ends up pointing to the wrong place
  postPatch = ''
    substituteInPlace src/reshade_effect_manager.cpp --replace "@out@" "$out"
  '';

  mesonFlags = [
    (lib.mesonBool "enable_gamescope" enableExecutable)
    (lib.mesonBool "enable_gamescope_wsi_layer" enableWsi)
  ];

  # don't install vendored vkroots etc
  mesonInstallFlags = ["--skip-subprojects"];

  strictDeps = true;

  depsBuildBuild = [
@@ -66,70 +81,62 @@ stdenv.mkDerivation {
    meson
    pkg-config
    ninja
    wayland-scanner
    glslang
  ] ++ lib.optionals enableExecutable [
    makeBinaryWrapper
    glslang
  ];

  buildInputs = [
    xorg.libXdamage
    pipewire
    hwdata
    xorg.libX11
    wayland
    wayland-protocols
    vulkan-loader
    openvr
    glm
  ] ++ lib.optionals enableWsi [
    vulkan-headers
  ] ++ lib.optionals enableExecutable [
    xorg.libXcomposite
    xorg.libXrender
    xorg.libXcursor
    xorg.libXdamage
    xorg.libXext
    xorg.libXxf86vm
    xorg.libXtst
    xorg.libXres
    xorg.libXi
    xorg.libXmu
    xorg.libXrender
    xorg.libXres
    xorg.libXtst
    xorg.libXxf86vm
    libdrm
    libliftoff
    vulkan-loader
    vulkan-headers
    SDL2
    wayland
    wayland-protocols
    wlroots
    xwayland
    seatd
    libinput
    libxkbcommon
    glm
    gbenchmark
    udev
    pixman
    pipewire
    libcap
    stb
    hwdata
    openvr
    vkroots
    libdisplay-info
  ];

  outputs = [ "out" "lib" ];

  postUnpack = ''
    rm -rf source/subprojects/vkroots
    ln -s ${vkroots} source/subprojects/vkroots
  '';

  postInstall = lib.optionalString enableExecutable ''
    # --debug-layers flag expects these in the path
  postInstall = ''
    wrapProgram "$out/bin/gamescope" \
      --prefix PATH : ${with xorg; lib.makeBinPath [xprop xwininfo]}

    # Install Vulkan layer in lib output
    install -d $lib/share/vulkan
    mv $out/share/vulkan/implicit_layer.d $lib/share/vulkan
    rm -r $out/share/vulkan
    # Install ReShade shaders
    mkdir -p $out/share/gamescope/reshade
    cp -r ${joshShaders}/* $out/share/gamescope/reshade/
  '';

  meta = with lib; {
    description = "SteamOS session compositing window manager";
    homepage = "https://github.com/ValveSoftware/gamescope";
    license = licenses.bsd2;
    maintainers = with maintainers; [ nrdxp pedrohlc Scrumplex zhaofengli ];
    maintainers = with maintainers; [ nrdxp pedrohlc Scrumplex zhaofengli k900 ];
    platforms = platforms.linux;
    mainProgram = "gamescope";
  };
}
})
+13 −0
Original line number Diff line number Diff line
diff --git a/src/reshade_effect_manager.cpp b/src/reshade_effect_manager.cpp
index 3597ca1..de45250 100644
--- a/src/reshade_effect_manager.cpp
+++ b/src/reshade_effect_manager.cpp
@@ -34,7 +34,7 @@ static std::string GetLocalUsrDir()

 static std::string GetUsrDir()
 {
-    return "/usr";
+    return "@out@";
 }

 static LogScope reshade_log("gamescope_reshade");
+2 −4
Original line number Diff line number Diff line
diff --git a/meson.build b/meson.build
index 1311784..77043ac 100644
--- a/meson.build
+++ b/meson.build
@@ -6,7 +6,6 @@ project(
   default_options: [
     'cpp_std=c++14',
     'cpp_std=c++20',
     'warning_level=2',
-    'force_fallback_for=wlroots,libliftoff',
-    'force_fallback_for=wlroots,libliftoff,vkroots',
   ],
 )
+7 −1
Original line number Diff line number Diff line
@@ -1812,7 +1812,13 @@ with pkgs;
  };
  gamescope = callPackage ../applications/window-managers/gamescope {
    wlroots = wlroots_0_16;
    enableExecutable = true;
    enableWsi = false;
  };
  gamescope-wsi = callPackage ../applications/window-managers/gamescope {
    enableExecutable = false;
    enableWsi = true;
  };
  gay = callPackage ../tools/misc/gay {  };