[bug#75795,gnome-team,1/2] gnu: gdk-pixbuf: Respect GUIX_GDK_PIXBUF_MODULE_FILES search path.

Message ID 3690118c9d5b8b536faba3909ee8c2fb1eb38cbb.1737689162.git.iyzsong@member.fsf.org
State New
Headers
Series [bug#75795,gnome-team,1/2] gnu: gdk-pixbuf: Respect GUIX_GDK_PIXBUF_MODULE_FILES search path. |

Commit Message

Alexis Praga via Guix-patches via Jan. 24, 2025, 3:26 a.m. UTC
  From: 宋文武 <iyzsong@member.fsf.org>

This fixes <https://issues.guix.gnu.org/75523>.

* gnu/packages/patches/gdk-pixbuf-respect-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
---
 gnu/local.mk                                  |  1 +
 gnu/packages/gtk.scm                          |  8 ++++---
 ...respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch | 21 +++++++++++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch


base-commit: 8acd7541b1ba276580d91650bea0b8933e555ca0
  

Comments

Maxim Cournoyer Jan. 27, 2025, 1:03 a.m. UTC | #1
Hello,

iyzsong@envs.net writes:

> From: 宋文武 <iyzsong@member.fsf.org>
>
> This fixes <https://issues.guix.gnu.org/75523>.
>
> * gnu/packages/patches/gdk-pixbuf-respect-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.

Sounds good.

[...]

>       (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))))

Neat.

>      (synopsis "Image loading library")
>      (description "GdkPixbuf is a library that loads image data in various
> diff --git a/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch
> new file mode 100644
> index 0000000000..d47a54bef1> --- /dev/null
> +++ b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch
> @@ -0,0 +1,21 @@
> +diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
> +index e1df590..214a283 100644
> +--- a/gdk-pixbuf/gdk-pixbuf-io.c
> ++++ b/gdk-pixbuf/gdk-pixbuf-io.c
> +@@ -670,6 +670,16 @@ gdk_pixbuf_io_init (void)
> + 	gboolean ret;
> +
> + 	gdk_pixbuf_io_init_builtin ();
> ++
> ++        /* Load loaders from GUIX_GDK_PIXBUF_MODULE_FILES. */
> ++        gchar *guix_module_files_env = g_getenv ("GUIX_GDK_PIXBUF_MODULE_FILES");
> ++        if (guix_module_files_env) {
> ++            gchar **guix_module_files = g_strsplit (guix_module_files_env, G_SEARCHPATH_SEPARATOR_S, 0);

I'd honor the classic max 80 characters width here.

> ++            for (int i = 0; guix_module_files[i] != NULL; i++)
> ++                gdk_pixbuf_io_init_modules (guix_module_files[i], NULL);
> ++            g_strfreev (guix_module_files);
> ++        }
> ++

The rest looks good to me; but!  Could you please submit to upstream the
above but with s/GUIX_GDK_PIXBUF_MODULE_FILES/GDK_PIXBUF_MODULE_FILES/
and link it in the patch via e.g.:

--8<---------------cut here---------------start------------->8---
Upstream-status: https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/NNN
--8<---------------cut here---------------end--------------->8---

This way we can track its status there, rebase if needed or respond to
requests for adjustments.

Eventually we'd have gdk-pixbuf honor GDK_PIXBUF_MODULE_FILES natively,
and apply on top of that our patch to have the GUIX_ prefixed variant.

How does that sound?
  
宋文武 Jan. 27, 2025, 4:30 a.m. UTC | #2
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> [...]
>
> The rest looks good to me; but!  Could you please submit to upstream the
> above but with s/GUIX_GDK_PIXBUF_MODULE_FILES/GDK_PIXBUF_MODULE_FILES/
> and link it in the patch via e.g.:
>
> Upstream-status: https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/NNN
>
> This way we can track its status there, rebase if needed or respond to
> requests for adjustments.
>
> Eventually we'd have gdk-pixbuf honor GDK_PIXBUF_MODULE_FILES natively,
> and apply on top of that our patch to have the GUIX_ prefixed variant.
>
> How does that sound?

Sure, that'll be great.

I had sent an email to request an account there (can't use its web form
due to networking blocking in my country..), will update the patch
later.

Thank you!
  

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 72b27cb915..21f04f8a51 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1395,6 +1395,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-respect-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	\
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index fac94e293b..97d5ca98d0 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -725,7 +725,10 @@  (define-public gdk-pixbuf
                                   name "-" version ".tar.xz"))
               (sha256
                (base32
-                "1iz392vrlrnb92hrak697bgndsbkrcxhqxilxn6f99xr8ls5nl5r"))))
+                "1iz392vrlrnb92hrak697bgndsbkrcxhqxilxn6f99xr8ls5nl5r"))
+              (patches
+               (search-patches
+                "gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch"))))
     (build-system meson-build-system)
     (outputs '("out" "debug"))
     (arguments
@@ -779,9 +782,8 @@  (define-public gdk-pixbuf
      ;; 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
diff --git a/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch
new file mode 100644
index 0000000000..d47a54bef1
--- /dev/null
+++ b/gnu/packages/patches/gdk-pixbuf-respect-GUIX_GDK_PIXBUF_MODULE_FILES.patch
@@ -0,0 +1,21 @@ 
+diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
+index e1df590..214a283 100644
+--- a/gdk-pixbuf/gdk-pixbuf-io.c
++++ b/gdk-pixbuf/gdk-pixbuf-io.c
+@@ -670,6 +670,16 @@ gdk_pixbuf_io_init (void)
+ 	gboolean ret;
+ 
+ 	gdk_pixbuf_io_init_builtin ();
++
++        /* Load loaders from GUIX_GDK_PIXBUF_MODULE_FILES. */
++        gchar *guix_module_files_env = g_getenv ("GUIX_GDK_PIXBUF_MODULE_FILES");
++        if (guix_module_files_env) {
++            gchar **guix_module_files = g_strsplit (guix_module_files_env, G_SEARCHPATH_SEPARATOR_S, 0);
++            for (int i = 0; guix_module_files[i] != NULL; i++)
++                gdk_pixbuf_io_init_modules (guix_module_files[i], NULL);
++            g_strfreev (guix_module_files);
++        }
++
+ #ifdef USE_GMODULE
+ 	module_file = gdk_pixbuf_get_module_file ();
+ #endif