3 # Requires the CHANNEL env var to be set to `debug` or `release.`
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_src/src/{libcore,libtest}/target/$TARGET_TRIPLE/$sysroot_channel/ || true
16 rm Cargo.lock test_target/Cargo.lock 2>/dev/null || true
17 rm -r sysroot 2>/dev/null || true
20 export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked"
21 if [[ "$1" == "--release" ]]; then
22 sysroot_channel='release'
23 RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
25 sysroot_channel='debug'
26 cargo build --target $TARGET_TRIPLE
29 # Copy files to sysroot
30 mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
31 cp target/$TARGET_TRIPLE/$sysroot_channel/deps/*.rlib sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
33 if [[ "$1" == "--release" ]]; then
35 RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release --manifest-path ./sysroot_src/src/libtest/Cargo.toml
38 cargo build --target $TARGET_TRIPLE --manifest-path ./sysroot_src/src/libtest/Cargo.toml
41 # Copy files to sysroot
42 cp sysroot_src/src/libtest/target/$TARGET_TRIPLE/$sysroot_channel/deps/*.rlib sysroot/lib/rustlib/$TARGET_TRIPLE/lib/