3 # Requires the CHANNEL env var to be set to `debug` or `release.`
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"/bin/cg_clif_build_sysroot"
14 export RUSTFLAGS
=$RUSTFLAGS" --clif"
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
22 # We expect the target dir in the default location. Guard against the user changing it.
23 export CARGO_TARGET_DIR
=target
26 export RUSTFLAGS
="$RUSTFLAGS -Zforce-unstable-if-unmarked -Cpanic=abort"
27 export __CARGO_DEFAULT_LIB_METADATA
="cg_clif"
28 if [[ "$1" != "--debug" ]]; then
29 sysroot_channel
='release'
30 # FIXME Enable incremental again once rust-lang/rust#74946 is fixed
31 CARGO_INCREMENTAL
=0 RUSTFLAGS
="$RUSTFLAGS -Zmir-opt-level=3" cargo build
--target "$TARGET_TRIPLE" --release
33 sysroot_channel
='debug'
34 cargo build
--target "$TARGET_TRIPLE"
37 # Copy files to sysroot
38 ln "target/$TARGET_TRIPLE/$sysroot_channel/deps/"* "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"
39 rm "$dir/lib/rustlib/$TARGET_TRIPLE/lib/"*.
{rmeta
,d
}