diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index 614baf9..f38a519 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -12,7 +12,7 @@ export CARGO_HOME = "${WORKDIR}/cargo_home" BASEDEPENDS_append = " cargo-native" # 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 B = "${S}" diff --git a/classes/rust-vars.bbclass b/classes/rust-vars.bbclass index c987d91..a3acc44 100644 --- a/classes/rust-vars.bbclass +++ b/classes/rust-vars.bbclass @@ -2,3 +2,7 @@ export rustlibdir = "${libdir}/rust" FILES_${PN} += "${rustlibdir}/*.so" FILES_${PN}-dev += "${rustlibdir}/*.rlib" FILES_${PN}-dbg += "${rustlibdir}/.debug" + +RUSTLIB = "-L ${STAGING_LIBDIR}/rust" +RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH} ${RUSTLIB}" +RUSTLIB_DEP ?= "libstd-rs" diff --git a/classes/rust.bbclass b/classes/rust.bbclass index 132a402..15299b2 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -2,11 +2,8 @@ inherit rust-vars RUSTC = "rustc" -# FIXME: --sysroot might be needed -RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH}" RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} ${RUSTFLAGS}" -RUSTLIB_DEP ?= "rustlib" def rust_base_dep(d): # Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to # use rust instead of gcc diff --git a/recipes-devtools/rust/rust-cross.bb b/recipes-devtools/rust/rust-cross.bb index d4324f1..70ce2b4 100644 --- a/recipes-devtools/rust/rust-cross.bb +++ b/recipes-devtools/rust/rust-cross.bb @@ -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" diff --git a/recipes-devtools/rust/rust.bb b/recipes-devtools/rust/rust.bb index 93ceab2..ab61226 100644 --- a/recipes-devtools/rust/rust.bb +++ b/recipes-devtools/rust/rust.bb @@ -1,3 +1,4 @@ +inherit rust-installer require rust.inc DEPENDS += "rust-llvm" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 3c7d7fa..253f676 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -1,6 +1,5 @@ # ex: sts=4 et sw=4 ts=8 inherit rust -inherit rust-installer require rust-shared-source.inc require rust-snapshot-2016-05-24.inc diff --git a/recipes-devtools/rust/rustlib.bb b/recipes-devtools/rust/rustlib.bb deleted file mode 100644 index 9d371f7..0000000 --- a/recipes-devtools/rust/rustlib.bb +++ /dev/null @@ -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"