summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2021-12-04 08:13:00 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-06 11:09:52 +0000
commit40349dc51f097f75b486d81924753dee06baf017 (patch)
tree4212562253d317488e8e509ba157c1a9003cb517 /meta
parenta9ad0c267ee25e824bf80e73368c3164d0f0321e (diff)
downloadpoky-40349dc51f097f75b486d81924753dee06baf017.tar.gz
meson: configure and use generic exe_wrapper
This replaces the specific gtkdoc wrapper setting (which was rejected by upstream in https://github.com/mesonbuild/meson/pull/9627) with a generic, officially supported and documented exe_wrapper, which is enabled subject to qemu usermode support (just as is done for g-i and gtk-doc with autotools). gtk-doc support is adjusted so that this wrapper is passed to meson's gtk-doc module, which passes it to gtk-doc. The adjusted patch is re-submitted upstream. The side effect of this is that meson is now able to run target binaries in a generic way when it wants to, so this may affect cross-builds - hopefully in a positive way. (From OE-Core rev: 17fb047282a413aae5af991ecf5bbb225e19581e) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/meson.bbclass30
-rw-r--r--meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch27
2 files changed, 46 insertions, 11 deletions
diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index a7981e481f..ffec5f3269 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -1,7 +1,12 @@
1inherit python3native meson-routines 1inherit python3native meson-routines qemu
2 2
3DEPENDS:append = " meson-native ninja-native" 3DEPENDS:append = " meson-native ninja-native"
4 4
5EXEWRAPPER_ENABLED:class-native = "False"
6EXEWRAPPER_ENABLED:class-nativesdk = "False"
7EXEWRAPPER_ENABLED ?= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)}"
8DEPENDS:append = "${@' qemu-native' if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ''}"
9
5# As Meson enforces out-of-tree builds we can just use cleandirs 10# As Meson enforces out-of-tree builds we can just use cleandirs
6B = "${WORKDIR}/build" 11B = "${WORKDIR}/build"
7do_configure[cleandirs] = "${B}" 12do_configure[cleandirs] = "${B}"
@@ -36,6 +41,9 @@ MESON_CROSS_FILE = ""
36MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross" 41MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross"
37MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross" 42MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross"
38 43
44# Needed to set up qemu wrapper below
45export STAGING_DIR_HOST
46
39def rust_tool(d, target_var): 47def rust_tool(d, target_var):
40 rustc = d.getVar('RUSTC') 48 rustc = d.getVar('RUSTC')
41 if not rustc: 49 if not rustc:
@@ -62,6 +70,7 @@ cups-config = 'cups-config'
62g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' 70g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper'
63g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper' 71g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper'
64${@rust_tool(d, "HOST_SYS")} 72${@rust_tool(d, "HOST_SYS")}
73${@"exe_wrapper = '${WORKDIR}/meson-qemuwrapper'" if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ""}
65 74
66[built-in options] 75[built-in options]
67c_args = ${@meson_array('CFLAGS', d)} 76c_args = ${@meson_array('CFLAGS', d)}
@@ -71,7 +80,6 @@ cpp_link_args = ${@meson_array('LDFLAGS', d)}
71 80
72[properties] 81[properties]
73needs_exe_wrapper = true 82needs_exe_wrapper = true
74gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'
75 83
76[host_machine] 84[host_machine]
77system = '${@meson_operating_system('HOST_OS', d)}' 85system = '${@meson_operating_system('HOST_OS', d)}'
@@ -106,6 +114,24 @@ cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
106EOF 114EOF
107} 115}
108 116
117do_write_config:append:class-target() {
118 # Write out a qemu wrapper that will be used as exe_wrapper so that meson
119 # can run target helper binaries through that.
120 qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
121 cat > ${WORKDIR}/meson-qemuwrapper << EOF
122#!/bin/sh
123# Use a modules directory which doesn't exist so we don't load random things
124# which may then get deleted (or their dependencies) and potentially segfault
125export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
126
127# meson sets this wrongly (only to libs in build-dir), qemu-wrapper_cmdline() and GIR_EXTRA_LIBS_PATH take care of it properly
128unset LD_LIBRARY_PATH
129
130$qemu_binary "\$@"
131EOF
132 chmod +x ${WORKDIR}/meson-qemuwrapper
133}
134
109# Tell externalsrc that changes to this file require a reconfigure 135# Tell externalsrc that changes to this file require a reconfigure
110CONFIGURE_FILES = "meson.build" 136CONFIGURE_FILES = "meson.build"
111 137
diff --git a/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch b/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch
index ab4d5969d9..b098c4a123 100644
--- a/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch
+++ b/meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch
@@ -1,29 +1,38 @@
1From 2f9c59e0489e569c5382404667c10f5c200a72ad Mon Sep 17 00:00:00 2001 1From bbdd6679e49bcba5ec022b240ac234a87b451e41 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com> 2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Fri, 4 Aug 2017 16:16:41 +0300 3Date: Fri, 4 Aug 2017 16:16:41 +0300
4Subject: [PATCH] gtkdoc: fix issues that arise when cross-compiling 4Subject: [PATCH] gtkdoc: add support for a binary wrapper
5 5
6Make it possible to specify a wrapper for executing binaries 6Make it possible to specify a wrapper for executing binaries
7in cross-compiling scenarios.
7(usually, some kind of target hardware emulator, such as qemu) 8(usually, some kind of target hardware emulator, such as qemu)
8 9
9Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/9627] 10Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/9627]
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> 11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11 12
12--- 13---
13 mesonbuild/modules/gnome.py | 4 ++++ 14 mesonbuild/modules/gnome.py | 5 ++++-
14 1 file changed, 4 insertions(+) 15 1 file changed, 4 insertions(+), 1 deletion(-)
15 16
16diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py 17diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
17index dc2979e..c9ff9bd 100644 18index 1c6952d..5a6ff94 100644
18--- a/mesonbuild/modules/gnome.py 19--- a/mesonbuild/modules/gnome.py
19+++ b/mesonbuild/modules/gnome.py 20+++ b/mesonbuild/modules/gnome.py
20@@ -1053,6 +1053,10 @@ class GnomeModule(ExtensionModule): 21@@ -35,7 +35,7 @@ from ..mesonlib import (
22 from ..dependencies import Dependency, PkgConfigDependency, InternalDependency
23 from ..interpreterbase import noPosargs, noKwargs, permittedKwargs, FeatureNew, FeatureNewKwargs, FeatureDeprecatedKwargs, FeatureDeprecated
24 from ..interpreterbase import typed_kwargs, KwargInfo, ContainerTypeInfo
25-from ..programs import ExternalProgram, OverrideProgram
26+from ..programs import ExternalProgram, OverrideProgram, EmptyExternalProgram
27 from ..build import CustomTarget, CustomTargetIndex, GeneratedList
28
29 if T.TYPE_CHECKING:
30@@ -1103,6 +1103,9 @@ class GnomeModule(ExtensionModule):
21 args.append(f'--{program_name}={path}') 31 args.append(f'--{program_name}={path}')
22 if namespace: 32 if namespace:
23 args.append('--namespace=' + namespace) 33 args.append('--namespace=' + namespace)
24+ gtkdoc_exe_wrapper = state.environment.properties.host.get('gtkdoc_exe_wrapper', None) 34+ if state.environment.need_exe_wrapper() and not isinstance(state.environment.get_exe_wrapper(), EmptyExternalProgram):
25+ if gtkdoc_exe_wrapper is not None: 35+ args.append('--run=' + ' '.join(state.environment.get_exe_wrapper().get_command()))
26+ args.append('--run=' + gtkdoc_exe_wrapper)
27+ 36+
28 args += self._unpack_args('--htmlargs=', 'html_args', kwargs) 37 args += self._unpack_args('--htmlargs=', 'html_args', kwargs)
29 args += self._unpack_args('--scanargs=', 'scan_args', kwargs) 38 args += self._unpack_args('--scanargs=', 'scan_args', kwargs)