summaryrefslogtreecommitdiffstats
path: root/meta/classes/meson.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/meson.bbclass')
-rw-r--r--meta/classes/meson.bbclass30
1 files changed, 28 insertions, 2 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