Commit Graph

140 Commits

Author SHA1 Message Date
Doug Goldstein
0b6b45fbca break the triples logic into its own class
This is so we can use the Rust triples in Cargo builds and other places
in addition to the Rust build.
2016-11-21 16:22:38 -06:00
Doug Goldstein
7645b9b331 RUSTC_ARCHFLAGS: build for the proper system triple
Change to build for the machine we are building for when compiling rust
code and not the compiler itself. See #109.
2016-11-21 14:55:54 -06:00
Doug Goldstein
a97f66224a drop files supporting shared source 2016-11-01 15:37:47 -05: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
Steven Walter
e87b2d43b0 libstd-rs: use cargo_util_do_compile 2016-09-05 18:38:38 -04:00
Steven Walter
08ac2819f8 lib/crate.py: update magic hash for new cargo 2016-09-03 10:35:52 -04:00
Steven Walter
f89057c0af lib/crate.py: additionally populate a local registry
The local registry is a more future-proof way to prevent cargo from
accessing the network during the build.  Unfortunately, this is only
used during the build of cargo-native for now.  The snapshot used while
building cargo-native supports using a local registry ("source
replacement") however the version of cargo supported by rust 1.10 does
not.

Until we can build a new-enough version of cargo that supports
source-replacement, we'll have to patch cargo directly to prevent it
from accessing the network.  Once we do have a new-enough cargo, we can
stop populating cargo_home/registry and only create cargo_registry.
2016-09-03 10:35:52 -04:00
Steven Walter
11f0c95763 cargo_util.bbclass: fix for native users
Building native packages with cargo means with need a native rust
compiler
2016-09-03 10:35:52 -04:00
Steven Walter
c6ea2fe285 cargo_util.bbclass: support EXTRA_OECARGO_PATHS
With this we can convert the cargo-native recipe over to using
cargo_util instead of cargo.bbclass
2016-09-03 10:35:52 -04:00
Steven Walter
f6c7789c95 rust-cross: don't actually build a compiler
Instead of building a full compiler, we can use rust-native to
cross-compile.  All we need is a cross-compiled standard library, which
libstd-rs builds, and a compiler spec file.  rust-cross is now just used
to generate the json spec file for cross-compiling, which is naturally
much faster.
2016-09-02 12:01:28 -04:00
Tyler Hall
e3140137e5 cargo_util: pass RUSTFLAGS to cargo build 2016-08-30 18:08:57 -04:00
Tyler Hall
d320edc05f cargo_util: install libraries
The final output of a crate may be a library along with one or more
executables. Install the libraries as well.
2016-08-30 18:08:57 -04:00
Tyler Hall
00429e037b cargo_util: make rustlibdir available
This is needed for install and potentially link paths.
2016-08-30 18:08:57 -04:00
Tyler Hall
da71abbef1 cargo_util: prefix DEPENDS_append with space 2016-08-30 18:08:57 -04:00
Cody P Schafer
487205331b rustc: fix use of shared source for new poky/oe-core which wipes ${S}
The oe-core/poky change 'base.bbclass wipe ${S} before unpacking
source' (poky: a56fb90dc3805494eeaf04c60538425e8d52efc5, oe-core:
eccae514b71394ffaed8fc45dea7942152a334a1) wipes ${S} in do_unpack prior
to unpacking. This breaks our shared source as we set ${S} to the shared
location, and don't actually unpack anything (the result is we try to
build rustc without any source code, which fails predictably)

Avoid this by clearing do_unpack[cleandirs].

At the same time take pieces of gcc-shared-source.inc and note how & why
we differ from how gcc operates.

