]> git.lizzy.rs Git - rust.git/blob - build_sysroot/build_sysroot.sh
Drop support for cloudabi targets
[rust.git] / build_sysroot / build_sysroot.sh
1 #!/bin/bash
2
3 # Requires the CHANNEL env var to be set to `debug` or `release.`
4
5 set -e
6
7 source ./config.sh
8
9 dir=$(pwd)
10
11 # Use rustc with cg_clif as hotpluggable backend instead of the custom cg_clif driver so that
12 # build scripts are still compiled using cg_llvm.
13 export RUSTC=$dir"/cg_clif_build_sysroot"
14 export RUSTFLAGS=$RUSTFLAGS" --clif"
15
16 cd $(dirname "$0")
17
18 # Cleanup for previous run
19 #     v Clean target dir except for build scripts and incremental cache
20 rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} 2>/dev/null || true
21
22 # We expect the target dir in the default location. Guard against the user changing it.
23 export CARGO_TARGET_DIR=target
24
25 # Build libs
26 export RUSTFLAGS="$RUSTFLAGS -Zforce-unstable-if-unmarked -Cpanic=abort"
27 if [[ "$1" != "--debug" ]]; then
28     sysroot_channel='release'
29     # FIXME Enable incremental again once rust-lang/rust#74946 is fixed
30     # FIXME Enable -Zmir-opt-level=2 again once it doesn't ice anymore
31     CARGO_INCREMENTAL=0 RUSTFLAGS="$RUSTFLAGS" cargo build --target $TARGET_TRIPLE --release
32 else
33     sysroot_channel='debug'
34     cargo build --target $TARGET_TRIPLE
35 fi
36
37 # Copy files to sysroot
38 mkdir -p $dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
39 cp -a target/$TARGET_TRIPLE/$sysroot_channel/deps/* $dir/sysroot/lib/rustlib/$TARGET_TRIPLE/lib/