rust: cleanup for things patched in, make local-rust more reliable
This commit is contained in:
@@ -6,7 +6,6 @@ RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} -C rpath"
|
|||||||
def rust_base_dep(d):
|
def rust_base_dep(d):
|
||||||
# Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to
|
# Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to
|
||||||
# use rust instead of gcc
|
# use rust instead of gcc
|
||||||
|
|
||||||
deps = ""
|
deps = ""
|
||||||
if not d.getVar('INHIBIT_DEFAULT_DEPS'):
|
if not d.getVar('INHIBIT_DEFAULT_DEPS'):
|
||||||
if (d.getVar('HOST_SYS', True) != d.getVar('BUILD_SYS', True)):
|
if (d.getVar('HOST_SYS', True) != d.getVar('BUILD_SYS', True)):
|
||||||
@@ -57,17 +56,17 @@ RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}"
|
|||||||
# -L${STAGING_BASE_LIBDIR_NATIVE} \
|
# -L${STAGING_BASE_LIBDIR_NATIVE} \
|
||||||
#"
|
#"
|
||||||
|
|
||||||
|
RUST_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}:${STAGING_BASE_LIBDIR_NATIVE}"
|
||||||
|
|
||||||
# FIXME: the 'rustlib' element of this is to workaround rustc forgetting the libdir it was built with.
|
## Note: the 'rustlib' element of this was a workaround rustc forgetting the
|
||||||
RUST_PATH_NATIVE="${STAGING_LIBDIR_NATIVE}:${STAGING_BASE_LIBDIR_NATIVE}:${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib"
|
## libdir it was built with. It now remembers so this should be unneeded
|
||||||
|
#RUST_PATH_NATIVE .= ":${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib"
|
||||||
|
|
||||||
# FIXME: set based on whether we are native vs cross vs buildsdk, etc
|
# FIXME: set based on whether we are native vs cross vs buildsdk, etc
|
||||||
export RUST_PATH ??= "${RUST_PATH_NATIVE}"
|
export RUST_PATH ??= "${RUST_PATH_NATIVE}"
|
||||||
|
|
||||||
# FIXME: set this to something (sysroot?) for each of target,native,cross
|
## This is builtin to rustc with the value "$libdir/rust/targets"
|
||||||
# For now, tuned so target builds are correct. -native happens to work because
|
# RUST_TARGET_PATH = "foo:bar"
|
||||||
# the target specs happen to match.
|
|
||||||
export RUST_TARGET_PATH = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rust/targets:${STAGING_LIBDIR_NATIVE}/rust/targets"
|
|
||||||
|
|
||||||
CARGO = "cargo"
|
CARGO = "cargo"
|
||||||
|
|
||||||
|
|||||||
+12
-4
@@ -15,6 +15,7 @@ LIC_FILES_CHKSUM ="\
|
|||||||
# For -native, we set this to "0" by default.
|
# For -native, we set this to "0" by default.
|
||||||
USE_LOCAL_RUST = "1"
|
USE_LOCAL_RUST = "1"
|
||||||
|
|
||||||
|
# We generate local targets, and need to be able to locate them
|
||||||
export RUST_TARGET_PATH="${WORKDIR}/targets/"
|
export RUST_TARGET_PATH="${WORKDIR}/targets/"
|
||||||
|
|
||||||
## arm-unknown-linux-gnueabihf
|
## arm-unknown-linux-gnueabihf
|
||||||
@@ -226,10 +227,17 @@ do_configure () {
|
|||||||
unset CXXFLAGS
|
unset CXXFLAGS
|
||||||
unset CPPFLAGS
|
unset CPPFLAGS
|
||||||
|
|
||||||
# rpath is required otherwise rustc fails to resolve symbols
|
if [ "${USE_LOCAL_RUST}" -eq 1 ]; then
|
||||||
|
# FIXME: this path to rustc may not be quite right in the case
|
||||||
|
# where we're reinstalling the compiler. May want to try for a real
|
||||||
|
# path based on bitbake vars
|
||||||
|
my_conf="--enable-local-rust --local-rust-root=$(dirname $(which rustc))"
|
||||||
|
else
|
||||||
|
my_conf=""
|
||||||
|
fi
|
||||||
|
|
||||||
# TODO: consider setting --local-rust-root for -cross and -target
|
# - rpath is required otherwise rustc fails to resolve symbols
|
||||||
# builds.
|
# - submodule management is done by bitbake's fetching
|
||||||
${S}/configure \
|
${S}/configure \
|
||||||
"--enable-rpath" \
|
"--enable-rpath" \
|
||||||
"--disable-verify-install" \
|
"--disable-verify-install" \
|
||||||
@@ -245,7 +253,7 @@ do_configure () {
|
|||||||
"--libdir=${libdir}" \
|
"--libdir=${libdir}" \
|
||||||
"--bindir=${bindir}" \
|
"--bindir=${bindir}" \
|
||||||
"--disable-manage-submodules" \
|
"--disable-manage-submodules" \
|
||||||
${@base_conditional('USE_LOCAL_RUST', '1', '--enable-local-rust', '', d)} \
|
${my_conf} \
|
||||||
${EXTRA_OECONF}
|
${EXTRA_OECONF}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user