From 634498e0aceb2945de230dad78745922b7644f0f Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 4 Nov 2016 16:38:12 -0500 Subject: [PATCH] rust: bump versions to 1.12.1 Redid how compiler-rt is built by using the Rust makefiles to build it instead of compiler-rt's build system. Rust itself deviated from using compiler-rt's build system and provided their own rules requiring the source tree to be configured to use them. --- recipes-devtools/rust/compiler-rt_1.12.1.bb | 24 ++++++++++ recipes-devtools/rust/libstd-rs_1.12.1.bb | 37 +++++++++++++++ recipes-devtools/rust/rust-cross_1.12.1.bb | 50 ++++++++++++++++++++ recipes-devtools/rust/rust-llvm.inc | 4 -- recipes-devtools/rust/rust-llvm_1.12.1.bb | 16 +++++++ recipes-devtools/rust/rust-source-1.12.1.inc | 3 ++ recipes-devtools/rust/rust.inc | 1 - recipes-devtools/rust/rust_1.12.1.bb | 28 +++++++++++ 8 files changed, 158 insertions(+), 5 deletions(-) create mode 100644 recipes-devtools/rust/compiler-rt_1.12.1.bb create mode 100644 recipes-devtools/rust/libstd-rs_1.12.1.bb create mode 100644 recipes-devtools/rust/rust-cross_1.12.1.bb create mode 100644 recipes-devtools/rust/rust-llvm_1.12.1.bb create mode 100644 recipes-devtools/rust/rust_1.12.1.bb diff --git a/recipes-devtools/rust/compiler-rt_1.12.1.bb b/recipes-devtools/rust/compiler-rt_1.12.1.bb new file mode 100644 index 0000000..878e59e --- /dev/null +++ b/recipes-devtools/rust/compiler-rt_1.12.1.bb @@ -0,0 +1,24 @@ +SUMMARY = "Rust compiler run-time" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://src/compiler-rt/LICENSE.TXT;md5=bf24bca27049b52e9738451aa55771d4" + +require rust.inc +require rust-source-${PV}.inc + +DEPENDS += "rust-llvm-native (=${PV})" + +S = "${WORKDIR}/rustc-${PV}" + +DISABLE_STATIC = "" +INHIBIT_DEFAULT_RUST_DEPS = "1" + +do_compile () { + oe_runmake ${TARGET_SYS}/rt/libcompiler-rt.a +} + +do_install () { + mkdir -p ${D}${libdir} + cp ${TARGET_SYS}/rt/libcompiler-rt.a ${D}${libdir}/libcompiler-rt.a +} diff --git a/recipes-devtools/rust/libstd-rs_1.12.1.bb b/recipes-devtools/rust/libstd-rs_1.12.1.bb new file mode 100644 index 0000000..821f3cc --- /dev/null +++ b/recipes-devtools/rust/libstd-rs_1.12.1.bb @@ -0,0 +1,37 @@ +SUMMARY = "Rust standard libaries" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "MIT | Apache-2.0" +LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" + +require rust-source-${PV}.inc + +S = "${WORKDIR}/rustc-${PV}" + +CARGO_INDEX_COMMIT = "6127fc24b0b6fe73fe4d339817fbf000b9a798a2" + +SRC_URI += "\ + crate://crates.io/gcc/0.3.27 \ + crate-index://crates.io/${CARGO_INDEX_COMMIT} \ +" + +DEPENDS += "compiler-rt (=${PV})" + +RUSTLIB_DEP = "" +inherit cargo + +# Needed so cargo can find libbacktrace +RUSTFLAGS += "-L ${STAGING_LIBDIR}" + +S = "${WORKDIR}/rustc-${PV}" + +do_compile_prepend () { + cd ${S}/src/rustc/std_shim + export CARGO_TARGET_DIR="${B}" + export RUSTC_BOOTSTRAP_KEY="${RS_KEY}" +} + +do_install () { + mkdir -p ${D}${rustlibdir} + cp ${B}/${TARGET_SYS}/release/deps/* ${D}${rustlibdir} +} diff --git a/recipes-devtools/rust/rust-cross_1.12.1.bb b/recipes-devtools/rust/rust-cross_1.12.1.bb new file mode 100644 index 0000000..67b6f3c --- /dev/null +++ b/recipes-devtools/rust/rust-cross_1.12.1.bb @@ -0,0 +1,50 @@ +require rust.inc +inherit cross +require rust-source-${PV}.inc + +# Otherwise we'll depend on what we provide +INHIBIT_DEFAULT_RUST_DEPS = "1" + +# Unlike native (which nicely maps it's DEPENDS) cross wipes them out completely. +# Generally, we (and cross in general) need the same things that native needs, +# so it might make sense to take it's mapping. For now, though, we just mention +# 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}" + +# In the cross compilation case, rustc doesn't seem to get the rpath quite +# right. It manages to include '../../lib/${TARGET_PREFIX}', but doesn't +# include the '../../lib' (ie: relative path from cross_bindir to normal +# libdir. As a result, we end up not being able to properly reference files in normal ${libdir}. +# Most of the time this happens to work fine as the systems libraries are +# subsituted, but sometimes a host system will lack a library, or the right +# version of a library (libtinfo was how I noticed this). +# +# FIXME: this should really be fixed in rust itself. +# FIXME: using hard-coded relative paths is wrong, we should ask bitbake for +# the relative path between 2 of it's vars. +HOST_POST_LINK_ARGS_append = " -Wl,-rpath=../../lib" +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}" + +do_configure () { +} + +do_compile () { +} + +do_install () { + mkdir -p ${D}${prefix}/${base_libdir_native}/rustlib + cp ${WORKDIR}/targets/${TARGET_SYS}.json ${D}${prefix}/${base_libdir_native}/rustlib +} + +rust_cross_sysroot_preprocess() { + sysroot_stage_dir ${D}${prefix}/${base_libdir_native}/rustlib ${SYSROOT_DESTDIR}${prefix}/${base_libdir_native}/rustlib +} +SYSROOT_PREPROCESS_FUNCS += "rust_cross_sysroot_preprocess" diff --git a/recipes-devtools/rust/rust-llvm.inc b/recipes-devtools/rust/rust-llvm.inc index fba8b22..2706ae3 100644 --- a/recipes-devtools/rust/rust-llvm.inc +++ b/recipes-devtools/rust/rust-llvm.inc @@ -1,10 +1,6 @@ SUMMARY = "LLVM compiler framework (packaged with rust)" LICENSE = "NCSA" -SRC_URI = "\ - https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ -" - S = "${WORKDIR}/rustc-${PV}/src/llvm" LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa" diff --git a/recipes-devtools/rust/rust-llvm_1.12.1.bb b/recipes-devtools/rust/rust-llvm_1.12.1.bb new file mode 100644 index 0000000..12dd8e9 --- /dev/null +++ b/recipes-devtools/rust/rust-llvm_1.12.1.bb @@ -0,0 +1,16 @@ +require rust-llvm.inc +require rust-source-${PV}.inc + +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=43fdaa303c1c5589ad60f4ffc6a0b9ce" + +do_install_prepend () { + # the install does a sed on this without installing the file + # we don't need it for anything + mkdir -p "${D}/usr/share/llvm/cmake" + touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake" +} + +do_install_append () { + # we don't need any of this stuff to build Rust + rm -rf "${D}/usr/lib/cmake" +} diff --git a/recipes-devtools/rust/rust-source-1.12.1.inc b/recipes-devtools/rust/rust-source-1.12.1.inc index b9b2a4c..add9509 100644 --- a/recipes-devtools/rust/rust-source-1.12.1.inc +++ b/recipes-devtools/rust/rust-source-1.12.1.inc @@ -13,6 +13,9 @@ RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RUST_BUILD_SYS}" SRC_URI[rust-snapshot.md5sum] = "b83d7a1a90c2d80bef97a518022948c8" SRC_URI[rust-snapshot.sha256sum] = "e9d27a72900da33c1bbd0e59dd42fd6414c6bcdfa33593fb7c7360068406394a" +SRC_URI += "\ + https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ + " SRC_URI[rust.md5sum] = "82db5a9cb9a051bf8ece2f5174cb273b" SRC_URI[rust.sha256sum] = "97913ae4cb255618aaacd1a534b11f343634b040b32656250d09d8d9ec02d3dc" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index d104d4a..21f44b1 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -7,7 +7,6 @@ LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" inherit rust SRC_URI = "\ - https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ https://static.rust-lang.org/dist/${RUST_SNAPSHOT}.tar.gz;name=rust-snapshot \ " diff --git a/recipes-devtools/rust/rust_1.12.1.bb b/recipes-devtools/rust/rust_1.12.1.bb new file mode 100644 index 0000000..d6269b1 --- /dev/null +++ b/recipes-devtools/rust/rust_1.12.1.bb @@ -0,0 +1,28 @@ +inherit rust-installer +require rust.inc +require rust-source-${PV}.inc + +# the configure script always requires cmake so despite +# rust not needing this (only rust-llvm needs it) we must +# have it for the configure script to succeed. +DEPENDS += "cmake-native" + +SRC_URI += " \ + file://rust-${PV}/0001-Target-add-default-target.json-path-libdir-rust-targ.patch \ + file://rust-${PV}/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ + file://rust-${PV}/0003-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ + file://rust-${PV}/0005-std-thread_local-workaround-for-NULL-__dso_handle.patch \ + file://rust-${PV}/0006-mk-install-use-disable-rewrite-paths.patch \ + file://rust-${PV}/0007-Allow-overriding-crate_hash-with-C-crate_hash.patch \ + file://rust-${PV}/0008-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ + file://rust-installer-${PV}/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ + " + +DEPENDS += "rust-llvm (=${PV})" + +# Otherwise we'll depend on what we provide +INHIBIT_DEFAULT_RUST_DEPS_class-native = "1" +# We don't need to depend on gcc-native because yocto assumes it exists +PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust" + +BBCLASSEXTEND = "native"