summaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2023-01-26 21:27:36 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-01-28 00:07:08 +0000
commitd58a8a153cf21dcbe98b0cdc138efafb75459d28 (patch)
tree461ae45ad8a56f27c526769dae836ebfcd5c46ff /meta/recipes-gnome
parentd6f97cf271080779675094d83f17e9974f9c0927 (diff)
downloadpoky-d58a8a153cf21dcbe98b0cdc138efafb75459d28.tar.gz
gdk-pixbuf: do not use tools from gdk-pixbuf-native when building tests
The patch that allows to do so has not been accepted upstream, and wasn't correctly working as it was running a native executable (gdk-pixbuf-query-loaders) with target .so plugins. On the other hand, out of 20+ (currently 23) tests only three require running binaries at build time to produce special test-specific input data: cve-2015-4491 pixbuf-pixdata pixbuf-resource So let's simply omit these from the build: this can be done with a far less invasive patch which has a chance of being accepted upstream. gdk-pixbuf-print-mime-types is no longer installed (the replaced patch was doing that). (From OE-Core rev: 0d926508e75095eb446699b612729d0243eacc91) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-gnome')
-rw-r--r--meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-Add-use_prebuilt_tools-option.patch173
-rw-r--r--meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch66
-rw-r--r--meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.42.10.bb17
3 files changed, 68 insertions, 188 deletions
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-Add-use_prebuilt_tools-option.patch b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-Add-use_prebuilt_tools-option.patch
deleted file mode 100644
index 02cc9a2a70..0000000000
--- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-Add-use_prebuilt_tools-option.patch
+++ /dev/null
@@ -1,173 +0,0 @@
1From f81b60ebcbbfd9548c8aa1e388662c429068d1e3 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Sat, 8 May 2021 21:58:54 +0200
4Subject: [PATCH] Add use_prebuilt_tools option
5
6This allows using the gdk-pixbuf tools from the host to
7build and install tests in a cross-compile scenarion.
8
9Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/119]
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11
12---
13 gdk-pixbuf/meson.build | 11 +++++++++--
14 meson.build | 6 +++---
15 meson_options.txt | 4 ++++
16 tests/meson.build | 16 ++++++++--------
17 thumbnailer/meson.build | 24 ++++++++++++++++++------
18 5 files changed, 42 insertions(+), 19 deletions(-)
19
20diff --git a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build
21index 54ff9dd..2e321cf 100644
22--- a/gdk-pixbuf/meson.build
23+++ b/gdk-pixbuf/meson.build
24@@ -342,13 +342,20 @@ foreach bin: gdkpixbuf_bin
25 include_directories: [ root_inc, gdk_pixbuf_inc ],
26 c_args: common_cflags + gdk_pixbuf_cflags,
27 install: true)
28- meson.override_find_program(bin_name, bin)
29+ if not get_option('use_prebuilt_tools')
30+ meson.override_find_program(bin_name, bin)
31+ endif
32
33 # Used in tests
34 set_variable(bin_name.underscorify(), bin)
35 endforeach
36
37-if not meson.is_cross_build()
38+if get_option('use_prebuilt_tools')
39+ gdk_pixbuf_query_loaders = find_program('gdk-pixbuf-query-loaders', required: true)
40+ gdk_pixbuf_pixdata = find_program('gdk-pixbuf-pixdata', required: true)
41+endif
42+
43+if not meson.is_cross_build() or get_option('use_prebuilt_tools')
44 # The 'loaders.cache' used for testing, so we don't accidentally
45 # load the installed cache; we always build it by default
46 loaders_cache = custom_target('loaders.cache',
47diff --git a/meson.build b/meson.build
48index 813bd43..a93e6f7 100644
49--- a/meson.build
50+++ b/meson.build
51@@ -369,18 +369,18 @@ subdir('gdk-pixbuf')
52 # i18n
53 subdir('po')
54
55-if not meson.is_cross_build()
56+if not meson.is_cross_build() or get_option('use_prebuilt_tools')
57 if get_option('tests')
58 subdir('tests')
59 endif
60- subdir('thumbnailer')
61 endif
62+subdir('thumbnailer')
63
64 # Documentation
65 build_docs = get_option('gtk_doc') or get_option('docs')
66 subdir('docs')
67
68-if not meson.is_cross_build()
69+if not meson.is_cross_build() or get_option('use_prebuilt_tools')
70 meson.add_install_script('build-aux/post-install.py',
71 gdk_pixbuf_bindir,
72 gdk_pixbuf_libdir,
73diff --git a/meson_options.txt b/meson_options.txt
74index d198d99..1c899e9 100644
75--- a/meson_options.txt
76+++ b/meson_options.txt
77@@ -53,4 +53,8 @@ option('gio_sniffing',
78 description: 'Perform file type detection using GIO (Unused on MacOS and Windows)',
79 type: 'boolean',
80 value: true)
81+option('use_prebuilt_tools',
82+ description: 'Use prebuilt gdk-pixbuf tools from the host for cross-compilation',
83+ type: 'boolean',
84+ value: false)
85
86diff --git a/tests/meson.build b/tests/meson.build
87index 28c2525..d97c02d 100644
88--- a/tests/meson.build
89+++ b/tests/meson.build
90@@ -5,6 +5,12 @@
91 # $PATH. Ideally we should use gnome.compile_resources() and let Meson deal with
92 # this problem: See https://github.com/mesonbuild/meson/issues/8266.
93 if enabled_loaders.contains('png') and host_system != 'windows'
94+
95+ resources_deps = [loaders_cache,]
96+ if not get_option('use_prebuilt_tools')
97+ resources_deps += [gdk_pixbuf_pixdata,]
98+ endif
99+
100 # Resources; we cannot use gnome.compile_resources() here, because we need to
101 # override the environment in order to use the utilities we just built instead
102 # of the system ones
103@@ -21,10 +27,7 @@ if enabled_loaders.contains('png') and host_system != 'windows'
104 '@INPUT@',
105 '@OUTPUT@',
106 ],
107- depends: [
108- gdk_pixbuf_pixdata,
109- loaders_cache,
110- ],
111+ depends: resources_deps,
112 )
113
114 resources_h = custom_target('resources.h',
115@@ -40,10 +43,7 @@ if enabled_loaders.contains('png') and host_system != 'windows'
116 '@INPUT@',
117 '@OUTPUT@',
118 ],
119- depends: [
120- gdk_pixbuf_pixdata,
121- loaders_cache,
122- ],
123+ depends: resources_deps,
124 )
125 no_resources = false
126 else
127diff --git a/thumbnailer/meson.build b/thumbnailer/meson.build
128index b6a206d..9336c21 100644
129--- a/thumbnailer/meson.build
130+++ b/thumbnailer/meson.build
131@@ -6,13 +6,29 @@ bin = executable('gdk-pixbuf-thumbnailer',
132 ],
133 dependencies: gdk_pixbuf_deps + [ gdkpixbuf_dep ],
134 install: true)
135-meson.override_find_program('gdk-pixbuf-thumbnailer', bin)
136+if not get_option('use_prebuilt_tools')
137+ meson.override_find_program('gdk-pixbuf-thumbnailer', bin)
138+endif
139
140 gdk_pixbuf_print_mime_types = executable('gdk-pixbuf-print-mime-types',
141 'gdk-pixbuf-print-mime-types.c',
142+ install: true,
143 c_args: common_cflags,
144 dependencies: gdk_pixbuf_deps + [ gdkpixbuf_dep ])
145
146+if get_option('use_prebuilt_tools')
147+ gdk_pixbuf_print_mime_types = find_program('gdk-pixbuf-print-mime-types', required: true)
148+endif
149+
150+thumbnailer_deps = [loaders_cache,]
151+
152+if not get_option('use_prebuilt_tools')
153+ thumbnailer_deps += [
154+ gdk_pixbuf_print_mime_types,
155+ gdk_pixbuf_pixdata,
156+ ]
157+endif
158+
159 custom_target('thumbnailer',
160 input: 'gdk-pixbuf-thumbnailer.thumbnailer.in',
161 output: 'gdk-pixbuf-thumbnailer.thumbnailer',
162@@ -25,10 +41,6 @@ custom_target('thumbnailer',
163 '@INPUT@',
164 '@OUTPUT@',
165 ],
166- depends: [
167- gdk_pixbuf_print_mime_types,
168- gdk_pixbuf_pixdata,
169- loaders_cache,
170- ],
171+ depends: thumbnailer_deps,
172 install: true,
173 install_dir: join_paths(gdk_pixbuf_datadir, 'thumbnailers'))
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch
new file mode 100644
index 0000000000..7250fa3f62
--- /dev/null
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch
@@ -0,0 +1,66 @@
1From 9d3b374e75692da3d1d05344a1693c85a3098f47 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex@linutronix.de>
3Date: Thu, 26 Jan 2023 20:29:46 +0100
4Subject: [PATCH] meson.build: allow (a subset of) tests in cross compile
5 settings
6
7There is no need to completely disable tests: most of them
8do not require running target executables at build time,
9and so can be built and installed.
10
11This requires inserting a couple of specific guards around
12items that do require running target executables.
13
14Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/150]
15Signed-off-by: Alexander Kanavin <alex@linutronix.de>
16---
17 meson.build | 6 +++---
18 tests/meson.build | 10 ++++++----
19 2 files changed, 9 insertions(+), 7 deletions(-)
20
21diff --git a/meson.build b/meson.build
22index 8a16c8f..7c8b20f 100644
23--- a/meson.build
24+++ b/meson.build
25@@ -369,10 +369,10 @@ subdir('gdk-pixbuf')
26 # i18n
27 subdir('po')
28
29+if get_option('tests')
30+ subdir('tests')
31+endif
32 if not meson.is_cross_build()
33- if get_option('tests')
34- subdir('tests')
35- endif
36 subdir('thumbnailer')
37 endif
38
39diff --git a/tests/meson.build b/tests/meson.build
40index 28c2525..c45e765 100644
41--- a/tests/meson.build
42+++ b/tests/meson.build
43@@ -4,7 +4,7 @@
44 # gdk-pixbuf-pixdata from build directory because it needs all DLL locations in
45 # $PATH. Ideally we should use gnome.compile_resources() and let Meson deal with
46 # this problem: See https://github.com/mesonbuild/meson/issues/8266.
47-if enabled_loaders.contains('png') and host_system != 'windows'
48+if enabled_loaders.contains('png') and host_system != 'windows' and not meson.is_cross_build()
49 # Resources; we cannot use gnome.compile_resources() here, because we need to
50 # override the environment in order to use the utilities we just built instead
51 # of the system ones
52@@ -166,9 +166,11 @@ endif
53 test_deps = gdk_pixbuf_deps + [ gdkpixbuf_dep, ]
54 test_args = [ '-k' ]
55 test_env = environment()
56-test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
57-test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
58-test_env.set('GDK_PIXBUF_MODULE_FILE', loaders_cache.full_path())
59+if not meson.is_cross_build()
60+ test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
61+ test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
62+ test_env.set('GDK_PIXBUF_MODULE_FILE', loaders_cache.full_path())
63+endif
64
65 foreach test_name, test_data: installed_tests
66 test_sources = [ test_name + '.c', 'test-common.c' ]
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.42.10.bb b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.42.10.bb
index aa44515fbb..cca89a9059 100644
--- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.42.10.bb
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.42.10.bb
@@ -12,15 +12,14 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c \
12 12
13SECTION = "libs" 13SECTION = "libs"
14 14
15DEPENDS = "glib-2.0 gdk-pixbuf-native shared-mime-info" 15DEPENDS = "glib-2.0 shared-mime-info"
16DEPENDS:remove:class-native = "gdk-pixbuf-native"
17 16
18MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" 17MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}"
19 18
20SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz \ 19SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz \
21 file://run-ptest \ 20 file://run-ptest \
22 file://fatal-loader.patch \ 21 file://fatal-loader.patch \
23 file://0001-Add-use_prebuilt_tools-option.patch \ 22 file://0001-meson.build-allow-a-subset-of-tests-in-cross-compile.patch \
24 " 23 "
25 24
26SRC_URI[sha256sum] = "ee9b6c75d13ba096907a2e3c6b27b61bcd17f5c7ebeab5a5b439d2f2e39fe44b" 25SRC_URI[sha256sum] = "ee9b6c75d13ba096907a2e3c6b27b61bcd17f5c7ebeab5a5b439d2f2e39fe44b"
@@ -46,14 +45,6 @@ PACKAGECONFIG[tests] = "-Dinstalled_tests=true,-Dinstalled_tests=false"
46 45
47EXTRA_OEMESON = "-Dman=false" 46EXTRA_OEMESON = "-Dman=false"
48 47
49EXTRA_OEMESON:append:class-target = " \
50 -Duse_prebuilt_tools=true \
51"
52
53EXTRA_OEMESON:append:class-nativesdk = " \
54 -Duse_prebuilt_tools=true \
55"
56
57PACKAGES =+ "${PN}-xlib" 48PACKAGES =+ "${PN}-xlib"
58 49
59# For GIO image type sniffing 50# For GIO image type sniffing
@@ -115,10 +106,6 @@ do_install:append:class-native() {
115 XDG_DATA_DIRS=${STAGING_DATADIR} \ 106 XDG_DATA_DIRS=${STAGING_DATADIR} \
116 GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache 107 GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache
117 108
118 create_wrapper ${D}/${bindir}/gdk-pixbuf-print-mime-types \
119 XDG_DATA_DIRS=${STAGING_DATADIR} \
120 GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache
121
122 create_wrapper ${D}/${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \ 109 create_wrapper ${D}/${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
123 XDG_DATA_DIRS=${STAGING_DATADIR} \ 110 XDG_DATA_DIRS=${STAGING_DATADIR} \
124 GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache \ 111 GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache \