Merge pull request #259122 from spikespaz/prismlauncher-glfw-wayland
prismlauncher: add withWaylandGLFW override
This commit is contained in:
commit
6794a0533f
@ -1,9 +1,12 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, symlinkJoin
|
||||
, prismlauncher-unwrapped
|
||||
, makeWrapper
|
||||
, wrapQtAppsHook
|
||||
, addOpenGLRunpath
|
||||
|
||||
, prismlauncher-unwrapped
|
||||
|
||||
, qtbase # needed for wrapQtAppsHook
|
||||
, qtsvg
|
||||
, qtwayland
|
||||
@ -11,6 +14,7 @@
|
||||
, libpulseaudio
|
||||
, libGL
|
||||
, glfw
|
||||
, glfw-wayland-minecraft
|
||||
, openal
|
||||
, jdk8
|
||||
, jdk17
|
||||
@ -25,23 +29,43 @@
|
||||
, gamemodeSupport ? stdenv.isLinux
|
||||
, textToSpeechSupport ? stdenv.isLinux
|
||||
, controllerSupport ? stdenv.isLinux
|
||||
|
||||
# The flag `withWaylandGLFW` enables runtime-checking of `WAYLAND_DISPLAY`;
|
||||
# if the option is enabled, a patched version of GLFW will be added to
|
||||
# `LD_LIBRARY_PATH` so that the launcher can use the correct one
|
||||
# depending on the desktop environment used.
|
||||
, withWaylandGLFW ? false
|
||||
|
||||
, jdks ? [ jdk17 jdk8 ]
|
||||
, additionalLibs ? [ ]
|
||||
, additionalPrograms ? [ ]
|
||||
}:
|
||||
|
||||
assert lib.assertMsg (withWaylandGLFW -> stdenv.isLinux) "withWaylandGLFW is only available on Linux";
|
||||
|
||||
let
|
||||
prismlauncherFinal = prismlauncher-unwrapped.override {
|
||||
# By default, this package uses a binary wrapper for `wrapQtAppsHook`.
|
||||
# Enabling `shellWrapper` will add `makeWrapper` to `nativeBuildInputs`,
|
||||
# causing `wrapQtAppsHook` to output a shell wrapper instead.
|
||||
# This is needed for checking environment variables at runtime
|
||||
# and modifying others if necessary (see above option for example).
|
||||
# Warning: This can make the program start slower, by about four milliseconds.
|
||||
shellWrapper = withWaylandGLFW;
|
||||
|
||||
prismlauncher' = prismlauncher-unwrapped.override {
|
||||
inherit msaClientID gamemodeSupport;
|
||||
};
|
||||
in
|
||||
symlinkJoin {
|
||||
name = "prismlauncher-${prismlauncherFinal.version}";
|
||||
|
||||
paths = [ prismlauncherFinal ];
|
||||
symlinkJoin {
|
||||
name = "prismlauncher-${prismlauncher'.version}";
|
||||
|
||||
paths = [ prismlauncher' ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
wrapQtAppsHook
|
||||
];
|
||||
]
|
||||
++ lib.optional shellWrapper makeWrapper;
|
||||
|
||||
buildInputs = [
|
||||
qtbase
|
||||
@ -49,20 +73,29 @@ symlinkJoin {
|
||||
]
|
||||
++ lib.optional (lib.versionAtLeast qtbase.version "6" && stdenv.isLinux) qtwayland;
|
||||
|
||||
waylandPreExec = ''
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH"
|
||||
fi
|
||||
'';
|
||||
|
||||
postBuild = ''
|
||||
${lib.optionalString withWaylandGLFW ''
|
||||
qtWrapperArgs+=(--run "$waylandPreExec")
|
||||
''}
|
||||
|
||||
wrapQtAppsHook
|
||||
'';
|
||||
|
||||
qtWrapperArgs =
|
||||
let
|
||||
runtimeLibs = (with xorg; [
|
||||
libX11
|
||||
libXext
|
||||
libXcursor
|
||||
libXrandr
|
||||
libXxf86vm
|
||||
])
|
||||
++ [
|
||||
runtimeLibs = [
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXcursor
|
||||
xorg.libXrandr
|
||||
xorg.libXxf86vm
|
||||
|
||||
# lwjgl
|
||||
libpulseaudio
|
||||
libGL
|
||||
@ -93,5 +126,5 @@ symlinkJoin {
|
||||
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
|
||||
];
|
||||
|
||||
inherit (prismlauncherFinal) meta;
|
||||
inherit (prismlauncher') meta;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user