diff mbox series

[meta-lts-mixins,1/4] cargo.bbclass: set up cargo environment in common do_compile

Message ID 20230823182512.1073623-2-scott.murray@konsulko.com
State New
Headers show
Series kirkstone/rust-1.68 branch updates | expand

Commit Message

Scott Murray Aug. 23, 2023, 6:25 p.m. UTC
From: Alexander Kanavin <alex.kanavin@gmail.com>

cargo_do_compile runs only if the recipe is built using cargo
as the top level tool. Some recipes hide usage of cargo inside setuptools
(or autoconf) and use do_compile definitions specific to those,
and so the environment isn't properly set up.

This was exposed by latest versions of python3-cryptography.

(From OE-Core rev: a1946efdbec608d47f9e992c1b5cf3c671a204fc)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 9f4ff643a028d7f5670d80861f2ce19ca2d90faa)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 classes/cargo.bbclass        | 1 -
 classes/cargo_common.bbclass | 4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass
index 7a8cc1e..3ef0bbb 100644
--- a/classes/cargo.bbclass
+++ b/classes/cargo.bbclass
@@ -55,7 +55,6 @@  oe_cargo_build () {
 
 do_compile[progress] = "outof:\s+(\d+)/(\d+)"
 cargo_do_compile () {
-	oe_cargo_fix_env
 	oe_cargo_build
 }
 
diff --git a/classes/cargo_common.bbclass b/classes/cargo_common.bbclass
index 82ab25b..1ca0be4 100644
--- a/classes/cargo_common.bbclass
+++ b/classes/cargo_common.bbclass
@@ -149,6 +149,10 @@  python cargo_common_do_patch_paths() {
 }
 do_configure[postfuncs] += "cargo_common_do_patch_paths"
 
+do_compile:prepend () {
+        oe_cargo_fix_env
+}
+
 oe_cargo_fix_env () {
 	export CC="${RUST_TARGET_CC}"
 	export CXX="${RUST_TARGET_CXX}"