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>
This commit is contained in:
Tyler Hall
2016-07-11 15:15:04 -04:00
parent 5b451ec4af
commit 310cc353a1
2 changed files with 3 additions and 13 deletions
+1 -12
View File
@@ -42,18 +42,6 @@ cargo_do_configure () {
echo "]" >>../.cargo/config
}
rust_cargo_patch () {
# FIXME: if there is already an entry for this target, in an existing
# cargo/config, this won't work.
cd "${S}"
cat >>Cargo.toml <<EOF
[profile.dev]
rpath = true
[profile.release]
rpath = true
EOF
}
# All the rust & cargo ecosystem assume that CC, LD, etc are a path to a single
# command. Fixup the ones we give it so that is the case.
# XXX: this is hard coded based on meta/conf/bitbake.conf
@@ -70,6 +58,7 @@ export CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release"
# change if CARGO_BUILD_FLAGS changes.
export CARGO_TARGET_SUBDIR="${HOST_SYS}/release"
oe_cargo_build () {
export RUSTFLAGS="${RUSTFLAGS}"
which cargo
which rustc
bbnote ${CARGO} build ${CARGO_BUILD_FLAGS} "$@"
+2 -1
View File
@@ -1,7 +1,8 @@
RUSTC = "rustc"
# FIXME: --sysroot might be needed
RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} -C rpath -C crate_hash=${BB_TASKHASH}"
RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH}"
RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} ${RUSTFLAGS}"
RUSTLIB_DEP ?= "rustlib"
def rust_base_dep(d):