~ruther/guix-local

4838b7b0e94c7636cc2639e3b53d3fe37251fca2 — 宋文武 1 year, 9 months ago 59b343c
gnu: gdk-pixbuf: Honor GUIX_GDK_PIXBUF_MODULE_FILES search path.

* gnu/packages/patches/gdk-pixbuf-honor-GUIX_GDK_PIXBUF_MODULE_FILES.patch:
New file.
* gnu/local.mk (dist_patch_DATA): Register patch.
* gnu/packages/gtk.scm (gdk-pixbuf)[source]: Add patch.
[native-search-paths]: Replace GDK_PIXBUF_MODULE_FILE with GUIX_GDK_PIXBUF_MODULE_FILES.

Change-Id: Ibcf6ebf33f5de2c889bc27a88d59a5f444b77906
Fixes: GDK_PIXBUF_MODULE_FILE conflicts on foreign distros
  <https://issues.guix.gnu.org/75523>
Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
M gnu/local.mk => gnu/local.mk +1 -0
@@ 1408,6 1408,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/gd-fix-tests-on-i686.patch		\
  %D%/packages/patches/gd-brect-bounds.patch			\
  %D%/packages/patches/gdb-hurd64.patch				\
  %D%/packages/patches/gdk-pixbuf-honor-GUIX_GDK_PIXBUF_MODULE_FILES.patch	\
  %D%/packages/patches/gdm-default-session.patch		\
  %D%/packages/patches/gdm-remove-hardcoded-xwayland-path.patch	\
  %D%/packages/patches/gdm-wayland-session-wrapper-from-env.patch	\

M gnu/packages/gtk.scm => gnu/packages/gtk.scm +5 -3
@@ 726,7 726,10 @@ highlighting and other features typical of a source code editor.")
                                  name "-" version ".tar.xz"))
              (sha256
               (base32
                "1iz392vrlrnb92hrak697bgndsbkrcxhqxilxn6f99xr8ls5nl5r"))))
                "1iz392vrlrnb92hrak697bgndsbkrcxhqxilxn6f99xr8ls5nl5r"))
              (patches
               (search-patches
                "gdk-pixbuf-honor-GUIX_GDK_PIXBUF_MODULE_FILES.patch"))))
    (build-system meson-build-system)
    (outputs '("out" "debug"))
    (arguments


@@ 780,9 783,8 @@ highlighting and other features typical of a source code editor.")
     ;; This file is produced by the gdk-pixbuf-loaders-cache-file
     ;; profile hook.
     (list (search-path-specification
            (variable "GDK_PIXBUF_MODULE_FILE")
            (variable "GUIX_GDK_PIXBUF_MODULE_FILES")
            (files (list %gdk-pixbuf-loaders-cache-file))
            (separator #f)              ;single valued
            (file-type 'regular))))
    (synopsis "Image loading library")
    (description "GdkPixbuf is a library that loads image data in various

A gnu/packages/patches/gdk-pixbuf-honor-GUIX_GDK_PIXBUF_MODULE_FILES.patch => gnu/packages/patches/gdk-pixbuf-honor-GUIX_GDK_PIXBUF_MODULE_FILES.patch +34 -0
@@ 0,0 1,34 @@
This patch makes gdk-pixbuf look for additional modules in a list of files
specified by the environment variable "GUIX_GDK_PIXBUF_MODULE_FILES".

A similiar patch for "GDK_PIXBUF_MODULE_FILES" had been sent to upstream:
  https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/180

We use a "GUIX_" prefixed one to avoid breaking foreign programs:
  https://issues.guix.gnu.org/63853
  https://issues.guix.gnu.org/75523

Upstream-status: N/A
---
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index e1df590..913ce89 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -670,6 +670,17 @@ gdk_pixbuf_io_init (void)
 	gboolean ret;
 
 	gdk_pixbuf_io_init_builtin ();
+
+        /* Load modules from GUIX_GDK_PIXBUF_MODULE_FILES. */
+        gchar *module_files_env = g_getenv ("GUIX_GDK_PIXBUF_MODULE_FILES");
+        if (module_files_env) {
+            gchar **module_files = g_strsplit (module_files_env,
+                                               G_SEARCHPATH_SEPARATOR_S, 0);
+            for (int i = 0; module_files[i] != NULL; i++)
+                gdk_pixbuf_io_init_modules (module_files[i], NULL);
+            g_strfreev (module_files);
+        }
+
 #ifdef USE_GMODULE
 	module_file = gdk_pixbuf_get_module_file ();
 #endif