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.
This commit is contained in:
Florian Klink 2024-08-10 17:58:39 +03:00
parent 33c40979a7
commit d025091b35
6 changed files with 26 additions and 23 deletions

View File

@ -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

View File

@ -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=";
})
];

View File

@ -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

View File

@ -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
];

View File

@ -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

View File

@ -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;