diff mbox series

[2/2] cargo.bbclass: allow to avoid appending PACKAGECONFIG_CONFARGS

Message ID 20250320165517.129442-2-martin.jansa@gmail.com
State New
Headers show
Series [1/2] cargo.bbclass: show PACKAGECONFIG_CONFARGS in bbnote | expand

Commit Message

Martin Jansa March 20, 2025, 4:55 p.m. UTC
From: Martin Jansa <martin.jansa@gmail.com>

* some recipes might be using PACKAGECONFIG_CONFARGS as:
  RUSTFLAGS:append = " ${PACKAGECONFIG_CONFARGS}"

  and then it's difficult to prevent the same args being used
  here for cargo call as well add intermedate variable
  CARGO_BUILD_FLAGS_PACKAGECONFIG
  which could be set to empty in the recipe to avoid that.

* alternatively we can just revert:
  https://git.openembedded.org/openembedded-core/commit/?id=16745b20452de60ae2474433cc1a2fb1ed9f6a64
  and let each recipe decide how it wants to use PACKAGECONFIG_CONFARGS

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
---
 meta/classes-recipe/cargo.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/cargo.bbclass b/meta/classes-recipe/cargo.bbclass
index 2dd28e95d3..63e550f5d0 100644
--- a/meta/classes-recipe/cargo.bbclass
+++ b/meta/classes-recipe/cargo.bbclass
@@ -43,12 +43,14 @@  CARGO_BUILD_FLAGS = "-v --frozen --target ${RUST_HOST_SYS} ${BUILD_MODE} --manif
 # change if CARGO_BUILD_FLAGS changes.
 BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
 CARGO_TARGET_SUBDIR = "${RUST_HOST_SYS}/${BUILD_DIR}"
+CARGO_BUILD_FLAGS_PACKAGECONFIG = ?= "${PACKAGECONFIG_CONFARGS}"
+CARGO_BUILD_FLAGS:append = " ${CARGO_BUILD_FLAGS_PACKAGECONFIG}"
 oe_cargo_build () {
 	export RUSTFLAGS="${RUSTFLAGS}"
 	bbnote "Using rust targets from ${RUST_TARGET_PATH}"
 	bbnote "cargo = $(which ${CARGO})"
-	bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} ${PACKAGECONFIG_CONFARGS} $@"
-	"${CARGO}" build ${CARGO_BUILD_FLAGS} ${PACKAGECONFIG_CONFARGS} "$@"
+	bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"
+	"${CARGO}" build ${CARGO_BUILD_FLAGS} "$@"
 }
 
 do_compile[progress] = "outof:\s+(\d+)/(\d+)"