From d025091b3509f2f1f167784e286caa79f2849b25 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 10 Aug 2024 17:58:39 +0300 Subject: [PATCH] glew: enable both EGL and GLX Re-roll of https://github.com/NixOS/nixpkgs/pull/328907, but this time adding the patch from ArchLinux, which keeps both EGL and GLX code paths active. Remove overrides where EGL was explicitly requested previously, as well as the glew-egl package variant. Add an alias for glew-egl, in case there's any users of this outside of nixpkgs. --- pkgs/applications/graphics/hugin/default.nix | 4 ++-- pkgs/development/libraries/glew/default.nix | 21 +++++++++++++++++--- pkgs/games/mindustry/default.nix | 9 +++------ pkgs/tools/wayland/mpvpaper/default.nix | 4 ++-- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 10 ---------- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/pkgs/applications/graphics/hugin/default.nix b/pkgs/applications/graphics/hugin/default.nix index e7c3d7f8972dd92..3ef74acca7d660e 100644 --- a/pkgs/applications/graphics/hugin/default.nix +++ b/pkgs/applications/graphics/hugin/default.nix @@ -13,7 +13,7 @@ , fftw , flann , gettext -, glew-egl +, glew , ilmbase , lcms2 , lensfun @@ -51,7 +51,7 @@ stdenv.mkDerivation rec { fftw flann gettext - glew-egl + glew ilmbase lcms2 lensfun diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix index 3385637d297a350..faca4bd15c15124 100644 --- a/pkgs/development/libraries/glew/default.nix +++ b/pkgs/development/libraries/glew/default.nix @@ -1,6 +1,14 @@ -{ lib, stdenv, fetchurl, fetchpatch, cmake, libGLU, libXmu, libXi, libXext +{ lib +, stdenv +, fetchurl +, fetchpatch +, cmake +, libGLU +, libXmu +, libXi +, libXext , OpenGL -, enableEGL ? false +, enableEGL ? (!stdenv.isDarwin) , testers }: @@ -19,7 +27,14 @@ stdenv.mkDerivation (finalAttrs: { # https://github.com/nigels-com/glew/pull/342 (fetchpatch { url = "https://github.com/nigels-com/glew/commit/966e53fa153175864e151ec8a8e11f688c3e752d.diff"; - sha256 = "sha256-xsSwdAbdWZA4KVoQhaLlkYvO711i3QlHGtv6v1Omkhw="; + hash = "sha256-xsSwdAbdWZA4KVoQhaLlkYvO711i3QlHGtv6v1Omkhw="; + }) + + # don't make EGL support disable GLX, use the same patch as ArchLinux + # https://gitlab.archlinux.org/archlinux/packaging/packages/glew/-/blob/ca08ff5d4cd3548a593eb1118d0a84b0c3670349/egl+glx.patch + (fetchpatch { + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/glew/-/raw/ca08ff5d4cd3548a593eb1118d0a84b0c3670349/egl+glx.patch?inline=false"; + hash = "sha256-IG3FPhhaor1kshEH3Kr8yzIHqBhczRwCqH7ZeDwlzGE="; }) ]; diff --git a/pkgs/games/mindustry/default.nix b/pkgs/games/mindustry/default.nix index d4c67fbd7c62378..7e739b2a8c0f681 100644 --- a/pkgs/games/mindustry/default.nix +++ b/pkgs/games/mindustry/default.nix @@ -18,7 +18,6 @@ , alsa-lib , alsa-plugins , glew -, glew-egl # for soloud , libpulseaudio ? null @@ -45,8 +44,6 @@ let jdk = jdk17; - selectedGlew = if enableWayland then glew-egl else glew; - Mindustry = fetchFromGitHub { owner = "Anuken"; repo = "Mindustry"; @@ -146,8 +143,8 @@ stdenv.mkDerivation { buildInputs = lib.optionals enableClient [ SDL2 - selectedGlew alsa-lib + glew ]; nativeBuildInputs = [ pkg-config @@ -171,7 +168,7 @@ stdenv.mkDerivation { pushd ../Arc gradle jnigenBuild gradle jnigenJarNativesDesktop - glewlib=${lib.getLib selectedGlew}/lib/libGLEW.so + glewlib=${lib.getLib glew}/lib/libGLEW.so sdllib=${lib.getLib SDL2}/lib/libSDL2.so patchelf backends/backend-sdl/libs/linux64/libsdl-arc*.so \ --add-needed $glewlib \ @@ -203,7 +200,7 @@ stdenv.mkDerivation { # This can cause issues. # See https://github.com/NixOS/nixpkgs/issues/109798. echo "# Retained runtime dependencies: " >> $out/bin/mindustry - for dep in ${SDL2.out} ${alsa-lib.out} ${selectedGlew.out}; do + for dep in ${SDL2.out} ${alsa-lib.out} ${glew.out}; do echo "# $dep" >> $out/bin/mindustry done diff --git a/pkgs/tools/wayland/mpvpaper/default.nix b/pkgs/tools/wayland/mpvpaper/default.nix index c2aaca4b3586451..3ae57ffdaafd674 100644 --- a/pkgs/tools/wayland/mpvpaper/default.nix +++ b/pkgs/tools/wayland/mpvpaper/default.nix @@ -6,7 +6,7 @@ , wayland-protocols , wayland-scanner , egl-wayland -, glew-egl +, glew , mpv , pkg-config , fetchFromGitHub @@ -39,7 +39,7 @@ stdenv.mkDerivation rec { wayland wayland-protocols egl-wayland - glew-egl + glew mpv ]; diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 60aa4c9a1c5bca3..7bda195b1fb7dbf 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -518,6 +518,7 @@ mapAliases ({ }; # Added 2021-01-14 gitter = throw "gitter has been removed since the client has been abandoned by upstream with the backend migration to Matrix"; # Added 2023-09-18 + glew-egl = lib.warn "'glew-egl' is now provided by 'glew' directly" glew; # Added 2024-08-11 glide = throw "'glide' has been removed as it is unmaintained, please use Go modules instead"; # Added 2023-12-26 glfw-wayland = glfw; # Added 2024-04-19 gmailieer = lieer; # Added 2020-04-19 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ca8ad8b3f6308f4..f2bca0fc5507484 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2684,7 +2684,6 @@ with pkgs; ppsspp-sdl = let argset = { ffmpeg = ffmpeg_4; - glew = glew.override { enableEGL = argset.forceWayland; }; enableQt = false; enableVulkan = true; forceWayland = false; @@ -2695,7 +2694,6 @@ with pkgs; ppsspp-sdl-wayland = let argset = { ffmpeg = ffmpeg_4; - glew = glew.override { enableEGL = argset.forceWayland; }; enableQt = false; enableVulkan = false; # https://github.com/hrydgard/ppsspp/issues/13845 forceWayland = true; @@ -2706,7 +2704,6 @@ with pkgs; ppsspp-qt = let argset = { ffmpeg = ffmpeg_4; - glew = glew.override { enableEGL = argset.forceWayland; }; enableQt = true; enableVulkan = false; # https://github.com/hrydgard/ppsspp/issues/11628 forceWayland = false; @@ -20401,11 +20398,6 @@ with pkgs; glew110 = callPackage ../development/libraries/glew/1.10.nix { inherit (darwin.apple_sdk.frameworks) AGL OpenGL; }; - glew-egl = callPackage ../development/libraries/glew { - inherit (darwin.apple_sdk.frameworks) OpenGL; - enableEGL = true; - }; - glfw = glfw3; glfw-wayland-minecraft = callPackage ../development/libraries/glfw/3.x-wayland-minecraft.nix {}; glfw2 = callPackage ../development/libraries/glfw/2.x.nix { }; @@ -33642,8 +33634,6 @@ with pkgs; bambu-studio = callPackage ../applications/misc/bambu-studio { inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-bad gst-plugins-good; - glew = glew-egl; - wxGTK31 = wxGTK31.override { withCurl = true; withPrivateFonts = true;