summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2023-04-29 12:12:02 +0800
committerMarius Bakke <marius@gnu.org>2023-04-30 23:25:45 +0800
commita03743f016e3b5e2911f5c971add4e0261822ee3 (patch)
tree2beb7624b2a5d7298ae46af293125bcf6edb9298 /gnu/packages
parent5834953573a00793fbee8918d9d53897e25fa363 (diff)
downloadguix-a03743f016e3b5e2911f5c971add4e0261822ee3.tar.gz
gnu: ungoogled-chromium: Don't add absolute references to libGL and libvulkan.
Keeping track of the uses of these libraries is a lot of work and ultimately
not worth the trouble -- especially since Chromium supports multiple libGL's
with different ABIs.  Instead we take the easy route and rely on a search path.

* gnu/packages/chromium.scm (ungoogled-chromium)[arguments]: Remove patching
of libGL.so and libvulkan.so.  Instead wrap with LD_LIBRARY_PATH.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/chromium.scm37
1 files changed, 8 insertions, 29 deletions
diff --git a/gnu/packages/chromium.scm b/gnu/packages/chromium.scm
index 22e22cdbf8..e1d2605a8f 100644
--- a/gnu/packages/chromium.scm
+++ b/gnu/packages/chromium.scm
@@ -698,8 +698,6 @@
                     (libvulkan.so.1 (search-input-file inputs
                                                        "/lib/libvulkan.so.1"))
                     (icd.d (search-input-directory inputs "share/vulkan/icd.d"))
-                    (mesa-lib (dirname (search-input-file inputs
-                                                          "/lib/libGL.so.1")))
                     (gtk-libs '("libgio-2.0.so.0"
                                 "libgdk_pixbuf-2.0.so.0"
                                 "libgdk-3.so.0"
@@ -717,20 +715,6 @@
                 (substitute* "device/udev_linux/udev1_loader.cc"
                   (("libudev\\.so\\.1") libudev.so.1))
 
-                ;; Patch libvulkan.so everywhere.
-                (substitute*
-                    '("third_party/swiftshader/include/vulkan/vulkan.hpp"
-                      "third_party/vulkan-deps/vulkan-tools\
-/src/vulkaninfo/vulkaninfo.h"
-                      "third_party/vulkan-deps/vulkan-headers\
-/src/include/vulkan/vulkan.hpp"
-                      "content/gpu/gpu_sandbox_hook_linux.cc"
-                      "ui/ozone/platform/wayland/gpu/vulkan_implementation_wayland.cc"
-                      "ui/ozone/platform/drm/gpu/vulkan_implementation_gbm.cc"
-                      "ui/ozone/platform/x11/vulkan_implementation_x11.cc"
-                      "third_party/skia/tools/sk_app/unix\
-/DawnVulkanWindowContext_unix.cpp")
-                  (("libvulkan\\.so\\.1") libvulkan.so.1))
                 (substitute* "content/gpu/gpu_sandbox_hook_linux.cc"
                   (("/usr/share/vulkan/icd\\.d") icd.d))
 
@@ -739,19 +723,7 @@
                   (("^([[:blank:]]+)mRuntimeSearchPaths\\.push_back\\(\"\"\\);"
                     all indent)
                    (string-append indent "mRuntimeSearchPaths.push_back(\""
-                                  (dirname libvulkan.so.1) "/\");\n" all)))
-
-                (substitute*
-                    '("ui/ozone/platform/x11/gl_ozone_glx.cc"
-                      "ui/ozone/common/egl_util.cc"
-                      "third_party/angle/src/libANGLE/renderer/gl/glx\
-/FunctionsGLX.cpp")
-                  (("libGL\\.so\\.1")
-                   (string-append mesa-lib "/libGL.so.1"))
-                  (("libEGL\\.so\\.1")
-                   (string-append mesa-lib "/libEGL.so.1"))
-                  (("libGLESv2\\.so\\.2")
-                   (string-append mesa-lib "/libGLESv2.so.2"))))))
+                                  (dirname libvulkan.so.1) "/\");\n" all))))))
           (add-before 'configure 'prepare-build-environment
             (lambda* (#:key native-inputs inputs #:allow-other-keys)
               (let ((node (search-input-file (or native-inputs inputs)
@@ -833,6 +805,8 @@
                           "chromium/master-preferences.json")))
                      (gtk (dirname (dirname
                                     (search-input-file inputs "lib/libgtk-3.so"))))
+                     (mesa (dirname (search-input-file inputs "lib/libGL.so")))
+                     (vulkan (dirname (search-input-file inputs "lib/libvulkan.so")))
                      (xdg-utils (dirname (search-input-file inputs "bin/xdg-open"))))
 
                 (substitute* '("chrome/app/resources/manpage.1.in"
@@ -870,6 +844,11 @@
                   (wrap-program exe
                     ;; Avoid file manager crash.  See <https://bugs.gnu.org/26593>.
                     `("XDG_DATA_DIRS" ":" prefix (,(string-append gtk "/share")))
+                    ;; Provide libGL and libvulkan without patching all references.
+                    ;; XXX: How to add on RUNPATH instead of this hack?
+                    `("LD_LIBRARY_PATH" ":" prefix
+                      (,(string-append mesa ":" vulkan)))
+                    ;; Ensure xdg-open et al. is found.
                     `("PATH" ":" prefix (,xdg-utils))))
 
                 (with-directory-excursion "chrome/app/theme/chromium"