[2/2] meson.bbclass: makes the exe_wrapper more configurable

Message ID 20220217225935.727335-2-quaresma.jose@gmail.com
State New
Headers show
Series [1/2] meson.bbclass: add exe_wrapper helper | expand

Commit Message

Jose Quaresma Feb. 17, 2022, 10:59 p.m. UTC
Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
 meta/classes/meson.bbclass | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index 8c732e6174..4af14300ac 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -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