diff mbox series

[2/2] package/librsvg: fix loaders.cache

Message ID 20220219122526.2954354-2-fontaine.fabrice@gmail.com
State Superseded
Headers show
Series [1/2] package/gdk-pixbuf: enable relocatable option | expand

Commit Message

Fabrice Fontaine Feb. 19, 2022, 12:25 p.m. UTC
Set GDK_PIXBUF_MODULEDIR to gdk_pixbuf_moduledir before calling
gdk-pixbuf-query-loaders to build a correct loaders.cache and fix the
following PPD build failure of adwaita-icon-theme raised since commit
b06294e9897e90862656416e8b67fdace15488d7 which now correctly updates
loaders.cache:

Can't load file: Unrecognized image file format

Fixes:
 - http://autobuild.buildroot.org/results/0e00059b09b4445eaaec1030997883187c6a80d6

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...r-Makefile.am-set-GDK_PIXBUF_MODULED.patch | 39 +++++++++++++++++++
 package/librsvg/librsvg.mk                    |  2 +
 2 files changed, 41 insertions(+)
 create mode 100644 package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch

Comments

Yann E. MORIN Feb. 20, 2022, 11:27 a.m. UTC | #1
On 2022-02-19 13:25 +0100, Fabrice Fontaine spake thusly:
> Set GDK_PIXBUF_MODULEDIR to gdk_pixbuf_moduledir before calling
> gdk-pixbuf-query-loaders to build a correct loaders.cache and fix the
> following PPD build failure of adwaita-icon-theme raised since commit
> b06294e9897e90862656416e8b67fdace15488d7 which now correctly updates
> loaders.cache:
> 
> Can't load file: Unrecognized image file format

I had a bit parsing the above...

So, what you really are doing here is not "Set GDK_PIXBUF_MODULEDIR to
gdk_pixbuf_moduledir", but really "Set GDK_PIXBUF_MODULEDIR to the path
returned by the gdk_pixbuf_moduledir utility".

And this does not explain why this is needed.

Sorry for the rant to come...

So, a commit log should not describe what is going on. WE can (most of
the time) understand the code.

Instead, a commit log should explain what the problem is, then explain
why it happens, and finally explain how it is fixed.

So, let's try to have a go at such a commit log (this is littered with
wild guesses, adat appropriately)...

    package/librsvg: fix loaders.cache with per-package directories

    librsvg invokes the gdk-pixbuf-queryloaders, which generates a
    description of all the gdk-pixbuf modules; that includes paths
    to dlopen()ed shared libs.

    Those paths are absolute, so with PPD, they point to the location
    where the gdk-pixbuf package or where a module-provider, like
    librsvg, was installed.

    Later on, when a third-party package needs to call gdk-pibxbuf
    tools that need any of those modules, tose moduels won't be found
    because the description where they get installed will be wrong.

    We fix that by telling the gdk-pixbuf-queryloaders hwere to look
    for modules, both at configure and install time. At configure time,
    it tells the package to use modules from its own PPD rather tahn
    directly from where they were installed by gdk-pixbuf, and at
    install time, it [to be comp0leted, I have not been able to really
    understand why and what...]

Could you please rework your patches with more details, especially when
the fix is not obvious?

Still, I'd like to thank you for this hard work; finding the issue and
how to fix it was probably not very easy. So hat-off to you! 👍

Regards,
Yann E. MORIN.

