diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 0a644419f1c9..b25c7e10364e 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -15126,6 +15126,12 @@ githubId = 92527083; name = "Morten Munk"; }; + morxemplum = { + email = "morxemplum@outlook.com"; + github = "Morxemplum"; + githubId = 44561540; + name = "Synth Morxemplum"; + }; MostAwesomeDude = { email = "cds@corbinsimpson.com"; github = "MostAwesomeDude"; diff --git a/pkgs/by-name/mc/mcpelauncher-client/dont_download_glfw_client.patch b/pkgs/by-name/mc/mcpelauncher-client/dont_download_glfw_client.patch new file mode 100644 index 000000000000..45ecd910364f --- /dev/null +++ b/pkgs/by-name/mc/mcpelauncher-client/dont_download_glfw_client.patch @@ -0,0 +1,25 @@ +diff --git a/ext/glfw.cmake b/ext/glfw.cmake +index 5487f32..feeb89f 100644 +--- a/ext/glfw.cmake ++++ b/ext/glfw.cmake +@@ -1,18 +1,2 @@ +-include(FetchContent) +- +-set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) +-set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) +-set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) +-set(GLFW_INSTALL OFF CACHE BOOL "" FORCE) +- +-FetchContent_Declare( +- glfw3_ext +- URL "https://github.com/minecraft-linux/glfw/archive/fce9121962bc0a21c39e2d6f8e08bad30c566c72.zip" +-) +- +-FetchContent_GetProperties(glfw3_ext) +-if(NOT glfw3_ext_POPULATED) +- FetchContent_Populate(glfw3_ext) +- add_subdirectory(${glfw3_ext_SOURCE_DIR} ${glfw3_ext_BINARY_DIR}) +-endif() ++find_package(glfw3 REQUIRED) + add_library(glfw3 ALIAS glfw) +\ No newline at end of file diff --git a/pkgs/by-name/mc/mcpelauncher-client/package.nix b/pkgs/by-name/mc/mcpelauncher-client/package.nix new file mode 100644 index 000000000000..b9181d3d18ec --- /dev/null +++ b/pkgs/by-name/mc/mcpelauncher-client/package.nix @@ -0,0 +1,125 @@ +{ + lib, + clangStdenv, + fetchFromGitHub, + fetchpatch, + cmake, + pkg-config, + openssl, + zlib, + libpng, + libglvnd, + xorg, + libevdev, + curl, + pulseaudio, + qt6, + glfw, + withQtWebview ? true, + withQtErrorWindow ? true, + fetchzip, +}: + +# gcc doesn't support __has_feature +clangStdenv.mkDerivation (finalAttrs: { + pname = "mcpelauncher-client"; + version = "1.1.2-qt6"; + + # NOTE: check mcpelauncher-ui-qt when updating + src = fetchFromGitHub { + owner = "minecraft-linux"; + repo = "mcpelauncher-manifest"; + tag = "v${finalAttrs.version}"; + fetchSubmodules = true; + hash = "sha256-PmCq6Zgtp17UV0kIbNouFwj/DMiTqwE31+tTb2LUp5o="; + }; + + patches = [ + ./dont_download_glfw_client.patch + # These are upcoming changes that have been merged upstream. Once these get in a release, remove these patches. + (fetchpatch { + url = "https://github.com/minecraft-linux/game-window/commit/feea8c0e0720eea7093ed95745c17f36d6c40671.diff"; + hash = "sha256-u4uveoKwwklEooT+i+M9kZ0PshjL1IfWhlltmulsQJo="; + stripLen = 1; + extraPrefix = "game-window/"; + }) + (fetchpatch { + url = "https://github.com/minecraft-linux/mcpelauncher-client/commit/db9c31e46d7367867c85a0d0aba42c8144cdf795.diff"; + hash = "sha256-za/9oZYwKCYyZ1BXQ/zeEjRy81B1NpTlPHEfWAOtzHk="; + stripLen = 1; + extraPrefix = "mcpelauncher-client/"; + }) + ]; + + # FORTIFY_SOURCE breaks libc_shim and the project will fail to compile + hardeningDisable = [ "fortify" ]; + + nativeBuildInputs = + [ + cmake + pkg-config + ] + ++ lib.optionals (withQtWebview || withQtErrorWindow) [ + qt6.wrapQtAppsHook + ]; + + buildInputs = + [ + openssl + zlib + libpng + libglvnd + xorg.libX11 + xorg.libXi + xorg.libXtst + libevdev + curl + pulseaudio + glfw + ] + ++ lib.optionals (withQtWebview || withQtErrorWindow) [ + qt6.qtbase + qt6.qttools + qt6.qtwayland + ] + ++ lib.optionals withQtWebview [ + qt6.qtwebengine + ]; + + cmakeFlags = [ + (lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true) + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_NLOHMANN_JSON_EXT" ( + toString (fetchzip { + url = "https://github.com/nlohmann/json/releases/download/v3.7.3/include.zip"; + hash = "sha256-h8czZ4f5vZqvHkDVQawrQdUeQnWxewu4OONisqlrmmM="; + stripRoot = false; + }) + )) + (lib.cmakeBool "USE_OWN_CURL" false) + (lib.cmakeBool "ENABLE_DEV_PATHS" false) + (lib.cmakeFeature "GAMEWINDOW_SYSTEM" "GLFW") + (lib.cmakeBool "USE_SDL3_AUDIO" false) + (lib.cmakeBool "BUILD_WEBVIEW" withQtWebview) + (lib.cmakeBool "XAL_WEBVIEW_USE_CLI" (!withQtWebview)) + (lib.cmakeBool "XAL_WEBVIEW_USE_QT" withQtWebview) + (lib.cmakeBool "ENABLE_QT_ERROR_UI" withQtErrorWindow) + ]; + + meta = { + description = "Unofficial Minecraft Bedrock Edition launcher with CLI"; + homepage = "https://minecraft-linux.github.io"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ + aleksana + morxemplum + ]; + mainProgram = "mcpelauncher-client"; + platforms = lib.platforms.unix; + # Minecraft Bedrock Edition is raising minimal OpenGL version to OpenGL ES 3.1 + # which is currently not supported on macOS. + # https://github.com/minecraft-linux/mcpelauncher-manifest/issues/1042 + # https://help.minecraft.net/hc/en-us/articles/30298767427597-Upcoming-OS-Sunset-Announcements-in-Minecraft + # The program is also not tested on darwin. Any help from darwin users are welcomed. + badPlatforms = lib.platforms.darwin; + }; +}) diff --git a/pkgs/by-name/mc/mcpelauncher-ui-qt/dont_download_glfw_ui.patch b/pkgs/by-name/mc/mcpelauncher-ui-qt/dont_download_glfw_ui.patch new file mode 100644 index 000000000000..3d28d9b46149 --- /dev/null +++ b/pkgs/by-name/mc/mcpelauncher-ui-qt/dont_download_glfw_ui.patch @@ -0,0 +1,24 @@ +diff -urB mcpelauncher-ui/mcpelauncher-ui-qt/ext/glfw.cmake mcpelauncher-ui-b/mcpelauncher-ui-qt/ext/glfw.cmake +--- mcpelauncher-ui/mcpelauncher-ui-qt/ext/glfw.cmake 2024-11-28 21:12:36.794926431 -0700 ++++ mcpelauncher-ui-b/mcpelauncher-ui-qt/ext/glfw.cmake 2024-12-03 15:04:28.466197081 -0700 +@@ -1,19 +1,2 @@ +-include(FetchContent) +- +-set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) +-set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) +-set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) +-set(GLFW_INSTALL OFF CACHE BOOL "" FORCE) +-set(GLFW_BUILD_WAYLAND OFF CACHE BOOL "" FORCE) +- +-FetchContent_Declare( +- glfw3_ext +- URL "https://github.com/glfw/glfw/archive/master.zip" +-) +- +-FetchContent_GetProperties(glfw3_ext) +-if(NOT glfw3_ext_POPULATED) +- FetchContent_Populate(glfw3_ext) +- add_subdirectory(${glfw3_ext_SOURCE_DIR} ${glfw3_ext_BINARY_DIR}) +-endif() ++find_package(glfw3 REQUIRED) + add_library(glfw3 ALIAS glfw) diff --git a/pkgs/by-name/mc/mcpelauncher-ui-qt/package.nix b/pkgs/by-name/mc/mcpelauncher-ui-qt/package.nix new file mode 100644 index 000000000000..6867af4464ee --- /dev/null +++ b/pkgs/by-name/mc/mcpelauncher-ui-qt/package.nix @@ -0,0 +1,62 @@ +{ + lib, + stdenv, + mcpelauncher-client, + fetchFromGitHub, + cmake, + pkg-config, + zlib, + libzip, + curl, + protobuf, + qt6, + glfw, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "mcpelauncher-ui-qt"; + inherit (mcpelauncher-client) version; + + src = fetchFromGitHub { + owner = "minecraft-linux"; + repo = "mcpelauncher-ui-manifest"; + tag = "v${finalAttrs.version}"; + fetchSubmodules = true; + hash = "sha256-R9wE1lS7x1IIPgVahXjF5Yg2ca+GsiQuF41pWf2edXY="; + }; + + patches = [ + ./dont_download_glfw_ui.patch + ]; + + nativeBuildInputs = [ + cmake + pkg-config + qt6.wrapQtAppsHook + ]; + + buildInputs = [ + zlib + libzip + curl + protobuf + qt6.qtwebengine + qt6.qtsvg + qt6.qtwayland + glfw + ]; + + # the program refuses to start when QT_STYLE_OVERRIDE is set + # https://github.com/minecraft-linux/mcpelauncher-ui-qt/issues/25 + preFixup = '' + qtWrapperArgs+=( + --prefix PATH : ${lib.makeBinPath [ mcpelauncher-client ]} + --unset QT_STYLE_OVERRIDE + ) + ''; + + meta = mcpelauncher-client.meta // { + description = "Unofficial Minecraft Bedrock Edition launcher with GUI"; + mainProgram = "mcpelauncher-ui-qt"; + }; +})