diff mbox series

cargo: pass PACKAGECONFIG_CONFARGS to cargo build

Message ID 20250319210905.1896983-1-jarsoper@gmail.com
State Accepted, archived
Commit 16745b20452de60ae2474433cc1a2fb1ed9f6a64
Headers show
Series cargo: pass PACKAGECONFIG_CONFARGS to cargo build | expand

Commit Message

Jean-Pierre Geslin March 19, 2025, 9:09 p.m. UTC
From: Jean-Pierre Geslin <jarsoper@gmail.com>

In order to allow rust packages to define PACKAGECONFIG options, append
the contents of PACKAGECONFIG_CONFARGS to the build command.
This patch was already submitted by Bartosz Golaszewski on older
version but was never merged. It will be really usefull for Rust recipes.

Signed-off-by: Jean-Pierre Geslin <jarsoper@gmail.com>
---
 meta/classes-recipe/cargo.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Jansa March 20, 2025, 4:33 p.m. UTC | #1
The bbnote above wasn't updated to show the whole cargo call, which is
a bit confusing e.g. now I got:

NOTE: cargo build -v --frozen --target aarch64-webos-linux-gnu
--release --manifest-path=.../git//Cargo.toml
error: unexpected argument '--cfg' found

Usage: cargo build --verbose... --frozen --target [<TRIPLE>] --release
--manifest-path <PATH>

and was wondering where --cfg came from. Will send update for bbnote shortly.

On Wed, Mar 19, 2025 at 10:09 PM Jean-Pierre Geslin via
lists.openembedded.org <jarsoper=gmail.com@lists.openembedded.org>
wrote:
>
> From: Jean-Pierre Geslin <jarsoper@gmail.com>
>
> In order to allow rust packages to define PACKAGECONFIG options, append
> the contents of PACKAGECONFIG_CONFARGS to the build command.
> This patch was already submitted by Bartosz Golaszewski on older
> version but was never merged. It will be really usefull for Rust recipes.
>
> Signed-off-by: Jean-Pierre Geslin <jarsoper@gmail.com>
> ---
>  meta/classes-recipe/cargo.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/cargo.bbclass b/meta/classes-recipe/cargo.bbclass
> index 76a39668c7..461d100dd9 100644
> --- a/meta/classes-recipe/cargo.bbclass
> +++ b/meta/classes-recipe/cargo.bbclass
> @@ -48,7 +48,7 @@ oe_cargo_build () {
>         bbnote "Using rust targets from ${RUST_TARGET_PATH}"
>         bbnote "cargo = $(which ${CARGO})"
>         bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"
> -       "${CARGO}" build ${CARGO_BUILD_FLAGS} "$@"
> +       "${CARGO}" build ${CARGO_BUILD_FLAGS} ${PACKAGECONFIG_CONFARGS} "$@"
>  }
>
>  do_compile[progress] = "outof:\s+(\d+)/(\d+)"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#213355): https://lists.openembedded.org/g/openembedded-core/message/213355
> Mute This Topic: https://lists.openembedded.org/mt/111798103/3617156
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/cargo.bbclass b/meta/classes-recipe/cargo.bbclass
index 76a39668c7..461d100dd9 100644
--- a/meta/classes-recipe/cargo.bbclass
+++ b/meta/classes-recipe/cargo.bbclass
@@ -48,7 +48,7 @@  oe_cargo_build () {
 	bbnote "Using rust targets from ${RUST_TARGET_PATH}"
 	bbnote "cargo = $(which ${CARGO})"
 	bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"
-	"${CARGO}" build ${CARGO_BUILD_FLAGS} "$@"
+	"${CARGO}" build ${CARGO_BUILD_FLAGS} ${PACKAGECONFIG_CONFARGS} "$@"
 }
 
 do_compile[progress] = "outof:\s+(\d+)/(\d+)"