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} 2>/dev/null || true
15 rm Cargo.lock test_target/Cargo.lock 2>/dev/null || true
16 rm -r sysroot/ 2>/dev/null || true
19 export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked -Cpanic=abort"
20 if [[ "$1" == "--release" ]]; then
21 sysroot_channel='release'
22 RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
24 sysroot_channel='debug'
25 cargo build --target $TARGET_TRIPLE --features compiler_builtins/c
28 # Copy files to sysroot
29 mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
30 cp -r target/$TARGET_TRIPLE/$sysroot_channel/deps/* sysroot/lib/rustlib/$TARGET_TRIPLE/lib/