]> git.lizzy.rs Git - rust.git/blob - build_sysroot/build_sysroot.sh
Rustup to rustc 1.45.0-nightly (46e85b432 2020-05-24)
[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 cd $(dirname "$0")
7
8 pushd ../ >/dev/null
9 source ./config.sh
10 popd >/dev/null
11
12 # Cleanup for previous run
13 #     v Clean target dir except for build scripts and incremental cache
14 rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} || true
15 rm -r sysroot/ 2>/dev/null || true
16
17 # Build libs
18 export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked"
19 if [[ "$1" == "--release" ]]; then
20     sysroot_channel='release'
21     RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
22 else
23     sysroot_channel='debug'
24     cargo build --target $TARGET_TRIPLE
25 fi
26
27 # Copy files to sysroot
28 mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
29 cp -r target/$TARGET_TRIPLE/$sysroot_channel/deps/* sysroot/lib/rustlib/$TARGET_TRIPLE/lib/