51 Commits

Author SHA1 Message Date
Martin 'JaMa' Jansa
bf6705fb7f Convert to new override syntax (#357)
* Convert to new override syntax

This is the result of automated script (0.9.0) conversion:

oe-core/scripts/contrib/convert-overrides.py .

converting the metadata to use ":" as the override character instead of "_".

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

* Manually fix the conversion

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

* layer.conf: Update layer compatibility with only dunfell and newer.

Add honister to mark the layers as compatible with honister now that it uses
the new override syntax.

Drop zeus and older which are missing a support for newer override syntax which
was backported only to 1.46 branch (used by dunfell) and newer, e.g.:
https://git.openembedded.org/bitbake/commit/?h=1.46&id=c5418eae56cc50dbae7951c055434a0c456c53a4

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

* CI: use YOCTO_BRANCH instead of yocto-${YOCTO_VERSION} for poky checkout

* using latest revision in branch is often better than sticking to
  some point releases

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

* CI: switch to hardknott branch

* gatesgarth is already EOL, better to use something supported

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2021-08-05 17:37:51 -04:00
Steven Walter
53cbdb566d cargo.bbclass: support cargo's progress indicator
Recent versions of cargo support always showing the progress indicator.
By default the progress indicator is hidden if the output is not a tty.
For bitbake builds, the output is redirected to a file and not a tty.
However, if we tell cargo to always show the progress indicator, bitbake
can parse it and will show the user how the rust build is progressing.
2021-04-02 16:21:43 -04:00
Joel Winarske
81a4d79c06 install example executables 2021-02-23 20:03:59 -08:00
Benjamin Isbarn
4e96013677 Factor in CARGO_SRC_DIR when setting MANIFEST_PATH. 2021-02-15 14:36:46 +01:00
Johan Anderholm
0025cebb12 Fix *-native cargo builds
Normally all *-native packages needs to depend on cargo-native in order
to be able to use cargo. When building cargo-native however, this is not
available and we use a snapshot.

Fixes #302.
2021-02-08 16:04:39 +01:00
Khem Raj
1936904ad3 cargo: Mark the cargo-native dependency specific to target
Fixes dependency loop

These are usually caused by circular dependencies and any circular dependency chains found will be printed below. Increase the debug level to see a list of unbuildable tasks.

Identifying dependency loops (this may take a short while)...

ERROR:
Dependency loop #1 found:
  Task virtual:native:/mnt/b/yoe/master/sources/meta-rust/recipes-devtools/cargo/cargo_1.47.0.bb:do_compile (dependent Tasks ['cargo_1.47.0.bb:do_configure'])
  Task virtual:native:/mnt/b/yoe/master/sources/meta-rust/recipes-devtools/cargo/cargo_1.47.0.bb:do_install (dependent Tasks ['cargo_1.47.0.bb:do_compile'])
  Task virtual:native:/mnt/b/yoe/master/sources/meta-rust/recipes-devtools/cargo/cargo_1.47.0.bb:do_populate_sysroot (dependent Tasks ['cargo_1.47.0.bb:do_install'])
  Task virtual:native:/mnt/b/yoe/master/sources/meta-rust/recipes-devtools/cargo/cargo_1.47.0.bb:do_prepare_recipe_sysroot (dependent Tasks ['cargo_1.47.0.bb:do_populate_sysroot', 'openssl_1.1.1i.bb:do_populate_sysroot', 'curl_7.74.0.bb:do_populate_sysroot', 'rust_1.47.0.bb:do_populate_sysroot', 'zlib_1.2.11.bb:do_populate_sysroot', 'ca-certificates_20210119.bb:do_populate_sysroot', 'libssh2_1.9.0.bb:do_populate_sysroot', 'cargo_1.47.0.bb:do_fetch'])
  Task virtual:native:/mnt/b/yoe/master/sources/meta-rust/recipes-devtools/cargo/cargo_1.47.0.bb:do_configure (dependent Tasks ['cargo_1.47.0.bb:do_prepare_recipe_sysroot', 'cargo_1.47.0.bb:do_patch', 'cargo_1.47.0.bb:do_rust_create_wrappers', 'cargo_1.47.0.bb:do_cargo_setup_snapshot'])

ERROR: Command execution failed: 1

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2021-01-29 10:18:30 -08:00
Johan Anderholm
a673320995 cargo: Enable build separation
Place generated artifacts in the directory suggested by bitbake (${B})
instead of directly in the source directory. This has multiple
advantages such as the ability to share source directory between
multiple machine types without risking cross contamination.
2021-01-08 16:47:40 +01:00
Johan Anderholm
de42179513 cargo.bbclass: Make release mode optional
Use DEBUG_BUILD to determine if cargo should build with --release or
not. Set DEBUG_BUILD="1" in a recipe to build it without --release.
2018-07-06 19:30:36 +02:00
Tyler Hall
c83864ce19 rust-bin: get RUST_TARGET_PATH from rust-common
Since commit 06a138a ("rust: drop custom target finding patch"), rustc
is no longer self-sufficient in finding its target specifications. Any
usage of rustc needs RUST_TARGET_PATH set in the environment.

Move the declaration to rust-common.bbclass and add the export to
rust-bin where rustc is invoked.
2017-11-02 16:41:58 -04:00
Will Newton
7f80e6d68b cargo.bbclass: Avoid bashism in cargo_do_install
The double square brackets are an extension to POSIX so are not
available in some shells. Use a case statement instead.
2017-10-03 22:28:24 -05:00
Doug Goldstein
e31d252eb0 cargo{_common}.bbclass: abstract out parts for rustbuild
rustbuild is a cargo based way to build Rust but all of our helper bits
in cargo.bbclass would create a chicken/egg issue with dependencies
since we pull down pre-built binaries and use those for boot strapping.
2017-09-29 09:49:27 -05:00
Doug Goldstein
0cccf8b25c cargo.bbclass: include CXXFLAGS for builds
If g++ is invoked when building native bits with cargo we need to
include CXXFLAGS.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2017-09-29 09:49:25 -05:00
Doug Goldstein
c55fb403f8 cargo.bbclass: improve debug note showing paths
There was a bbnote that showed the path to the rustc and cargo binaries
being used but this was not necessarily correct since it didn't use the
exact variables used.
2017-06-21 11:52:28 -05:00
Doug Goldstein
06a138a4a4 rust: drop custom target finding patch
We shouldn't need to patch rustc to find the target but instead pass the
full path to the target spec. This should solve #138.
2017-06-21 11:52:28 -05:00
Johan Anderholm
e814ede9d9 rust-common: provide C++ wrappers
For similar reasons to the C and linker wrappers, using rustbuild
requires a C++ wrapper to ensure that the right flags that Yocto needs
are passed to the underlying compiler.
2017-06-21 11:52:28 -05:00
Doug Goldstein
339cc787cc drop the old fetch behavior for pre Cargo 0.13.0
This behavior is flakey and doesn't work from Cargo 0.13.0 and newer
which aren't part of this repo anymore.
2016-12-07 08:52:03 -06:00
Doug Goldstein
d364837120 merge rust-vars and rust-triples to rust-common
Merge two bbclasses that were included in the same places so merge it
into one common file.
2016-12-05 10:55:14 -06:00
Doug Goldstein
846454281e classes/cargo: implement directory source redirection
Reworked the source redirection to use directory source redirection like
I've done for Gentoo. This allows us to specify all crate dependencies
in the bitbake SRC_URI and have Yocto fetch them down using our crate
fetcher and then Cargo will build without reaching out to the network.
2016-12-03 00:36:04 -06:00
Doug Goldstein
f87bb05414 classes/cargo: provide linker for BUILD_SYS
Ensure that we have a linker for the BUILD_SYS (Yocto) / HOST (Rust).
2016-11-30 20:57:05 -06:00
Doug Goldstein
1bf70b13a7 classes/cargo: revert to utilizing compiler/linker wrappers
Don't supply the linker arguments via rustflags and then mangle with the
RUSTFLAGS environment variable. This is also a parial reversion of
4e1bda643e and 5afc0cc471. These changes are reverted since it assumed
people would build with cargo and not directly with rustc. ref #116.
2016-11-30 20:57:04 -06:00
Doug Goldstein
20ac8ea888 classes/cargo: fix cargo target for linker override
We don't use the native Rust triples but instead use the Yocto triples
so we need to provide this override properly. This typo was introduced
in 5afc0cc471.
2016-11-30 20:57:04 -06:00
Doug Goldstein
a387a5fe8f classes/cargo: fix up target CFLAGS being passed to Rust
Firstly, HOST_CC_ARCH and TOOLCHAIN_OPTIONS are included in CC so them
being passed in are redundant now (due to the wrapper). The RUST_CFLAGS
variable doesn't need to be exported since its not actually used by
rustc/gcc-rs/cargo. Since its redundant and doesn't need to be exported,
remove it and simplify.
2016-11-30 20:57:04 -06:00
Doug Goldstein
689dfe8004 classes/cargo: fix up build CFLAGS being passed to Rust
Firstly, BUILD_CC_ARCH is included in BUILD_CC (hence why we actually
need a BUILD_CC wrapper because it produces the space), so its
redundant (now with the wrapper using BUILD_CC). The RUST_BUILD_CFLAGS
variable doesn't need to be exported since its not actually used by
rustc/gcc-rs/cargo. Since its redundant and doesn't need to be
exported remove it and simplify.
2016-11-30 20:57:04 -06:00
Doug Goldstein
864fe95722 classes: create proper compiler and linker wrappers
Rust builds (custom build.rs and gcc-rs users) expect to have the
compiler and the linker available to them as a single command with no
white space trailing. Yocto unfortunately does not conform to that. The
build compiler and linker almost always have a trailing space due to
how the variables are composed and the target compiler and linker are
almost always more than a single command. Then if you throw ccache into
the mix you'll get another command. As a result to handle all these
cases properly there need to be wrappers created. This change creates
wrappers for both build and target and both the linker and compiler.
This likely fixes #76.
2016-11-30 20:57:04 -06:00
Doug Goldstein
5afc0cc471 cargo.bbclass: ensure extra RUSTFLAGS are properly passed
The RUSTFLAGS env var overrides the rustflags specified in the cargo
config so we need to take anything passed in the environment variable
and put it in the config.
2016-11-23 14:15:17 -06:00
Doug Goldstein
4e1bda643e cargo.bbclass: supply linker and link-args via rustflags
Supply the linker and the linker args via rustflags which should make it
not necessary to specify them via target JSONs. We explicitly cannot use
the RUSTFLAGS environment variable do to the way cargo parses arguments
and passes them to rustc.
2016-11-23 13:59:05 -06:00
Doug Goldstein
c98312fd1d cargo.bbclass: don't export variables 2016-11-23 11:42:00 -06:00
Steven Walter
fbf59ed6a0 cargo.bbclass: replace with what was cargo_util.bbclass
The old cargo.bbclass had no users in meta-rust and had lots of
problems (not least of which was lots of duplicated lines with
cargo_util.bbclass).  Delete the old cargo.bbclass and replace it
entirely wiht cargo_util
2016-09-05 18:40:42 -04:00
Tyler Hall
310cc353a1 Put crate_hash and rpath in RUSTFLAGS for Cargo
RUSTFLAGS is used by Cargo and always passed to the compiler. Put our
non-standard crate_hash argument there because it is required for
reproducible builds.

Add the rpath option to avoid having to patch Cargo.toml for this and
remove the function that does so.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
2016-07-11 15:15:04 -04:00
Tyler Hall
5b451ec4af classes/cargo: don't override PATCHTOOL
The referenced issue is fixed upstream

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
2016-07-11 15:15:00 -04:00
Derek Straka
78e51cd7f4 Address parse errors while using getVar to calculate dependency information 2016-02-18 13:24:43 -05:00
Cody P Schafer
0ed55291b6 cargo: relocate config files to avoid clobber 2016-01-26 17:11:25 -05:00
Cody P Schafer
6bcb69d4c0 cargo.bbclass: CARGO_TARGET_DIR gained a special meaning in cargo, rename to CARGO_TARGET_SUBDIR 2015-06-29 11:20:09 -04:00
Cody P Schafer
457ded34de cargo: supply a CARGO_HOME variable to keep cargo contained inside bitbake control 2015-05-26 12:06:27 -04:00
Cody P Schafer
eaa153d122 bump patches & versions 2015-02-27 09:35:59 -05:00
Cody P Schafer
c1cbe59991 cargo.bbclass: complain if nothing to install is found 2014-12-05 14:58:42 -05:00
Cody P Schafer
439790a703 cargo.bbclass: factor out more of the target binary path 2014-12-05 14:57:05 -05:00
Cody P Schafer
95b80b7bfe Exporting cargo breaks building cargo 2014-12-05 14:38:33 -05:00
Cody P Schafer
1e0047383e refactor cargo.bbclass for easier use when we are not directly driving cargo 2014-12-05 14:08:50 -05:00
Cody P Schafer
e07cb2e6f2 cargo: more env vars for gcc-rs 2014-12-03 18:38:12 -05:00
Cody P Schafer
41824cb27a attempting to use a new cargo 2014-12-03 17:55:13 -05:00
Cody P Schafer
1d2b7f4f11 new cargo, rust tweaks, etc 2014-12-03 14:03:38 -05:00
Cody P Schafer
a66a513686 cargo: proper CC/CFLAGS handling with HOST_* patch 2014-12-03 02:44:06 -05:00
Cody P Schafer
3cf2b9e42c Rework ASSUME_PROVIDED and notes 2014-12-02 16:40:45 -05:00
Cody P Schafer
75deda4847 Tweak inhibit, move comment, update rustc ln 2014-12-02 16:33:00 -05:00
Cody P Schafer
db7d1d0cd9 cargo: disable cargo dep by default 2014-12-02 14:07:19 -05:00
Cody P Schafer
c42a9f51dd re-add older rust, disable newer by default, allow cargo dep to be disabled 2014-12-02 14:00:50 -05:00
Cody P Schafer
e7917112b6 cargo-native builds 2014-12-01 11:06:00 -05:00
Cody P Schafer
0035ec3172 tweak rust 2014-11-26 11:26:53 -05:00
Cody P Schafer
d91fa8700a cargo hacks 2014-11-25 15:23:17 -05:00