diff mbox series

[meta-oe] nodejs: native: avoid target-specific signatures

Message ID 20260617120644.2169686-1-jeroen@myspectrum.nl
State Under Review
Headers show
Series [meta-oe] nodejs: native: avoid target-specific signatures | expand

Commit Message

Jeroen Hofstee June 17, 2026, 12:06 p.m. UTC
From: Jeroen Hofstee <jhofstee@victronenergy.com>

The do_create_v8_qemu_wrapper function depends on target information,
which ends up in the task signature, but the qemu wrapper isn't needed
for native builds. This causes unnecessary rebuilds of nodejs-native.

Delete the task for nodejs-native and don't install the wrapper script
for it.

This issue was previously addressed by b2a950a ("nodejs: inherit qemu
class conditionally"), which was later reverted. This patch addresses
it by removing the unused task from native builds instead of inheriting
qemu conditionally.

Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
---
To reproduce:

Before the patch:
Start with a clean TMPDIR.
Build nodejs-native for one target architecture.
Build nodejs-native for a different target architecture.
nodejs-native will be rebuilt or restaged.

After the patch:
Building for a different target architecture no longer triggers
a rebuild or restaging of nodejs-native because the native build
is no longer target-specific.
---
 meta-oe/recipes-devtools/nodejs/nodejs_24.16.0.bb | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_24.16.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_24.16.0.bb
index ff40a09656..89f32f2063 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_24.16.0.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_24.16.0.bb
@@ -150,9 +150,12 @@  do_configure () {
                ${PACKAGECONFIG_CONFARGS}
 }
 
+do_compile:prepend:class-target() {
+    install -D ${B}/v8-qemu-wrapper.sh ${B}/out/Release/v8-qemu-wrapper.sh
+}
+
 do_compile () {
     install -D ${RECIPE_SYSROOT_NATIVE}/etc/ssl/openssl.cnf ${B}/deps/openssl/nodejs-openssl.cnf
-    install -D ${B}/v8-qemu-wrapper.sh ${B}/out/Release/v8-qemu-wrapper.sh
     oe_runmake BUILDTYPE=Release
 }
 
@@ -199,6 +202,13 @@  python set_gyp_variables () {
 }
 
 python __anonymous () {
+    # do_create_v8_qemu_wrapper is not needed for the native build, so make sure it
+    # gets deleted otherwise target info ends up in its signature making the native
+    # build target specific.
+    if bb.data.inherits_class('native', d):
+        bb.build.deltask('do_create_v8_qemu_wrapper', d)
+        return
+
     # 32 bit target and 64 bit host (x86-64 or aarch64) have different bit width
     if d.getVar("SITEINFO_BITS") == "32" and "64" in d.getVar("BUILD_ARCH"):
         d.setVar("HOST_AND_TARGET_SAME_WIDTH", "0")