5 # Cleanup for previous run
6 # v Clean target dir except for build scripts and incremental cache
7 rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} || true
8 rm Cargo.lock 2>/dev/null || true
9 rm -r sysroot 2>/dev/null || true
11 # FIXME find a better way to get the target triple
13 if [[ "$unamestr" == 'Linux' ]]; then
14 TARGET_TRIPLE='x86_64-unknown-linux-gnu'
15 elif [[ "$unamestr" == 'Darwin' ]]; then
16 TARGET_TRIPLE='x86_64-apple-darwin'
23 mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
24 export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked"
25 if [[ "$1" == "--release" ]]; then
27 RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
30 cargo build --target $TARGET_TRIPLE
33 # Copy files to sysroot
34 cp target/$TARGET_TRIPLE/$channel/deps/*.rlib sysroot/lib/rustlib/$TARGET_TRIPLE/lib/