X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=build_sysroot%2Fbuild_sysroot.sh;h=eba15c0dd4308ee2eb8218d3455917554c29eac3;hb=e4cc56d7609e8130677694917c6c9af28cf94a97;hp=165d67a8146cc64e719fdf803fc6d55c2a69f40c;hpb=8691b8b8b6d88a51ee4783a8c704f052db479738;p=rust.git diff --git a/build_sysroot/build_sysroot.sh b/build_sysroot/build_sysroot.sh index 165d67a8146..eba15c0dd43 100755 --- a/build_sysroot/build_sysroot.sh +++ b/build_sysroot/build_sysroot.sh @@ -3,28 +3,37 @@ # Requires the CHANNEL env var to be set to `debug` or `release.` set -e -cd $(dirname "$0") -pushd ../ >/dev/null source ./config.sh -popd >/dev/null + +dir=$(pwd) + +# Use rustc with cg_clif as hotpluggable backend instead of the custom cg_clif driver so that +# build scripts are still compiled using cg_llvm. +export RUSTC=$dir"/cg_clif_build_sysroot" +export RUSTFLAGS=$RUSTFLAGS" --clif" + +cd $(dirname "$0") # Cleanup for previous run # v Clean target dir except for build scripts and incremental cache -rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} || true -rm Cargo.lock 2>/dev/null || true -rm -r sysroot 2>/dev/null || true +rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} 2>/dev/null || true + +# We expect the target dir in the default location. Guard against the user changing it. +export CARGO_TARGET_DIR=target # Build libs -export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked" -if [[ "$1" == "--release" ]]; then +export RUSTFLAGS="$RUSTFLAGS -Zforce-unstable-if-unmarked -Cpanic=abort" +if [[ "$1" != "--debug" ]]; then sysroot_channel='release' - RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release + # FIXME Enable incremental again once rust-lang/rust#74946 is fixed + # FIXME Enable -Zmir-opt-level=2 again once it doesn't ice anymore + CARGO_INCREMENTAL=0 RUSTFLAGS="$RUSTFLAGS" cargo build --target $TARGET_TRIPLE --release else sysroot_channel='debug' cargo build --target $TARGET_TRIPLE fi # Copy files to sysroot -mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/ -cp target/$TARGET_TRIPLE/$sysroot_channel/deps/*.rlib sysroot/lib/rustlib/$TARGET_TRIPLE/lib/ +mkdir -p $dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/ +cp -a target/$TARGET_TRIPLE/$sysroot_channel/deps/* $dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/