diff options
-rw-r--r-- | meta/classes/meson.bbclass | 30 | ||||
-rw-r--r-- | meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch | 27 |
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 @@ | |||
1 | inherit python3native meson-routines | 1 | inherit python3native meson-routines qemu |
2 | 2 | ||
3 | DEPENDS:append = " meson-native ninja-native" | 3 | DEPENDS:append = " meson-native ninja-native" |
4 | 4 | ||
5 | EXEWRAPPER_ENABLED:class-native = "False" | ||
6 | EXEWRAPPER_ENABLED:class-nativesdk = "False" | ||
7 | EXEWRAPPER_ENABLED ?= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'True', 'False', d)}" | ||
8 | DEPENDS: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 |
6 | B = "${WORKDIR}/build" | 11 | B = "${WORKDIR}/build" |
7 | do_configure[cleandirs] = "${B}" | 12 | do_configure[cleandirs] = "${B}" |
@@ -36,6 +41,9 @@ MESON_CROSS_FILE = "" | |||
36 | MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross" | 41 | MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross" |
37 | MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross" | 42 | MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross" |
38 | 43 | ||
44 | # Needed to set up qemu wrapper below | ||
45 | export STAGING_DIR_HOST | ||
46 | |||
39 | def rust_tool(d, target_var): | 47 | def 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' | |||
62 | g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' | 70 | g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' |
63 | g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper' | 71 | g-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] |
67 | c_args = ${@meson_array('CFLAGS', d)} | 76 | c_args = ${@meson_array('CFLAGS', d)} |
@@ -71,7 +80,6 @@ cpp_link_args = ${@meson_array('LDFLAGS', d)} | |||
71 | 80 | ||
72 | [properties] | 81 | [properties] |
73 | needs_exe_wrapper = true | 82 | needs_exe_wrapper = true |
74 | gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper' | ||
75 | 83 | ||
76 | [host_machine] | 84 | [host_machine] |
77 | system = '${@meson_operating_system('HOST_OS', d)}' | 85 | system = '${@meson_operating_system('HOST_OS', d)}' |
@@ -106,6 +114,24 @@ cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)} | |||
106 | EOF | 114 | EOF |
107 | } | 115 | } |
108 | 116 | ||
117 | do_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 | ||
125 | export 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 | ||
128 | unset LD_LIBRARY_PATH | ||
129 | |||
130 | $qemu_binary "\$@" | ||
131 | EOF | ||
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 |
110 | CONFIGURE_FILES = "meson.build" | 136 | CONFIGURE_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 @@ | |||
1 | From 2f9c59e0489e569c5382404667c10f5c200a72ad Mon Sep 17 00:00:00 2001 | 1 | From bbdd6679e49bcba5ec022b240ac234a87b451e41 Mon Sep 17 00:00:00 2001 |
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
3 | Date: Fri, 4 Aug 2017 16:16:41 +0300 | 3 | Date: Fri, 4 Aug 2017 16:16:41 +0300 |
4 | Subject: [PATCH] gtkdoc: fix issues that arise when cross-compiling | 4 | Subject: [PATCH] gtkdoc: add support for a binary wrapper |
5 | 5 | ||
6 | Make it possible to specify a wrapper for executing binaries | 6 | Make it possible to specify a wrapper for executing binaries |
7 | in 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 | ||
9 | Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/9627] | 10 | Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/9627] |
10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | 11 | Signed-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 | ||
16 | diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py | 17 | diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py |
17 | index dc2979e..c9ff9bd 100644 | 18 | index 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) |