diff mbox series

[meta-oe] mozjs-128: inherit cargo to fix build on rustup systems

Message ID 20250508161353.903041-1-yoann.congal@smile.fr
State Under Review
Headers show
Series [meta-oe] mozjs-128: inherit cargo to fix build on rustup systems | expand

Commit Message

Yoann Congal May 8, 2025, 4:13 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

mozjs build uses cargo deep in the build tree. The configure step tries
to find the cargo home and forcibly start with the home rustup directory
(~/.cargo) when not found. This leads to the build partially using
rustup cargo and to a build error when this cargo version is not
compatible with the OE-Core one.

To fix this, inherit cargo to inherit a working cargo environment (e.g.
CARGO_HOME). But, override do_compile to keep the previous
(base/Makefile) task.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 meta-oe/recipes-extended/mozjs/mozjs-128_128.5.2.bb | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/mozjs/mozjs-128_128.5.2.bb b/meta-oe/recipes-extended/mozjs/mozjs-128_128.5.2.bb
index 6bcbb13501..c3804ec64d 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs-128_128.5.2.bb
+++ b/meta-oe/recipes-extended/mozjs/mozjs-128_128.5.2.bb
@@ -24,7 +24,7 @@  UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)"
 
 S = "${WORKDIR}/firefox-${PV}"
 
-inherit pkgconfig perlnative python3native rust
+inherit pkgconfig perlnative python3native rust cargo
 
 DEPENDS += "zlib cbindgen-native python3 icu"
 DEPENDS:remove:mipsarch = "icu"
@@ -83,6 +83,13 @@  do_configure() {
 }
 do_configure[cleandirs] += "${B}"
 
+# The main build system is a Makefile that call cargo downstream.
+# We inherit cargo to get the environnement but need to switch back to
+# base_do_compile to do the Makefile base compilation.
+do_compile() {
+    base_do_compile
+}
+
 do_install() {
     oe_runmake 'DESTDIR=${D}' install
 }