From 3d0fab8860a6a89deff24661fe0cd0e180daeac4 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Sat, 27 Aug 2016 13:31:55 -0400 Subject: [PATCH] Rework support for downloading the stage0 rustc Rust does something fairly different than in 1.7. Instead of just expecting the tarball to exist, it either expects an already extracted and ready toolchain, or else it does everything itself. To work with that, we'll always pass --use-local-rust to ./configure so that bootstrap.py doesn't try to download anything. We'll either download and setup a snapshot ourselves, or use the system rust, based on PACKAGECONFIG[local-rust] as before --- .../rust/rust-snapshot-2015-12-18.inc | 14 ----------- .../rust/rust-snapshot-2016-05-24.inc | 13 +++++++++++ recipes-devtools/rust/rust.inc | 23 +++++++++---------- 3 files changed, 24 insertions(+), 26 deletions(-) delete mode 100644 recipes-devtools/rust/rust-snapshot-2015-12-18.inc create mode 100644 recipes-devtools/rust/rust-snapshot-2016-05-24.inc diff --git a/recipes-devtools/rust/rust-snapshot-2015-12-18.inc b/recipes-devtools/rust/rust-snapshot-2015-12-18.inc deleted file mode 100644 index a970791..0000000 --- a/recipes-devtools/rust/rust-snapshot-2015-12-18.inc +++ /dev/null @@ -1,14 +0,0 @@ -## snapshot info taken from rust/src/snapshots.txt -## TODO: find a way to add additional SRC_URIs based on the contents of an -## earlier SRC_URI. -RS_DATE = "2015-12-18" -RS_SRCHASH = "3391630" -# linux-x86_64 -RS_ARCH = "linux-x86_64" -RS_HASH = "97e2a5eb8904962df8596e95d6e5d9b574d73bf4" - -RUST_SNAPSHOT = "rust-stage0-${RS_DATE}-${RS_SRCHASH}-${RS_ARCH}-${RS_HASH}.tar.bz2" - -SRC_URI[rust-snapshot.md5sum] = "5c29eb06c8b6ce6ff52f544f31efabe1" -SRC_URI[rust-snapshot.sha256sum] = "a8dc5203673ce43f47316beb02ee0c427edb7bbde2ab5fc662a06b52db2950e7" - diff --git a/recipes-devtools/rust/rust-snapshot-2016-05-24.inc b/recipes-devtools/rust/rust-snapshot-2016-05-24.inc new file mode 100644 index 0000000..765daeb --- /dev/null +++ b/recipes-devtools/rust/rust-snapshot-2016-05-24.inc @@ -0,0 +1,13 @@ +## snapshot info taken from rust/src/stage0.txt +## TODO: find a way to add additional SRC_URIs based on the contents of an +## earlier SRC_URI. +RS_DATE = "2016-05-24" +RS_VERSION = "1.9.0" +RS_ARCH = "x86_64-unknown-linux-gnu" + +RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RS_ARCH}.tar.gz" +RUST_SNAPSHOT_URI = "https://static.rust-lang.org/dist/${RS_DATE}/${RUST_SNAPSHOT}" + +SRC_URI[rust-snapshot.md5sum] = "f1cf6d2fe15e4be18a08259f1540a4ae" +SRC_URI[rust-snapshot.sha256sum] = "d0704d10237c66c3efafa6f7e5570c59a1d3fe5c6d99487540f90ebb37cd84c4" + diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 54727f1..8cdaeab 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -2,7 +2,7 @@ inherit rust inherit rust-installer require rust-shared-source.inc -require rust-snapshot-2015-12-18.inc +require rust-snapshot-2016-05-24.inc LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" @@ -25,7 +25,9 @@ PACKAGECONFIG ??= "" # to have rust-cross built using rust-native. PACKAGECONFIG[local-rust] = "" -SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'local-rust', '', 'https://static.rust-lang.org/stage0-snapshots/${RUST_SNAPSHOT};unpack=0;name=rust-snapshot', d)}" +FETCH_STAGE0 = "${@bb.utils.contains('PACKAGECONFIG', 'local-rust', 'false', 'true', d)}" + +SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'local-rust', '', '${RUST_SNAPSHOT_URI};unpack=0;name=rust-snapshot', d)}" # We generate local targets, and need to be able to locate them export RUST_TARGET_PATH="${WORKDIR}/targets/" @@ -389,15 +391,16 @@ do_configure () { # where we're reinstalling the compiler. May want to try for a real # path based on bitbake vars # Also will be wrong when relative libdir and/or bindir aren't 'bin' and 'lib'. - local_maybe_enable=disable local_rust_root=/not/set/do/not/use - if which rustc >/dev/null 2>&1; then + if ${FETCH_STAGE0}; then + mkdir -p dl + tar -xf ${WORKDIR}/${RUST_SNAPSHOT} -C dl + ./dl/rustc-${RS_VERSION}-${RS_ARCH}/install.sh --prefix=$PWD/dl + local_rust_root="$PWD/dl" + elif which rustc >/dev/null 2>&1; then local_rustc=$(which rustc) if [ -n "$local_rustc" ]; then local_rust_root=$(dirname $(dirname $local_rustc)) - if [ -e "$local_rust_root/bin/rustc" ]; then - local_maybe_enable=enable - fi fi fi @@ -426,7 +429,7 @@ do_configure () { "--libdir=${libdir}" \ "--bindir=${bindir}" \ "--platform-cfg=${WORKDIR}/mk-cfg/" \ - ${@bb.utils.contains('PACKAGECONFIG', 'local-rust', '--$local_maybe_enable-local-rust --local-rust-root=$local_rust_root', '--local-rust-root=/not/a/dir', d)} \ + "--enable-local-rust --local-rust-root=$local_rust_root" \ ${EXTRA_OECONF} } @@ -446,10 +449,6 @@ rust_runmake () { } do_compile () { - if ${@bb.utils.contains('PACKAGECONFIG', 'local-rust', 'false', 'true', d)}; then - mkdir -p dl - cp -f ${WORKDIR}/${RUST_SNAPSHOT} dl - fi rust_runmake }