about summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers/chromium/common.nix
diff options
context:
space:
mode:
authorAmbroz Bizjak <abizjak.pro@gmail.com>2019-07-15 08:35:03 +0200
committerAmbroz Bizjak <abizjak.pro@gmail.com>2019-07-15 17:03:56 +0200
commit6a0a07318763375dd90125fdf73f690e6c49687e (patch)
tree9300c62284f5395f75227dbe15689b21765d6e05 /pkgs/applications/networking/browsers/chromium/common.nix
parent31c38894c90429c9554eab1b416e59e3b6e054df (diff)
downloadnixlib-6a0a07318763375dd90125fdf73f690e6c49687e.tar
nixlib-6a0a07318763375dd90125fdf73f690e6c49687e.tar.gz
nixlib-6a0a07318763375dd90125fdf73f690e6c49687e.tar.bz2
nixlib-6a0a07318763375dd90125fdf73f690e6c49687e.tar.lz
nixlib-6a0a07318763375dd90125fdf73f690e6c49687e.tar.xz
nixlib-6a0a07318763375dd90125fdf73f690e6c49687e.tar.zst
nixlib-6a0a07318763375dd90125fdf73f690e6c49687e.zip
chromium: Fix running with --use-gl=egl.
When Chromium is using EGL, it dlopen's libGLESv2. Before this fix, this failed
with a not-found error. Fix it by adding libGL to the RUNPATH of the binary.

This problem does not have a visible impact on typical desktop system because
Chromium uses GLX by default. It only matters when Chromium is started with
--use-gl=egl (which makes it use OpenGL ES via EGL instead of desktop OpenGL
via GLX), and probably on certain embedded systems which only support OpenGL
ES.

With this fix, Chromium runs fine for me with --use-gl=egl and the NVidia
driver, and the about:gpu page indicates that it is indeed using OpenGL ES and
EGL.
Diffstat (limited to 'pkgs/applications/networking/browsers/chromium/common.nix')
-rw-r--r--pkgs/applications/networking/browsers/chromium/common.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index ea0e01843404..7779c981d6c4 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -13,7 +13,7 @@
 , bison, gperf
 , glib, gtk3, dbus-glib
 , glibc
-, libXScrnSaver, libXcursor, libXtst, libGLU_combined
+, libXScrnSaver, libXcursor, libXtst, libGLU_combined, libGL
 , protobuf, speechd, libXdamage, cups
 , ffmpeg, libxslt, libxml2, at-spi2-core
 , jdk
@@ -308,6 +308,13 @@ let
       targets = extraAttrs.buildTargets or [];
       commands = map buildCommand targets;
     in concatStringsSep "\n" commands;
+
+    postFixup = ''
+      # Make sure that libGLESv2 is found by dlopen (if using EGL).
+      chromiumBinary="$libExecPath/$packageName"
+      origRpath="$(patchelf --print-rpath "$chromiumBinary")"
+      patchelf --set-rpath "${libGL}/lib:$origRpath" "$chromiumBinary"
+    '';
   };
 
 # Remove some extraAttrs we supplied to the base attributes already.