diff mbox series

[v2,6/8] classes/meson: no need to export STAGING_DIR_HOST

Message ID 20251211175547.3944470-6-ross.burton@arm.com
State Accepted, archived
Commit d96b29513d016fc1a026ef18b5fa31b893cdf521
Headers show
Series [v2,1/8] iputils: just set bindir, not prefix | expand

Commit Message

Ross Burton Dec. 11, 2025, 5:55 p.m. UTC
If we use ${} for STAGING_DIR_HOST then the correct paths get written
into the command earlier.

Also use STAGING_LIBDIR, it's the same end result but more idiomatic.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-recipe/meson.bbclass | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Alexander Kanavin Dec. 15, 2025, 6:27 p.m. UTC | #1
On Thu, 11 Dec 2025 at 18:56, Ross Burton via lists.openembedded.org
<ross.burton=arm.com@lists.openembedded.org> wrote:
> -# Needed to set up qemu wrapper below
> -export STAGING_DIR_HOST
...
> -    qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}"
> +    qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_LIBDIR}','${STAGING_BASELIBDIR}'])}"
>      cat > ${WORKDIR}/meson-qemuwrapper << EOF

I didn't want to take time in the patch review, but I went and checked
how this export appeared in the first place. It happened in 2016, when
using qemu to run target binaries was introtroduced to enable
cross-built gobject introspection:

https://git.openembedded.org/openembedded-core/commit/?id=c54c5fc63c05d416f3733a742fc94f7a169adc8b

I think Alex-2016 simply didn't realize that bitbake can substitute
its own variables in shell functions directly, and everything in there
must be 'exported' into the shell and deferred until shell runs the
script. And then the proven-to-work wrapper code was mindlessly copy
pasted around to places like gtk-doc or meson. So similar cleanups can
probably happen in gtk-doc class and g-i recipe as well.

Alex
diff mbox series

Patch

diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass
index 0709a1313a4..2c098771fec 100644
--- a/meta/classes-recipe/meson.bbclass
+++ b/meta/classes-recipe/meson.bbclass
@@ -50,9 +50,6 @@  MESON_CROSS_FILE = ""
 MESON_CROSS_FILE:class-target = "--cross-file ${WORKDIR}/meson.cross"
 MESON_CROSS_FILE:class-nativesdk = "--cross-file ${WORKDIR}/meson.cross"
 
-# Needed to set up qemu wrapper below
-export STAGING_DIR_HOST
-
 def rust_tool(d, target_var):
     rustc = d.getVar('RUSTC')
     if not rustc:
@@ -141,7 +138,7 @@  EOF
 write_qemuwrapper() {
     # 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}'])}"
+    qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_HOST}', ['${STAGING_LIBDIR}','${STAGING_BASELIBDIR}'])}"
     cat > ${WORKDIR}/meson-qemuwrapper << EOF
 #!/bin/sh
 # Use a modules directory which doesn't exist so we don't load random things