Skip to contentSkip to conversation

meson.bbclass: add exe_wrapper helper

PATCH New Jose Quaresma 1 participant 2 messages Feb 17, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 meson.bbclass: add exe_wrapper helper

commit 40349dc51f097f75b486d81924753dee06baf017
meson: configure and use generic exe_wrapper
add a generic exe_wrapper that can be used to run
the existing tests in some meson projects using
the native meson test.

The tests will run on the qemu usermode and because of that it has some limitations.
The ideia of this help script is to handle such cases before the qemu usermode was launched.

---
 meta/classes/meson.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
meta/classes/meson.bbclass +5 -0
index 0bfe945811..8c732e6174 100644
@@ -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,6 +129,9 @@ 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
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/2 meson.bbclass: makes the exe_wrapper more configurable

---
 meta/classes/meson.bbclass | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
meta/classes/meson.bbclass +6 -5
index 8c732e6174..4af14300ac 100644
@@ -70,7 +70,7 @@ cups-config = 'cups-config'
 g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper'
 g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper'
 ${@rust_tool(d, "HOST_SYS")}
-${@"exe_wrapper = '${WORKDIR}/meson-qemuwrapper'" if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ""}
+${@"exe_wrapper = '${MESON_QEMU_WRAPPER}'" if d.getVar('EXEWRAPPER_ENABLED') == 'True' else ""}
 
 [built-in options]
 c_args = ${@meson_array('CFLAGS', d)}
@@ -115,12 +115,13 @@ EOF
 }
 
 MESON_QEMU_WRAPPER_HELPER ?= ""
+MESON_QEMU_WRAPPER_BINARY ?= "${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
+MESON_QEMU_WRAPPER ?= "${WORKDIR}/meson-qemuwrapper"
 
 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.
-    qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
-    cat > ${WORKDIR}/meson-qemuwrapper << EOF
+    cat > ${MESON_QEMU_WRAPPER} << EOF
 #!/bin/sh
 # Use a modules directory which doesn't exist so we don't load random things
 # which may then get deleted (or their dependencies) and potentially segfault
@@ -132,9 +133,9 @@ unset LD_LIBRARY_PATH
 # import any customization provided in the helper
 test -f "${MESON_QEMU_WRAPPER_HELPER}" && . ${MESON_QEMU_WRAPPER_HELPER}
 
-$qemu_binary "\$@"
+${MESON_QEMU_WRAPPER_BINARY} "\$@"
 EOF
-    chmod +x ${WORKDIR}/meson-qemuwrapper
+    chmod +x ${MESON_QEMU_WRAPPER}
 }
 
 # Tell externalsrc that changes to this file require a reconfigure
Signature · 1 line
2.35.1