diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/meson.bbclass | 30 |
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 @@ | |||
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 | ||