5 # Cleanup for previous run
7 rm Cargo.lock 2>/dev/null || true
8 rm -r sysroot 2>/dev/null || true
10 # FIXME find a better way to get the target triple
12 if [[ "$unamestr" == 'Linux' ]]; then
13 TARGET_TRIPLE='x86_64-unknown-linux-gnu'
14 elif [[ "$unamestr" == 'Darwin' ]]; then
15 TARGET_TRIPLE='x86_64-apple-darwin'
22 export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked --sysroot ../"
23 if [[ "$1" == "--release" ]]; then
25 RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
28 cargo build --target $TARGET_TRIPLE
31 # Copy files to sysroot
32 mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
33 cp target/$TARGET_TRIPLE/$channel/deps/*.rlib sysroot/lib/rustlib/$TARGET_TRIPLE/lib/