gamemode: Apply fixes from the unstable upstream

This commit is contained in:
PapaTutuWawa 2021-08-23 20:28:24 +02:00
parent f99c6dcea9
commit 25b4dcac69
2 changed files with 31 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ stdenv, lib,
meson, ninja, dbus, systemd, pkgconfig, cmake, inih,
fetchFromGitHub }:
fetchFromGitHub, fetchpatch }:
stdenv.mkDerivation rec {
pname = "gamemode";
@ -13,6 +13,14 @@ stdenv.mkDerivation rec {
sha256 = "17dck7dzkmzq52f2yrs930fdg2inr7nipvnwpd0jqrwgk2fhwk9z";
};
patches = [
(fetchpatch {
url = "https://github.com/FeralInteractive/gamemode/commit/be44b7091baa33be6dda60392e4c06c2f398ee72.patch";
sha256 = "TlDUETs4+N3pvrVd0FQGlGmC+6ByhJ2E7gKXa7suBtE=";
})
./preload-nix-workaround.patch
];
nativeBuildInputs = [
meson ninja pkgconfig cmake
];
@ -21,7 +29,16 @@ stdenv.mkDerivation rec {
dbus systemd inih
];
mesonFlags = [ "-Dwith-systemd-user-unit-dir=${placeholder "out"}/lib/systemd/user" ];
mesonFlags = [
"-Dwith-systemd-user-unit-dir=${placeholder "out"}/lib/systemd/user"
];
postPatch = ''
substituteInPlace data/gamemoderun \
--subst-var-by libraryPath ${lib.makeLibraryPath ([
(placeholder "lib")
])}
'';
meta = with lib; {
description = "Optimise Linux system performance on demand";

View File

@ -0,0 +1,12 @@
diff --git a/data/gamemoderun b/data/gamemoderun
index 573b3e4..6f2799e 100755
--- a/data/gamemoderun
+++ b/data/gamemoderun
@@ -5,5 +5,6 @@ GAMEMODEAUTO_NAME="libgamemodeauto.so.0"
# ld will find the right path to load the library, including for 32-bit apps.
LD_PRELOAD="${GAMEMODEAUTO_NAME}${LD_PRELOAD:+:$LD_PRELOAD}"
+LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
-exec env LD_PRELOAD="${LD_PRELOAD}" $GAMEMODERUNEXEC "$@"
+exec env LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" $GAMEMODERUNEXEC "$@"