[2/2] meson.bbclass: add exe_wrapper helper

Message ID 20220220000805.1567335-2-quaresma.jose@gmail.com
State New
Headers show
Series [1/2] meson.bbclass: add support for running the meson tests at build time | expand

Commit Message

Jose Quaresma Feb. 20, 2022, 12:08 a.m. UTC
When we use the exe_wrapper to run the tests we need
a way to circumvent the limitations of qemu usermode.
So for example we can skip the tests we know will fail.
The ideia of this help script is to handle such cases
before the qemu usermode was launched.

Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
 meta/classes/meson.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index bc15cb8163..11c6b403f0 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -114,6 +114,8 @@  cpp_link_args = ${@meson_array('BUILD_LDFLAGS', d)}
 EOF
 }
 
+MESON_QEMU_WRAPPER_HELPER ?= ""
+
 do_write_config:append:class-target() {
     # Write out a qemu wrapper that will be used as exe_wrapper so that meson
     # can run target helper binaries through that.
@@ -127,10 +129,14 @@  export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy
 # meson sets this wrongly (only to libs in build-dir), qemu_wrapper_cmdline() and GIR_EXTRA_LIBS_PATH take care of it properly
 unset LD_LIBRARY_PATH
 
+# import any customization provided in the helper
+test -f "${MESON_QEMU_WRAPPER_HELPER}" && . ${MESON_QEMU_WRAPPER_HELPER}
+
 $qemu_binary "\$@"
 EOF
     chmod +x ${WORKDIR}/meson-qemuwrapper
 }
+do_write_config:class-target[vardeps] += "MESON_QEMU_WRAPPER_HELPER"
 
 # Tell externalsrc that changes to this file require a reconfigure
 CONFIGURE_FILES = "meson.build"