This is a bit of a hack, and only happens to work because we know the
exact method that do_unpack uses to clear ${S}, and using python()
happens to get called at the "right time".
2016-08-10 00:58:09 -04:00
Derek Straka
1f42bdc679 cargo_util: ensure directory exists prior to the file touch
Signed-off-by: Derek Straka <derek@asterius.io>
2016-08-02 10:45:23 -04:00
Doug Goldstein
d947c2e40e cargo_util: simplified cargo bbclass for crates
The existing cargo class attempts to jump through a few hoops for
settings that are not necessarily with newer versions of cargo.
2016-07-12 16:33:02 -05:00
Doug Goldstein
85471f88e5 bitbake: add crate fetcher
This adds a handler for crate:// URLs and rewrites them to crates.io
https endpoint and handles properly unpacking the crate. This fixes #24.
2016-07-12 16:33:02 -05: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
Tyler Hall
27ff9aea20 Move rust-bin fixups to rust.bbclass
This post-processing will need to be shared between rust-bin and
cargo-based recipes.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
2016-07-11 15:14:57 -04:00
Tyler Hall
1f17e68d1e Move basic variables from rust-bin to rust class
rust-bin.bbclass now only contains what is necessary to build crates
using the rust compiler directly and rust.bbclass contains information
shared between rust-bin and cargo.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
2016-07-11 15:14:53 -04:00
Steven Walter
a74985c341 rust-bin.bbclass: allow to opt-out of prefer-dynamic
prefer-dynamic makes sense in many cases, but we needn't force recipes
to use it all the time.
2016-05-05 21:56:19 -04:00
Derek Straka
94daa39193 Remove the '--disable-static' in the EXTRA_OECONF for all rust-like recipes 2016-02-19 10:34:00 -05:00
Derek Straka
a4d6b55448 Allow the fetch to complete before attempting to patch
Signed-off-by: Derek Straka <derek@asterius.io>
2016-02-18 17:23:36 -05: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
ce1881d08c rust: use a shared source location for all the packages needing the rustc source tree 2016-02-04 12:40:22 -05:00
Steven Walter
3a832dd439 rust: force crate hash to use bitbake input hash
This should eliminate the problems that have been seen when bitbake
rebuilds part of the rust stack (due to missing sstate) and ends up
getting hash mismatches.  Unlike rust's internally generated hash, ours
is guaranteed to be stable.
2016-02-03 11:30:56 -05:00
Tyler Hall
483334f02b rust: aarch64 support 2016-02-02 11:40:25 -05:00
Tyler Hall
aaaeaeed3f rustlib: libdir may be different between build and host
With multilib, we may want to install under lib64 but the rust libraries
get published in the build sysroot under the libdir for the build
machine which is usually just lib. Support these being different.
2016-02-02 11:40:25 -05:00
Wes Lindauer
45d77b849f rust-bin.bbclass: Add empty do_configure
This prevents rust recipes that are missing clean rules from failing
when they are rebuilt.
2016-02-01 16:36:52 -05:00
Steven Walter
ebe7fb0d8f rust-bin.bbclass: look for RUNPATH instead of RPATH
Poky 1.7 uses RPATH is now RUNPATH, so update our grep string appropriately.

Additionally, bitbake is having trouble with the automatic RDEPENDS on
rustlib.  Make it explicit for now.
2016-02-01 16:36:52 -05:00
Dan Dedrick
63cf611e65 rust-bin.bbclass: update path to cross output
poky 1.7 changes where it publishes cross output to so this recipe
needs to follow that. Unfortunately this path is defined in
cross.bbclass and we can't inherit that since we aren't cross.
2016-02-01 16:36:52 -05:00
Tyler Hall
302cca7529 rust-bin.bbclass: suffix rust libraries with -rs
Rust library names may have sonames that overlap with C/C++ libraries.
This causes bitbake to not be able to create the correct automatic
RDEPENDS between packages. The result is that dependencies may not get
automatically installed.

Add -rs to the file name and soname. The crate name remains the same,
and rust is not dependent on the file name to look up the crate inside
the library.
2016-02-01 16:36:52 -05:00
Tyler Hall
232d100c09 Add rand crate 2016-02-01 20:53:51 +00:00
Cody P Schafer
0ed55291b6 cargo: relocate config files to avoid clobber 2016-01-26 17:11:25 -05:00
Tyler Hall
8c83519133 rust-bin/rustlib: install with executable permission
Necessary for binaries and required to appease OE's automatic library
RDEPENDS.
2015-07-17 12:52:36 -04:00
Tyler Hall
06f6aeaa79 rust-bin: set soname of shared objects
Poky will fail to automatically create RDEPENDS on shared objects
lacking a SONAME in the ELF.
2015-07-17 12:52:36 -04:00
Tyler Hall
837000f68a rust-bin: common code for building libs
Libraries that overlap with the standard library must have explicit
extern declarations. Without something like pkg-config where the
libraries can publish this info, it's easiest to just hard-code the list
of troublesome libraries.
2015-07-17 12:52:36 -04:00
Tyler Hall
8a6f084c66 rust-bin: prefer-dynamic
We control static/dynamic by only making one or the other available.
Apparently the default of prefer static causes duplicate symbols for the
standard library.
2015-07-17 12:52:36 -04:00
Tyler Hall
a91af9bbae Add rust-bin class
This provides more defaults that aren't required for compiling with
rustc, but standardize the output for inclusion in a distro.

Things like
- Where to install libraries
- Stripping rustc note sections
- Optimization by default
2015-07-17 12:52:36 -04: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
5a09bd48bb rust-installer is naughty 2015-03-02 01:36:20 -05:00
Cody P Schafer
eaa153d122 bump patches & versions 2015-02-27 09:35:59 -05:00
Cody P Schafer
70d0957e6d rust: switch to using _class-cross and _class-native variables to stop abusing the BBCLASSEXTEND system 2015-02-12 14:37:39 -05:00
Cody P Schafer
f6a6687733 USE_LOCAL_RUST tweaks 2014-12-30 16:00:12 -05:00
Cody P Schafer
de23af86c2 update readme to reflect current reality 2014-12-16 13:56:38 -05:00
Cody P Schafer
c3b58fc4d6 internal-rust-native: correct inhibit 2014-12-16 13:43:25 -05:00
Cody P Schafer
23b9ac934e rust: use a different INHIBIT_DEFAULT*_DEPS to avoid hardcoding real DEFAULT_DEPS 2014-12-15 15:58:40 -05:00