about summary refs log tree commit diff
path: root/build_sysroot/build_sysroot.sh
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2018-12-14 13:58:33 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2018-12-15 16:18:03 +0100
commit1e5c6bc5b86c4ff61ef3de63a9748789d5b369b0 (patch)
tree3b534c853745f053ca9557e3da48922b91466c20 /build_sysroot/build_sysroot.sh
parent9351f1d0c7763ee8564e096eaa3ed607f089e5db (diff)
downloadrust-1e5c6bc5b86c4ff61ef3de63a9748789d5b369b0.tar.gz
rust-1e5c6bc5b86c4ff61ef3de63a9748789d5b369b0.zip
Stop using xargo for building the sysroot
It is currently broken. (see https://github.com/japaric/xargo/issues/227)

This makes it easier to for example patch whole crates away.
Diffstat (limited to 'build_sysroot/build_sysroot.sh')
-rwxr-xr-xbuild_sysroot/build_sysroot.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/build_sysroot/build_sysroot.sh b/build_sysroot/build_sysroot.sh
new file mode 100755
index 00000000000..38608e02163
--- /dev/null
+++ b/build_sysroot/build_sysroot.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+set -e
+cd $(dirname "$0")
+
+# Cleanup for previous run
+cargo clean
+rm Cargo.lock 2>/dev/null || true
+rm -r sysroot 2>/dev/null || true
+
+# FIXME find a better way to get the target triple
+unamestr=`uname`
+if [[ "$unamestr" == 'Linux' ]]; then
+   TARGET_TRIPLE='x86_64-unknown-linux-gnu'
+elif [[ "$unamestr" == 'Darwin' ]]; then
+   TARGET_TRIPLE='x86_64-apple-darwin'
+else
+   echo "Unsupported os"
+   exit 1
+fi
+
+# Build libs
+export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked --sysroot ../"
+if [[ "$1" == "--release" ]]; then
+    channel='release'
+    RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
+else
+    channel='debug'
+    cargo build --target $TARGET_TRIPLE
+fi
+
+# Copy files to sysroot
+mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
+cp target/$TARGET_TRIPLE/$channel/deps/*.rlib sysroot/lib/rustlib/$TARGET_TRIPLE/lib/