Commit Graph

11 Commits

Author SHA1 Message Date
Martin Jansa
41dbf14659 cargo.bbclass: show PACKAGECONFIG_CONFARGS in bbnote
* PACKAGECONFIG_CONFARGS was added in:
  https://git.openembedded.org/openembedded-core/commit/?id=16745b20452de60ae2474433cc1a2fb1ed9f6a64
  but it wasn't added in bbnote above which might lead to confusing errors like I got now:

  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.

* it was from recipe where we already use:
  RUSTFLAGS:append = " ${PACKAGECONFIG_CONFARGS}"
  it will be difficult to use PACKAGECONFIG for RUSTFLAGS and prevent
  them to be used here for cargo as well, what about the recipes which
  need them to explicitly append them to CARGO_BUILD_FLAGS ?

(From OE-Core rev: 38d953b2ffd4e0cee9e77f97988e44be105023c6)

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-25 21:20:41 +00:00
Jean-Pierre Geslin
7a2b9acef2 cargo: pass PACKAGECONFIG_CONFARGS to cargo build
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.

(From OE-Core rev: 16745b20452de60ae2474433cc1a2fb1ed9f6a64)

Signed-off-by: Jean-Pierre Geslin <jarsoper@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-20 11:29:04 +00:00
Richard Purdie
c2da016918 meta/meta-selftest: Fix variable assignment whitespace
Recipes are much more readable with whitespace around the assignment operators.
Fix various assignments in OE-Core to show this is definitely the preferred
formatting.

(From OE-Core rev: 30ea609d3357fb3de911f2f6a5e6856c151b976a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-01 13:42:34 +00:00
Alexander Kanavin
003ea0b573 cargo.bbclass: do not install libraries by default
'cargo install' only installs executables and examples into the system,
and we should follow that. Libraries are vendored into
build trees from the crate registry and then baked directly into executables.

Neverthless, there's now a condition variable, so individual recipes can
opt into installing libraries if there's a use case for it.

(From OE-Core rev: 68990af9630da16fc75362ca09046ceab71a1106)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-12-05 17:07:10 +00:00
Alex Kiernan
43df94f7af cargo: Move CARGO_MANIFEST_PATH/CARGO_SRC_DIR to cargo_common
cargo_common_do_configure uses CARGO_MANIFEST_PATH (which depends on
CARGO_SRC_DIR), but their definition was in cargo.bbclass.

(From OE-Core rev: 740374a13ad5359767b421666decf50c158ea0df)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-09 19:17:11 +00:00
Alex Kiernan
a8f959a8d3 cargo: Rename MANIFEST_PATH -> CARGO_MANIFEST_PATH
This variable is a piece of recipe configurable interface, scope it with
the class name to make that clear.

(From OE-Core rev: 0101de25832fbed3d08cd522512784133c628cad)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-08 16:58:34 +00:00
Frederic Martinsons
d4c14304c9 cargo.bbclass: Use --frozen flag for cargo operations
It supersed the --offline flag and guarantee that Cargo.lock
file will not be modified during the build.

(From OE-Core rev: 9ff9e6523bd7eb6cdc854adcbd031085c536e0e6)

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-08-09 13:22:00 +01:00
Alexander Kanavin
fa8b714d7a cargo.bbclass: set up cargo environment in common do_compile
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: 9f4ff643a028d7f5670d80861f2ce19ca2d90faa)

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>
2023-06-27 16:23:40 +01:00
Frederic Martinsons
0b937af08c cargo.bbclass: use offline mode for building
There should not be any network access during the build step so
specify this explicitely to cargo.
This will allow better error message, e.g:

| Caused by:
|  can't checkout from 'ssh://git@.../fmartinsons/zbus-git-dep-test.git': you are in  the offline mode (--offline)

Instead of

|   Updating git repository `ssh://git@.../fmartinsons/zbus-git-dep-test.git`
| warning: spurious network error (2 tries remaining): failed to resolve address for gitlab.com: Temporary failure in name resolution;class=Net (12)

(From OE-Core rev: 8e9ec03c73e8c09e223d6f6cce297df363991350)

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-03-16 17:49:38 +00:00
Martin Jansa
4065f0d840 cargo.bbclass: avoid calling which ${RUSTC} with undefined ${RUSTC}
* RUSTC is normally defined in rust.bbclass, but rust-target-config doesn't
  inherit rust.bbclass and RUSTC is then undefined when calling 'which'
  in oe_cargo_build

* causes which help text ending in log.do_compile, e.g.:

| DEBUG: Executing shell function do_compile
| NOTE: Using rust targets from /OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/openssl-sys/0.9.77-r0/rust-targets/
| NOTE: cargo = /OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/openssl-sys/0.9.77-r0/recipe-sysroot-native/usr/bin/cargo
| Usage: which [options] [--] COMMAND [...]
| Write the full path of COMMAND(s) to standard output.
|
|   --version, -[vV] Print version and exit successfully.
|   --help,          Print this help and exit successfully.
|   --skip-dot       Skip directories in PATH that start with a dot.
|   --skip-tilde     Skip directories in PATH that start with a tilde.
|   --show-dot       Don't expand a dot to current directory in output.
|   --show-tilde     Output a tilde for HOME directory for non-root.
|   --tty-only       Stop processing options on the right if not on tty.
|   --all, -a        Print all matches in PATH, not just the first
|   --read-alias, -i Read list of aliases from stdin.
|   --skip-alias     Ignore option --read-alias; don't read stdin.
|   --read-functions Read shell functions from stdin.
|   --skip-functions Ignore option --read-functions; don't read stdin.
|
| Recommended use is to write the output of (alias; declare -f) to standard
| input, so that which can show aliases and shell functions. See which(1) for
| examples.
|
| If the options --read-alias and/or --read-functions are specified then the
| output can be a full alias or function definition, optionally followed by
| the full path of each command used inside of those.
|
| Report bugs to <which-bugs@gnu.org>.
| NOTE: rustc =

(From OE-Core rev: 0068e82f02354729b953e622889f96ca52468d6c)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-11-07 14:32:42 +00:00
Richard Purdie
fd1517e2b5 classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take
advantage of new bitbake functionality to check class scope/usage.

(From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12 15:27:17 +01:00