mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
prismlauncher: refactor
this primarily reorders arguments and items in lists, fixes the meta-attributes of the wrapped version of the package, tidies up some comments, and adds new ones to better explain why we do certain things
This commit is contained in:
parent
88039bb875
commit
40581e9eed
@ -2,21 +2,23 @@
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
stripJavaArchivesHook,
|
||||
cmake,
|
||||
cmark,
|
||||
darwin,
|
||||
extra-cmake-modules,
|
||||
gamemode,
|
||||
ghc_filesystem,
|
||||
jdk17,
|
||||
kdePackages,
|
||||
ninja,
|
||||
jdk17,
|
||||
zlib,
|
||||
extra-cmake-modules,
|
||||
stripJavaArchivesHook,
|
||||
tomlplusplus,
|
||||
ghc_filesystem,
|
||||
gamemode,
|
||||
zlib,
|
||||
|
||||
msaClientID ? null,
|
||||
gamemodeSupport ? stdenv.isLinux,
|
||||
}:
|
||||
|
||||
let
|
||||
libnbtplusplus = fetchFromGitHub {
|
||||
owner = "PrismLauncher";
|
||||
@ -27,8 +29,8 @@ let
|
||||
in
|
||||
|
||||
assert lib.assertMsg (
|
||||
stdenv.isLinux || !gamemodeSupport
|
||||
) "gamemodeSupport is only available on Linux";
|
||||
gamemodeSupport -> stdenv.isLinux
|
||||
) "gamemodeSupport is only available on Linux!";
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "prismlauncher-unwrapped";
|
||||
@ -41,24 +43,30 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-460hB91M2hZm+uU1tywJEj20oRd5cz/NDvya8/vJdSA=";
|
||||
};
|
||||
|
||||
postUnpack = ''
|
||||
rm -rf source/libraries/libnbtplusplus
|
||||
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
extra-cmake-modules
|
||||
cmake
|
||||
jdk17
|
||||
ninja
|
||||
extra-cmake-modules
|
||||
jdk17
|
||||
stripJavaArchivesHook
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
kdePackages.qtbase
|
||||
zlib
|
||||
kdePackages.quazip
|
||||
ghc_filesystem
|
||||
tomlplusplus
|
||||
cmark
|
||||
ghc_filesystem
|
||||
kdePackages.qtbase
|
||||
kdePackages.quazip
|
||||
tomlplusplus
|
||||
zlib
|
||||
]
|
||||
++ lib.optional gamemodeSupport gamemode
|
||||
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ];
|
||||
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
|
||||
++ lib.optional gamemodeSupport gamemode;
|
||||
|
||||
hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ];
|
||||
|
||||
@ -72,34 +80,31 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
"-DLauncher_QT_VERSION_MAJOR=5"
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
# we wrap our binary manually
|
||||
"-DINSTALL_BUNDLE=nodeps"
|
||||
# disable built-in updater
|
||||
"-DMACOSX_SPARKLE_UPDATE_FEED_URL=''"
|
||||
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/Applications/"
|
||||
];
|
||||
|
||||
postUnpack = ''
|
||||
rm -rf source/libraries/libnbtplusplus
|
||||
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
|
||||
'';
|
||||
|
||||
dontWrapQtApps = true;
|
||||
|
||||
meta = {
|
||||
mainProgram = "prismlauncher";
|
||||
homepage = "https://prismlauncher.org/";
|
||||
description = "Free, open source launcher for Minecraft";
|
||||
longDescription = ''
|
||||
Allows you to have multiple, separate instances of Minecraft (each with
|
||||
their own mods, texture packs, saves, etc) and helps you manage them and
|
||||
their associated options with a simple interface.
|
||||
'';
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${finalAttrs.version}";
|
||||
homepage = "https://prismlauncher.org/";
|
||||
changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${finalAttrs.src.rev}";
|
||||
license = lib.licenses.gpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
minion3665
|
||||
Scrumplex
|
||||
getchoo
|
||||
];
|
||||
mainProgram = "prismlauncher";
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
};
|
||||
})
|
||||
|
@ -2,33 +2,38 @@
|
||||
lib,
|
||||
stdenv,
|
||||
symlinkJoin,
|
||||
makeWrapper,
|
||||
addOpenGLRunpath,
|
||||
|
||||
prismlauncher-unwrapped,
|
||||
|
||||
kdePackages,
|
||||
xorg,
|
||||
libpulseaudio,
|
||||
libGL,
|
||||
addOpenGLRunpath,
|
||||
flite,
|
||||
gamemode,
|
||||
glfw,
|
||||
glfw-wayland-minecraft,
|
||||
openal,
|
||||
glxinfo,
|
||||
jdk8,
|
||||
jdk17,
|
||||
jdk21,
|
||||
gamemode,
|
||||
flite,
|
||||
glxinfo,
|
||||
kdePackages,
|
||||
libGL,
|
||||
libpulseaudio,
|
||||
libusb1,
|
||||
makeWrapper,
|
||||
openal,
|
||||
pciutils,
|
||||
udev,
|
||||
vulkan-loader,
|
||||
libusb1,
|
||||
xorg,
|
||||
|
||||
msaClientID ? null,
|
||||
gamemodeSupport ? stdenv.isLinux,
|
||||
textToSpeechSupport ? stdenv.isLinux,
|
||||
additionalLibs ? [ ],
|
||||
additionalPrograms ? [ ],
|
||||
controllerSupport ? stdenv.isLinux,
|
||||
gamemodeSupport ? stdenv.isLinux,
|
||||
jdks ? [
|
||||
jdk21
|
||||
jdk17
|
||||
jdk8
|
||||
],
|
||||
msaClientID ? null,
|
||||
textToSpeechSupport ? stdenv.isLinux,
|
||||
|
||||
# Adds `glfw-wayland-minecraft` to `LD_LIBRARY_PATH`
|
||||
# when launched on wayland, allowing for the game to be run natively.
|
||||
@ -38,19 +43,11 @@
|
||||
# Warning: This build of glfw may be unstable, and the launcher
|
||||
# itself can take slightly longer to start
|
||||
withWaylandGLFW ? false,
|
||||
|
||||
jdks ? [
|
||||
jdk21
|
||||
jdk17
|
||||
jdk8
|
||||
],
|
||||
additionalLibs ? [ ],
|
||||
additionalPrograms ? [ ],
|
||||
}:
|
||||
|
||||
assert lib.assertMsg (
|
||||
withWaylandGLFW -> stdenv.isLinux
|
||||
) "withWaylandGLFW is only available on Linux";
|
||||
) "withWaylandGLFW is only available on Linux!";
|
||||
|
||||
let
|
||||
prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
|
||||
@ -76,59 +73,71 @@ symlinkJoin {
|
||||
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux
|
||||
) kdePackages.qtwayland;
|
||||
|
||||
waylandPreExec = lib.optionalString withWaylandGLFW ''
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH"
|
||||
fi
|
||||
'';
|
||||
env = {
|
||||
waylandPreExec = lib.optionalString withWaylandGLFW ''
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
postBuild = ''
|
||||
${lib.optionalString withWaylandGLFW ''
|
||||
postBuild =
|
||||
lib.optionalString withWaylandGLFW ''
|
||||
qtWrapperArgs+=(--run "$waylandPreExec")
|
||||
''}
|
||||
|
||||
wrapQtAppsHook
|
||||
'';
|
||||
''
|
||||
+ ''
|
||||
wrapQtAppsHook
|
||||
'';
|
||||
|
||||
qtWrapperArgs =
|
||||
let
|
||||
runtimeLibs =
|
||||
[
|
||||
# lwjgl
|
||||
glfw
|
||||
libpulseaudio
|
||||
libGL
|
||||
openal
|
||||
stdenv.cc.cc.lib
|
||||
|
||||
vulkan-loader # VulkanMod's lwjgl
|
||||
|
||||
udev # oshi
|
||||
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXcursor
|
||||
xorg.libXrandr
|
||||
xorg.libXxf86vm
|
||||
|
||||
# lwjgl
|
||||
libpulseaudio
|
||||
libGL
|
||||
glfw
|
||||
openal
|
||||
stdenv.cc.cc.lib
|
||||
vulkan-loader # VulkanMod's lwjgl
|
||||
|
||||
# oshi
|
||||
udev
|
||||
]
|
||||
++ lib.optional gamemodeSupport gamemode.lib
|
||||
++ lib.optional textToSpeechSupport flite
|
||||
++ lib.optional gamemodeSupport gamemode.lib
|
||||
++ lib.optional controllerSupport libusb1
|
||||
++ additionalLibs;
|
||||
|
||||
runtimePrograms = [
|
||||
xorg.xrandr
|
||||
glxinfo
|
||||
pciutils # need lspci
|
||||
xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||
] ++ additionalPrograms;
|
||||
|
||||
in
|
||||
[ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
|
||||
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
|
||||
];
|
||||
|
||||
inherit (prismlauncher') meta;
|
||||
meta = {
|
||||
inherit (prismlauncher'.meta)
|
||||
description
|
||||
longDescription
|
||||
homepage
|
||||
changelog
|
||||
license
|
||||
maintainers
|
||||
mainProgram
|
||||
platforms
|
||||
;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user