Skip to content

Commit

Permalink
glew: enable both EGL and GLX
Browse files Browse the repository at this point in the history
Re-roll of #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.
  • Loading branch information
flokli committed Aug 11, 2024
1 parent 33c4097 commit d025091
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
4 changes: 2 additions & 2 deletions pkgs/applications/graphics/hugin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
, fftw
, flann
, gettext
, glew-egl
, glew
, ilmbase
, lcms2
, lensfun
Expand Down Expand Up @@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
fftw
flann
gettext
glew-egl
glew
ilmbase
lcms2
lensfun
Expand Down
21 changes: 18 additions & 3 deletions pkgs/development/libraries/glew/default.nix
Original file line number Diff line number Diff line change
@@ -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
}:

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

Expand Down
9 changes: 3 additions & 6 deletions pkgs/games/mindustry/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
, alsa-lib
, alsa-plugins
, glew
, glew-egl

# for soloud
, libpulseaudio ? null
Expand All @@ -45,8 +44,6 @@ let

jdk = jdk17;

selectedGlew = if enableWayland then glew-egl else glew;

Mindustry = fetchFromGitHub {
owner = "Anuken";
repo = "Mindustry";
Expand Down Expand Up @@ -146,8 +143,8 @@ stdenv.mkDerivation {

buildInputs = lib.optionals enableClient [
SDL2
selectedGlew
alsa-lib
glew
];
nativeBuildInputs = [
pkg-config
Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/tools/wayland/mpvpaper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
, wayland-protocols
, wayland-scanner
, egl-wayland
, glew-egl
, glew
, mpv
, pkg-config
, fetchFromGitHub
Expand Down Expand Up @@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
wayland
wayland-protocols
egl-wayland
glew-egl
glew
mpv
];

Expand Down
1 change: 1 addition & 0 deletions pkgs/top-level/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 { };
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d025091

Please sign in to comment.