diff mbox series

[meta-lts-mixins,kirkstone/rust,v2,1/1] mozjs: Use RUST_HOST_SYS and RUST_TARGET_SYS

Message ID 20250507061132.838447-1-soumya.sambu@windriver.com
State New
Headers show
Series [meta-lts-mixins,kirkstone/rust,v2,1/1] mozjs: Use RUST_HOST_SYS and RUST_TARGET_SYS | expand

Commit Message

ssambu May 7, 2025, 6:11 a.m. UTC
From: Soumya Sambu <soumya.sambu@windriver.com>

The mozjs-91 and mozjs-78 recipe in meta-openembedded sets --target=${HOST_SYS} and
--target=${TARGET_SYS} respectively, which leads to an error when using Rust from meta-lts-mixins:

error: Error loading target specification: Could not find specification for target "x86_64-poky-linux".

Updated target configuration to resolve this.

Additionally, `mozjs-78` encountered "linker 'cc' not found" error. This was fixed by explicitly
defining the linker for Rust.

Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
---
 README.md                                          |  2 +-
 conf/layer.conf                                    |  4 ++++
 .../recipes-devtools/rust/rust_1.85.1.bbappend     |  7 +++++++
 .../recipes-extended/mozjs/mozjs-78_%.bbappend     | 14 ++++++++++++++
 .../recipes-extended/mozjs/mozjs-91_%.bbappend     | 13 +++++++++++++
 5 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 dynamic-layers/meta-python/recipes-devtools/rust/rust_1.85.1.bbappend
 create mode 100644 dynamic-layers/meta-python/recipes-extended/mozjs/mozjs-78_%.bbappend
 create mode 100644 dynamic-layers/openembedded-layer/recipes-extended/mozjs/mozjs-91_%.bbappend
diff mbox series

Patch

diff --git a/README.md b/README.md
index 482f0cd..f05accf 100644
--- a/README.md
+++ b/README.md
@@ -132,4 +132,4 @@  Layer maintainers:
 Scott Murray <scott.murray@konsulko.com>
 
 Dynamic layer support maintainers:
-TBD
+Soumya Sambu <soumya.sambu@windriver.com>
diff --git a/conf/layer.conf b/conf/layer.conf
index 281eeca..4fe4ec4 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -26,6 +26,10 @@  BBMASK:append = " meta/recipes-devtools/cargo/ meta/recipes-devtools/rust/ meta/
 # the newer BBCLASSEXTEND version that we carry.
 BBMASK:append = " meta/recipes-devtools/python/python3-setuptools-rust-native_%"
 
+BBFILES_DYNAMIC += " \
+    meta-python:${LAYERDIR}/dynamic-layers/meta-python/recipes-*/*/*.bbappend \
+    openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bbappend"
+
 # These are in bitbake.conf in langdale and up, adding them here to make
 # using the layer more turn-key seems reasonable.
 BB_BASEHASH_IGNORE_VARS:append = " RUST_BUILD_SYS RUST_HOST_SYS RUST_TARGET_SYS"
diff --git a/dynamic-layers/meta-python/recipes-devtools/rust/rust_1.85.1.bbappend b/dynamic-layers/meta-python/recipes-devtools/rust/rust_1.85.1.bbappend
new file mode 100644
index 0000000..9b09f9e
--- /dev/null
+++ b/dynamic-layers/meta-python/recipes-devtools/rust/rust_1.85.1.bbappend
@@ -0,0 +1,7 @@ 
+python do_configure:append() {
+    config.set("rust", "default-linker", e(d.expand("${RUST_BUILD_CCLD}")))
+
+    with open("config.toml", "w") as f:
+        f.write("change-id = 116881\n\n")
+        config.write(f)
+}
diff --git a/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs-78_%.bbappend b/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs-78_%.bbappend
new file mode 100644
index 0000000..8e8c24a
--- /dev/null
+++ b/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs-78_%.bbappend
@@ -0,0 +1,14 @@ 
+EXTRA_OECONF = " \
+    --target=${RUST_TARGET_SYS} \
+    --host=${BUILD_SYS} \
+    --prefix=${prefix} \
+    --libdir=${libdir} \
+    --x-includes=${STAGING_INCDIR} \
+    --x-libraries=${STAGING_LIBDIR} \
+    --without-system-icu \
+    --disable-tests --disable-strip --disable-optimize \
+    --disable-jemalloc \
+    --with-system-icu \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', "--enable-gold", '--disable-gold', d)} \
+    ${JIT} \
+"
diff --git a/dynamic-layers/openembedded-layer/recipes-extended/mozjs/mozjs-91_%.bbappend b/dynamic-layers/openembedded-layer/recipes-extended/mozjs/mozjs-91_%.bbappend
new file mode 100644
index 0000000..c0214b0
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-extended/mozjs/mozjs-91_%.bbappend
@@ -0,0 +1,13 @@ 
+do_configure() {
+        cd ${B}
+        python3 ${S}/configure.py \
+        --enable-project=js \
+        --target=${RUST_HOST_SYS} \
+        --host=${BUILD_SYS} \
+        --prefix=${prefix} \
+        --libdir=${libdir} \
+        --disable-jemalloc \
+        --disable-strip \
+        ${JIT} \
+        ${ICU}
+}