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:
@@ -12,7 +12,7 @@ export CARGO_HOME = "${WORKDIR}/cargo_home"
|
|||||||
BASEDEPENDS_append = " cargo-native"
|
BASEDEPENDS_append = " cargo-native"
|
||||||
|
|
||||||
# Ensure we get the right rust variant
|
# Ensure we get the right rust variant
|
||||||
DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust"
|
DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
|
||||||
|
|
||||||
# Cargo only supports in-tree builds at the moment
|
# Cargo only supports in-tree builds at the moment
|
||||||
B = "${S}"
|
B = "${S}"
|
||||||
|
|||||||
@@ -2,3 +2,7 @@ export rustlibdir = "${libdir}/rust"
|
|||||||
FILES_${PN} += "${rustlibdir}/*.so"
|
FILES_${PN} += "${rustlibdir}/*.so"
|
||||||
FILES_${PN}-dev += "${rustlibdir}/*.rlib"
|
FILES_${PN}-dev += "${rustlibdir}/*.rlib"
|
||||||
FILES_${PN}-dbg += "${rustlibdir}/.debug"
|
FILES_${PN}-dbg += "${rustlibdir}/.debug"
|
||||||
|
|
||||||
|
RUSTLIB = "-L ${STAGING_LIBDIR}/rust"
|
||||||
|
RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH} ${RUSTLIB}"
|
||||||
|
RUSTLIB_DEP ?= "libstd-rs"
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ inherit rust-vars
|
|||||||
|
|
||||||
RUSTC = "rustc"
|
RUSTC = "rustc"
|
||||||
|
|
||||||
# FIXME: --sysroot might be needed
|
|
||||||
RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH}"
|
|
||||||
RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} ${RUSTFLAGS}"
|
RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} ${RUSTFLAGS}"
|
||||||
|
|
||||||
RUSTLIB_DEP ?= "rustlib"
|
|
||||||
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
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ INHIBIT_DEFAULT_RUST_DEPS = "1"
|
|||||||
# the bits we need explicitly.
|
# the bits we need explicitly.
|
||||||
DEPENDS += "rust-llvm-native"
|
DEPENDS += "rust-llvm-native"
|
||||||
DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc"
|
DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc"
|
||||||
|
DEPENDS += "rust-native"
|
||||||
|
|
||||||
PROVIDES = "virtual/${TARGET_PREFIX}rust"
|
PROVIDES = "virtual/${TARGET_PREFIX}rust"
|
||||||
PN = "rust-cross-${TARGET_ARCH}"
|
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
|
# We need the same thing for the calls to the compiler when building the runtime crap
|
||||||
TARGET_CC_ARCH_append = " --sysroot=${STAGING_DIR_TARGET}"
|
TARGET_CC_ARCH_append = " --sysroot=${STAGING_DIR_TARGET}"
|
||||||
|
|
||||||
# cross.bbclass is "helpful" and overrides our do_install. Tell it not to.
|
do_configure () {
|
||||||
do_install () {
|
|
||||||
rust_do_install
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# using host-strip on target .so files generated by this recipie causes build errors.
|
do_compile () {
|
||||||
# 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.
|
do_install () {
|
||||||
INHIBIT_PACKAGE_STRIP = "1"
|
mkdir -p ${D}${prefix}/${baselib}/rustlib
|
||||||
INHIBIT_SYSROOT_STRIP = "1"
|
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"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
inherit rust-installer
|
||||||
require rust.inc
|
require rust.inc
|
||||||
|
|
||||||
DEPENDS += "rust-llvm"
|
DEPENDS += "rust-llvm"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
# ex: sts=4 et sw=4 ts=8
|
# ex: sts=4 et sw=4 ts=8
|
||||||
inherit rust
|
inherit rust
|
||||||
inherit rust-installer
|
|
||||||
require rust-shared-source.inc
|
require rust-shared-source.inc
|
||||||
require rust-snapshot-2016-05-24.inc
|
require rust-snapshot-2016-05-24.inc
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
SUMMARY = "Rust runtime libaries"
|
|
||||||
HOMEPAGE = "http://www.rust-lang.org"
|
|
||||||
SECTION = "devel"
|
|
||||||
LICENSE = "MIT | Apache-2.0"
|
|
||||||
|
|
||||||
inherit rust-bin
|
|
||||||
|
|
||||||
DEPENDS += "virtual/${TARGET_PREFIX}rust"
|
|
||||||
RUSTLIB_DEP = ""
|
|
||||||
|
|
||||||
do_install () {
|
|
||||||
for f in ${STAGING_DIR_NATIVE}/${rustlib_src}/*; do
|
|
||||||
echo Installing $f
|
|
||||||
install -D -m 755 $f ${D}/${rustlib}/$(basename $f)
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# This has no license file
|
|
||||||
python do_qa_configure() {
|
|
||||||
return True
|
|
||||||
}
|
|
||||||
|
|
||||||
FILES_${PN} += "${rustlib}/*.so"
|
|
||||||
FILES_${PN}-dev += "${rustlib}/*.rlib"
|
|
||||||
FILES_${PN}-staticdev += "${rustlib}/*.a"
|
|
||||||
FILES_${PN}-dbg += "${rustlib}/.debug"
|
|
||||||
Reference in New Issue
Block a user