> Fixes:
>  - http://autobuild.buildroot.org/results/0e00059b09b4445eaaec1030997883187c6a80d6
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  ...r-Makefile.am-set-GDK_PIXBUF_MODULED.patch | 39 +++++++++++++++++++
>  package/librsvg/librsvg.mk                    |  2 +
>  2 files changed, 41 insertions(+)
>  create mode 100644 package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch
> 
> diff --git a/package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch b/package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch
> new file mode 100644
> index 0000000000..94db8eb143
> --- /dev/null
> +++ b/package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch
> @@ -0,0 +1,39 @@
> +From 2c472bf55289ccbd7f305aa3e98d6fd70be4e3ab Mon Sep 17 00:00:00 2001
> +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +Date: Sat, 19 Feb 2022 12:02:10 +0100
> +Subject: [PATCH] gdk-pixbuf-loader/Makefile.am: set GDK_PIXBUF_MODULEDIR
> +
> +Set GDK_PIXBUF_MODULEDIR to gdk_pixbuf_moduledir before calling
> +gdk-pixbuf-query-loaders to build a correct gdk_pixbuf_cache_file and
> +gdk-pixbuf.loaders on 'exotic' systems
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +---
> + gdk-pixbuf-loader/Makefile.am | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/gdk-pixbuf-loader/Makefile.am b/gdk-pixbuf-loader/Makefile.am
> +index c3493736..de1f9641 100644
> +--- a/gdk-pixbuf-loader/Makefile.am
> ++++ b/gdk-pixbuf-loader/Makefile.am
> +@@ -49,7 +49,7 @@ rsvg_loader_LDADD = \
> + EXTRA_rsvg_loader_DEPENDENCIES = libpixbufloader-svg.la gdk-pixbuf-loaders
> + 
> + gdk-pixbuf-loaders: Makefile
> +-	$(AM_V_GEN) ( $(GDK_PIXBUF_QUERYLOADERS) ./libpixbufloader-svg.la && $(GDK_PIXBUF_QUERYLOADERS)) > gdk-pixbuf.loaders 2>/dev/null
> ++	$(AM_V_GEN) ( $(GDK_PIXBUF_QUERYLOADERS) ./libpixbufloader-svg.la && GDK_PIXBUF_MODULEDIR=$(gdk_pixbuf_moduledir) $(GDK_PIXBUF_QUERYLOADERS)) > gdk-pixbuf.loaders 2>/dev/null
> + 
> + if CROSS_COMPILING
> + RUN_QUERY_LOADER_TEST=false
> +@@ -68,7 +68,7 @@ endif
> + install-data-hook:
> + 	@if $(RUN_QUERY_LOADER_TEST) ; then \
> + 		$(mkinstalldirs) $(DESTDIR)$(gdk_pixbuf_binarydir) ; \
> +-		$(GDK_PIXBUF_QUERYLOADERS) > $(DESTDIR)$(gdk_pixbuf_cache_file) ; \
> ++		GDK_PIXBUF_MODULEDIR=$(gdk_pixbuf_moduledir) $(GDK_PIXBUF_QUERYLOADERS) > $(DESTDIR)$(gdk_pixbuf_cache_file) ; \
> + 	else \
> + 	  echo "***" ; \
> + 	  echo "*** Warning: loaders.cache not built" ; \
> +-- 
> +2.34.1
> +
> diff --git a/package/librsvg/librsvg.mk b/package/librsvg/librsvg.mk
> index e4b1942b79..07a14b4366 100644
> --- a/package/librsvg/librsvg.mk
> +++ b/package/librsvg/librsvg.mk
> @@ -20,6 +20,8 @@ HOST_LIBRSVG_DEPENDENCIES = host-cairo host-gdk-pixbuf host-libglib2 host-libxml
>  LIBRSVG_LICENSE = LGPL-2.1+
>  LIBRSVG_LICENSE_FILES = COPYING.LIB
>  LIBRSVG_CPE_ID_VENDOR = gnome
> +# We're patching gdk-pixbuf-loader/Makefile.am
> +LIBRSVG_AUTORECONF = YES
>  
>  ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
>  LIBRSVG_CONF_OPTS += --enable-introspection
> -- 
> 2.34.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Peter Korsgaard March 11, 2022, 9:15 p.m. UTC | #2
>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

 > Set GDK_PIXBUF_MODULEDIR to gdk_pixbuf_moduledir before calling
 > gdk-pixbuf-query-loaders to build a correct loaders.cache and fix the
 > following PPD build failure of adwaita-icon-theme raised since commit
 > b06294e9897e90862656416e8b67fdace15488d7 which now correctly updates
 > loaders.cache:

 > Can't load file: Unrecognized image file format

 > Fixes:
 >  - http://autobuild.buildroot.org/results/0e00059b09b4445eaaec1030997883187c6a80d6

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Committed to 2021.02.x and 2021.11.x, thanks.
diff mbox series

