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.
This commit is contained in:
Steven Walter
2016-08-30 16:49:50 -04:00
parent e2d09d0362
commit f6c7789c95
7 changed files with 20 additions and 40 deletions
+14 -9
View File
@@ -10,6 +10,7 @@ INHIBIT_DEFAULT_RUST_DEPS = "1"
# the bits we need explicitly.
DEPENDS += "rust-llvm-native"
DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc"
DEPENDS += "rust-native"
PROVIDES = "virtual/${TARGET_PREFIX}rust"
PN = "rust-cross-${TARGET_ARCH}"
@@ -31,14 +32,18 @@ BUILD_POST_LINK_ARGS_append = " -Wl,-rpath=../../lib"
# We need the same thing for the calls to the compiler when building the runtime crap
TARGET_CC_ARCH_append = " --sysroot=${STAGING_DIR_TARGET}"
# cross.bbclass is "helpful" and overrides our do_install. Tell it not to.
do_install () {
rust_do_install
do_configure () {
}
# using host-strip on target .so files generated by this recipie causes build errors.
# for now, disable stripping.
# A better (but more complex) approach would be to mimic gcc-runtime and build
# the target.so files in a seperate .bb file.
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
do_compile () {
}
do_install () {
mkdir -p ${D}${prefix}/${baselib}/rustlib
cp ${WORKDIR}/targets/${TARGET_ARCH}* ${D}${prefix}/${baselib}/rustlib
}
rust_cross_sysroot_preprocess() {
sysroot_stage_dir ${D}${prefix}/${baselib}/rustlib ${SYSROOT_DESTDIR}${prefix}/${baselib}/rustlib
}
SYSROOT_PREPROCESS_FUNCS += "rust_cross_sysroot_preprocess"