+++ /dev/null
-From 33ece256bf7c156a34ab1ee3709718e38829cc9e Mon Sep 17 00:00:00 2001
-From: Gyorgy Sarvari <skandigraun@gmail.com>
-Date: Wed, 6 Aug 2025 13:50:21 +0200
-Subject: [PATCH] Revert "meson.build: do not force-disable gdk-pixbuf-loader
- in cross builds"
-
-This reverts commit 994582cfa995d00f9472dc22f8237b6571b4c510.
-
-The commit that enabled gdk-pixbuf-loader for non-cross builds, references
-a commit that enabled other binaries, claiming that they can be executed with
-a qemu wrapper.
-
-There is one difference - the projects that were enabled by that commit support such
-wrappers officially (see `gi_cross_binary_wrapper` and related build options for g-i).
-However such support is missing from gdk-pixbuf-loader unfortunately, which can cause
-build failures when cross compiling.
-
-To avoid this, revert back to disable gdk-pixbuf-loader for cross-builds
-(until it gains a similar feature).
-
-Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/1123]
-
-Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
----
- gdk-pixbuf-loader/meson.build | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gdk-pixbuf-loader/meson.build b/gdk-pixbuf-loader/meson.build
-index 6fa10a6..c51d803 100644
---- a/gdk-pixbuf-loader/meson.build
-+++ b/gdk-pixbuf-loader/meson.build
-@@ -36,7 +36,7 @@ pixbuf_thumbnailer = configure_file(
- install_dir: get_option('datadir') / 'thumbnailers'
- )
-
--if meson.can_run_host_binaries()
-+if not meson.is_cross_build()
- gdk_pixbuf_query_loaders = find_program(pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_query_loaders', default_value: 'gdk-pixbuf-query-loaders'))
- endif
-
-@@ -48,7 +48,7 @@ pixbufloader_svg_install_args = [
- ]
-
- # Tell people to run gdk-pixbuf-query-loaders manually for cross builds
--if not meson.can_run_host_binaries()
-+if meson.is_cross_build()
- pixbufloader_svg_install_args += '--show-cross-message'
- endif
-
--- /dev/null
+gdk-pixbuf-loader/meson_install: improve argument parsing and logic
+
+Make the arguments more explicit by changing the path arguments to be
+specified with options, such as --queryloaders <path>. Previously one of
+the paths had an option, but the others were order-based.
+
+Check that either all of the paths have been set or --show-cross-message
+has been passed. If this is not the case, print the usage and exit.
+
+Clean up Path usage, as the options are using pathlib.Path types in the
+parser another Path instance does not need to be created.
+
+None of this changes the underlying logic, just makes it more consistent
+and explicit.
+
+
+gdk-pixbuf-loader: fix install logic in cross builds
+
+The logic in this install rule was getting complicated, but it should be
+quite simple really:
+
+- In native builds we can run host binaries. Look for the
+ gdk-pixbuf-query-loaders tool and run it when installing.
+- In cross builds we might be able to run host binaries, if an executable
+ wrapper has been set _and_ if the target sysroot contains executables.
+
+The presence of target executables isn't a given, as some systems (such
+as OpenEmbedded) strip the target sysroot down to headers are libraries.
+
+So the logic should be:
+
+- In native builds, look for query-loaders and fail if not found.
+- In cross builds where you can run host binaries, look for query-loaders
+ but allow it to be missing.
+- In cross builds where you cannot run host binaries, there's no use in
+ looking for query-loaders.
+
+Then either pass the paths or --show-cross-message to meson_install.py,
+depending on whether query-loaders was found or not.
+
+This fixes the case where Meson can run host executables, but the target
+sysroot does not actually contain gdk-pixbuf-query-loaders.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+diff --git i/gdk-pixbuf-loader/meson.build w/gdk-pixbuf-loader/meson.build
+index 6fa10a68b..4f88ba037 100644
+--- i/gdk-pixbuf-loader/meson.build
++++ w/gdk-pixbuf-loader/meson.build
+@@ -37,19 +37,21 @@ pixbuf_thumbnailer = configure_file(
+ )
+
+ if meson.can_run_host_binaries()
+- gdk_pixbuf_query_loaders = find_program(pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_query_loaders', default_value: 'gdk-pixbuf-query-loaders'))
++ gdk_pixbuf_query_loaders = find_program(pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_query_loaders', default_value: 'gdk-pixbuf-query-loaders'), required: not meson.is_cross_build())
+ endif
+
+-pixbufloader_svg_install_args = [
+- '--gdk-pixbuf-moduledir',
+- pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_moduledir', pkgconfig_define: ['prefix', prefix]),
+- pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_query_loaders', pkgconfig_define: ['prefix', prefix]),
+- pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_cache_file', pkgconfig_define: ['prefix', prefix])
+-]
+-
+-# Tell people to run gdk-pixbuf-query-loaders manually for cross builds
+-if not meson.can_run_host_binaries()
+- pixbufloader_svg_install_args += '--show-cross-message'
++if meson.can_run_host_binaries() and gdk_pixbuf_query_loaders.found()
++ pixbufloader_svg_install_args = [
++ '--moduledir',
++ pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_moduledir', pkgconfig_define: ['prefix', prefix]),
++ '--queryloaders',
++ gdk_pixbuf_query_loaders.full_path(),
++ '--cache-file',
++ pixbuf_dep.get_variable(pkgconfig: 'gdk_pixbuf_cache_file', pkgconfig_define: ['prefix', prefix])
++ ]
++else
++ # Tell people to run gdk-pixbuf-query-loaders manually for cross builds
++ pixbufloader_svg_install_args = ['--show-cross-message']
+ endif
+
+ meson.add_install_script(
+diff --git i/gdk-pixbuf-loader/meson_install.py w/gdk-pixbuf-loader/meson_install.py
+index ff003350f..d9bbbe433 100644
+--- i/gdk-pixbuf-loader/meson_install.py
++++ w/gdk-pixbuf-loader/meson_install.py
+@@ -6,29 +6,28 @@ import os
+ import subprocess
+ import sys
+
+-argparse = ArgumentParser('Deploy loaders.cache')
+-
+-argparse.add_argument('--gdk-pixbuf-moduledir', type=Path)
+-argparse.add_argument('gdk_pixbuf_queryloaders', type=Path)
+-argparse.add_argument('gdk_pixbuf_cache_file', type=Path)
+-argparse.add_argument('--show-cross-message', action='store_true')
+-
+ if __name__ == '__main__':
++ argparse = ArgumentParser(description='Deploy loaders.cache. Pass required paths, or --show-cross-message.')
++ argparse.add_argument('--queryloaders', type=Path, metavar="PATH", help="gdk-pixbuf-queryloaders to run")
++ argparse.add_argument('--moduledir', type=Path, metavar="PATH", help="installed gdk-pixbuf module directory")
++ argparse.add_argument('--cache-file', type=Path, metavar="PATH", help="module cache file to write")
++ argparse.add_argument('--show-cross-message', action='store_true', help="tell the user to run query-loaders manually")
+ args = argparse.parse_args()
+
+- cache_file: Path = args.gdk_pixbuf_cache_file
++ if not(args.show_cross_message or (args.queryloaders and args.moduledir and args.cache_file)):
++ argparse.print_help()
++ sys.exit(1)
+
+ if args.show_cross_message or os.environ.get("DESTDIR"):
+ print('*** Note: Please run gdk-pixbuf-queryloaders manually ' +
+ 'against the newly-built gdkpixbuf-svg loader', file=sys.stderr)
+ else:
+ env = os.environ.copy()
+- env['GDK_PIXBUF_MODULEDIR'] = Path(args.gdk_pixbuf_moduledir).as_posix()
+- with cache_file.open('w', encoding='utf-8') as f:
++ env['GDK_PIXBUF_MODULEDIR'] = args.moduledir.as_posix()
++ with args.cache_file.open('w', encoding='utf-8') as f:
+ subprocess.run(
+- [Path(args.gdk_pixbuf_queryloaders).as_posix()],
++ [args.queryloaders.as_posix()],
+ env=env,
+ stdout=f,
+ check=True
+ )
+-