Patch

diff --git a/package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch b/package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch
new file mode 100644
index 0000000000..94db8eb143
--- /dev/null
+++ b/package/librsvg/0001-gdk-pixbuf-loader-Makefile.am-set-GDK_PIXBUF_MODULED.patch
@@ -0,0 +1,39 @@ 
+From 2c472bf55289ccbd7f305aa3e98d6fd70be4e3ab Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sat, 19 Feb 2022 12:02:10 +0100
+Subject: [PATCH] gdk-pixbuf-loader/Makefile.am: set GDK_PIXBUF_MODULEDIR
+
+Set GDK_PIXBUF_MODULEDIR to gdk_pixbuf_moduledir before calling
+gdk-pixbuf-query-loaders to build a correct gdk_pixbuf_cache_file and
+gdk-pixbuf.loaders on 'exotic' systems
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ gdk-pixbuf-loader/Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gdk-pixbuf-loader/Makefile.am b/gdk-pixbuf-loader/Makefile.am
+index c3493736..de1f9641 100644
+--- a/gdk-pixbuf-loader/Makefile.am
++++ b/gdk-pixbuf-loader/Makefile.am
+@@ -49,7 +49,7 @@ rsvg_loader_LDADD = \
+ EXTRA_rsvg_loader_DEPENDENCIES = libpixbufloader-svg.la gdk-pixbuf-loaders
+ 
+ gdk-pixbuf-loaders: Makefile
+-	$(AM_V_GEN) ( $(GDK_PIXBUF_QUERYLOADERS) ./libpixbufloader-svg.la && $(GDK_PIXBUF_QUERYLOADERS)) > gdk-pixbuf.loaders 2>/dev/null
++	$(AM_V_GEN) ( $(GDK_PIXBUF_QUERYLOADERS) ./libpixbufloader-svg.la && GDK_PIXBUF_MODULEDIR=$(gdk_pixbuf_moduledir) $(GDK_PIXBUF_QUERYLOADERS)) > gdk-pixbuf.loaders 2>/dev/null
+ 
+ if CROSS_COMPILING
+ RUN_QUERY_LOADER_TEST=false
+@@ -68,7 +68,7 @@ endif
+ install-data-hook:
+ 	@if $(RUN_QUERY_LOADER_TEST) ; then \
+ 		$(mkinstalldirs) $(DESTDIR)$(gdk_pixbuf_binarydir) ; \
+-		$(GDK_PIXBUF_QUERYLOADERS) > $(DESTDIR)$(gdk_pixbuf_cache_file) ; \
++		GDK_PIXBUF_MODULEDIR=$(gdk_pixbuf_moduledir) $(GDK_PIXBUF_QUERYLOADERS) > $(DESTDIR)$(gdk_pixbuf_cache_file) ; \
+ 	else \
+ 	  echo "***" ; \
+ 	  echo "*** Warning: loaders.cache not built" ; \
+-- 
+2.34.1
+
diff --git a/package/librsvg/librsvg.mk b/package/librsvg/librsvg.mk
index e4b1942b79..07a14b4366 100644
--- a/package/librsvg/librsvg.mk
+++ b/package/librsvg/librsvg.mk
@@ -20,6 +20,8 @@  HOST_LIBRSVG_DEPENDENCIES = host-cairo host-gdk-pixbuf host-libglib2 host-libxml
 LIBRSVG_LICENSE = LGPL-2.1+
 LIBRSVG_LICENSE_FILES = COPYING.LIB
 LIBRSVG_CPE_ID_VENDOR = gnome
+# We're patching gdk-pixbuf-loader/Makefile.am
+LIBRSVG_AUTORECONF = YES
 
 ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
 LIBRSVG_CONF_OPTS += --enable-introspection