gamescope: 3.12.5 -> 3.13.19, refactor

This mostly brings in changes from Jovian, but also splits the dependencies between the WSI layer
and the Gamescope executable, which simplifies i686 layer builds a whole lot.
This commit is contained in:
K900 2024-01-12 12:34:14 +03:00
parent feab837929
commit a1aae1ffb1
4 changed files with 83 additions and 59 deletions

View File

@ -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
xorg.libXcomposite
xorg.libXrender
xorg.libXext
xorg.libXxf86vm
xorg.libXtst
xorg.libXres
xorg.libXi
xorg.libXmu
libdrm
libliftoff
vulkan-loader
vulkan-headers
SDL2
pipewire
hwdata
xorg.libX11
wayland
wayland-protocols
vulkan-loader
openvr
glm
] ++ lib.optionals enableWsi [
vulkan-headers
] ++ lib.optionals enableExecutable [
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
xorg.libXext
xorg.libXi
xorg.libXmu
xorg.libXrender
xorg.libXres
xorg.libXtst
xorg.libXxf86vm
libdrm
libliftoff
SDL2
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
'';
# --debug-layers flag expects these in the path
postInstall = ''
postInstall = lib.optionalString enableExecutable ''
# --debug-layers flag expects these in the path
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";
};
}
})

View File

@ -0,0 +1,13 @@
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");

View File

@ -1,11 +1,9 @@
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',
],
)

View File

@ -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 { };