Commit Graph

140 Commits

Author SHA1 Message Date
Angus Lees
ea97549161 Avoid extra sh process from shell wrapper
`exec` from shell wrapper to avoid persistent sh process
2020-03-15 12:23:52 +11:00
Johan Anderholm
2c4a666b68 Set cainfo to certificates in sysroot-native
This solves SSL CA cert errors.

When a sstate-cache is used sometimes the certificates are not available
at the compile time path anymore. The required certificates are
available in sysroot-native and can be selected with the cainfo
configuration.
2019-08-06 12:16:10 +00:00
Johan Anderholm
2f323e1e9e Update to rust and cargo version 1.36.0 2019-08-02 09:35:31 +00:00
Johan Anderholm
68046d42b8 Correct proxy variable 2019-02-19 14:52:16 +00:00
Johan Anderholm
fa0aebc070 Disable http2 in cargo
Since 1.31.0 cargo requires curl to support http2. Enabling http2 in
curl results in a dependency loop. This commit disables the use of
multiplexing and http2.
2019-02-15 12:34:37 +00:00
Johan Anderholm
9ecc36acb5 Set proxy in cargo if available
This is needed for cargo to use proxies set by bitbake. It is important
for devtooled builds which does not use vendored sources.
2019-01-13 10:45:01 +01:00
Johan Anderholm
496b75fa1f Update to rust version 1.31.1
Also make use of the sources vendored in the rustc package instead of
letting bitbake download the sources.
2019-01-03 17:31:46 +01:00
Hongxu Jia
3b9251e732 cargo_common.bbclass: fix bashism
While /bin/sh -> dash, var-EXTERNALSRC didn't work

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
2018-11-20 22:10:18 +08:00
Mike Yagley
c7fc7986c2 Fix TARGET_CXXFLAGS in cargo_common 2018-11-12 13:44:02 -08:00
Tyler Hall
060e033df9 rust-common: fix remap-path-prefix for 1.26
Before the flag was stabilized, it required two arguments of the form
"from=<from_path>" and "to=<to_path>" respectively. The stabilized
version uses one argument of the form "<from_path>=<to_path>".

Unfortunately the old format is still parsed successfully, but results
in attempting to replace the literal paths "from" and "to".

https://github.com/rust-lang/rust/issues/41555#issuecomment-320951103
2018-07-22 15:48:46 -04:00
Johan Anderholm
8e6c6271fc Handle env and llvm-target for musl
Further changes needed for musl to work.
env needs to be set to "musl" for unwinding work properly.
Also the llvm target should end with "-musl" and not "-gnu".
2018-07-06 19:34:33 +02: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
Johan Anderholm
03d8fb472c Bump to Rust 1.26.2
Remove old versions because they are not compatible with the changes in
rust-common.bbclass
2018-06-16 09:50:47 +02:00
Steven Walter
48e2a7db25 cargo_common.bbclass: improve operation with devtool
Because devtool inhibits all the normal bitbake fetchers, we can't mask crates.io.
Use EXTERNALSRC to detect if we're being built with devtool, and only mask
crates.io if we're not.

Fixes #195
2018-05-19 10:16:55 -04:00
Tyler Hall
52ea673a8f rust: allow configuring panic-strategy
This defaults to "unwind" if not set, so this alone has no effect.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
2018-01-23 17:54:15 -05:00
Tyler Hall
e5230147f6 Remap source paths
This is needed for reproducible builds.
2017-11-03 12:41:51 -04:00
Steven Walter
c60b799c11 Allow native variants of rust recipes to build 2017-11-02 16:41:58 -04:00
Tyler Hall
463622c0c6 rust-bin: use linker to set rpath
Patchelf should be reserved for when the ELF cannot be generated
correctly in the first place. This is not the case here because we have
control over the linker flags. The limitation is that -C link-args can
only be specified once, so consolidate the generation of link-args. Also
introduce some new intermediate variables in link-args generation for
customization.

Patchelf was running only in ${PKGD} because patching the ELF in ${D}
would cause objcopy to fail when splitting the debug sections. This is
not a problem when setting it correctly in the linker. The benefit is
that the rpath is correct in the sysroot as well.

This also switches the rpaths to be relative so that they work in both
the sysroot and the target in the same way.

Signed-off-by: Tyler Hall <tyler.hall@lexmark.com>
Signed-off-by: Steven Walter <swalter@lexmark.com>
2017-11-02 16:41:58 -04:00
Tyler Hall
172a226259 rust-bin: use linker wrapper
Commit 864fe95 ("classes: create proper compiler and linker wrappers")
introduced wrapper scripts for the OE toolchain. Specifying the sysroot
manually ceased to function in rust-bin, so use the wrapper where rustc
is called directly.

This should be more reliable than trying to repeat what OE puts in the
$CC variable.
2017-11-02 16:41:58 -04: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
Johan Anderholm
a4fe235317 Switch to rustbuild
Switch the build process to using Rust's new build system called
rustbuild. At the same time stop using jemalloc on all platforms and
switch to the system allocator since that was simplier to do.
2017-09-29 09:49:33 -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
Steven Walter
1eb86e935c rust-bin: fix recent breakage
The crate_hash flag is no longer accepted on rust 1.14.  Additionally,
due to the use of wrapper scripts by cargo, we were no longer able to
link correctly due to some link flags getting dropped.  Fix that as well
2017-02-02 10:02:11 -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
Derek Straka
52c0f97ff6 getVar will expand by default, so the 'True' option is no longer required
Signed-off-by: Derek Straka <derek@asterius.io>
2016-12-06 16:08:41 -05:00
Doug Goldstein
1f18869377 workaround bug in the -C crate_hash option
The -C crate_hash option does not work if multiple versions of the same
crate are being linked into a binary. This can happen if different
dependencies depend on different versions of the same crate. The -C
crate_hash argument causes all versions of a given crate to have the
same crate hash which in turn causes the compiler to select the wrong
one internally and crash. This works around issue #126 for Cargo builds
but does not fix the underlying cause.
2016-12-06 11:08:46 -06:00
Doug Goldstein
0340c31a42 fix bad engrish 2016-12-05 10:55:14 -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
43c139f131 rust: remove --disable-static only for rust
Only remove --disable-static from OECONF for things built from the rust
source and not things inheriting rust.
2016-12-05 10:55:14 -06:00
Doug Goldstein
6083dff0b6 drop rust-installer.bbclass
This is only necessary for installations of rust so move the actual
functional bits into the do_install() phase of rust.
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
168396820d classes/rust-triples: document the triples
Provide documentation behind what the triples mean for Yocto and Rust
since they have different meanings of BUILD, TARGET, and HOST. Namely
Rust uses HOST when Yocto means BUILD. In our current supported cases
HOST and TARGET from Yocto mean the same thing.
2016-11-30 20:57:01 -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
Doug Goldstein
0827bc626b rust/rust-bin: move bits to rust-bin
Bits that are only used by the rust-bin bbclass should get moved there.
They aren't used by any recipe that includes the rust bbclass.
2016-11-23 11:25:57 -06:00
Doug Goldstein
f748246cae remove commented out bits 2016-11-22 11:53:43 -06:00
Doug Goldstein
957ede76f8 convert to real Rust triples properly
This should fix conversion to real Rust triples for musl targets, for
i686 targets and possibly others.
2016-11-21 16:22:41 -06:00
Doug Goldstein
5d60f12957 rust-triples: simplify vendor gathering
We don't need to look up the vendor since it will always be unknown.
2016-11-21 16:22:41 -06:00