From: Harish Sadineni <[email protected]>

Add support for rust-out-of-tree module compilation:
- Add dependency to rust-native
- Remap ${S} in compiled output to avoid buildpath errors
- Added check to skip rust out-of-ree-module compilation,
  if rust kernel support is not enabled

Co-developed-by:Yoann Congal <[email protected]>
Signed-off-by: Yoann Congal <[email protected]>
Signed-off-by: Harish Sadineni <[email protected]>
---
 meta/classes-recipe/module-rust.bbclass | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 meta/classes-recipe/module-rust.bbclass

diff --git a/meta/classes-recipe/module-rust.bbclass 
b/meta/classes-recipe/module-rust.bbclass
new file mode 100644
index 0000000000..f9cee5e5bd
--- /dev/null
+++ b/meta/classes-recipe/module-rust.bbclass
@@ -0,0 +1,21 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit module
+
+DEPENDS += " rust-native"
+
+RUST_DEBUG_REMAP = "--remap-path-prefix=${S}=${TARGET_DBGSRC_DIR} "
+KRUSTFLAGS = " ${RUST_DEBUG_REMAP}"
+EXTRA_OEMAKE:append = " KRUSTFLAGS='${KRUSTFLAGS}'"
+
+python __anonymous() {
+    features = (d.getVar('KERNEL_RUST_SUPPORT') or "").split()
+    if "True" not in features:
+        raise bb.parse.SkipRecipe(
+            "Skipping rust-out-of-tree-module: KERNEL_RUST_SUPPORT is not 
enabled"
+       )
+}
-- 
2.49.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#231067): 
https://lists.openembedded.org/g/openembedded-core/message/231067
Mute This Topic: https://lists.openembedded.org/mt/117779202/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to