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>2019-07-30 13:37:47 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2019-07-30 13:37:54 +0200
commit8691b8b8b6d88a51ee4783a8c704f052db479738 (patch)
tree1a56dc39dd1d5b01b4d78783afc386accca3940d /build_sysroot/build_sysroot.sh
parentee4927e069ae317c4b2360eafe07a3fbaa8f0988 (diff)
downloadrust-8691b8b8b6d88a51ee4783a8c704f052db479738.tar.gz
rust-8691b8b8b6d88a51ee4783a8c704f052db479738.zip
Test rust-lang/regex example shootout-regex-dna
Diffstat (limited to 'build_sysroot/build_sysroot.sh')
-rwxr-xr-xbuild_sysroot/build_sysroot.sh26
1 files changed, 11 insertions, 15 deletions
diff --git a/build_sysroot/build_sysroot.sh b/build_sysroot/build_sysroot.sh
index 57752c402c5..165d67a8146 100755
--- a/build_sysroot/build_sysroot.sh
+++ b/build_sysroot/build_sysroot.sh
@@ -1,34 +1,30 @@
 #!/bin/bash
+
+# Requires the CHANNEL env var to be set to `debug` or `release.`
+
 set -e
 cd $(dirname "$0")
 
+pushd ../ >/dev/null
+source ./config.sh
+popd >/dev/null
+
 # Cleanup for previous run
 #     v Clean target dir except for build scripts and incremental cache
 rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} || true
 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
-mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
 export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked"
 if [[ "$1" == "--release" ]]; then
-    channel='release'
+    sysroot_channel='release'
     RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
 else
-    channel='debug'
+    sysroot_channel='debug'
     cargo build --target $TARGET_TRIPLE
 fi
 
 # Copy files to sysroot
-cp target/$TARGET_TRIPLE/$channel/deps/*.rlib sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
+mkdir -p sysroot/lib/rustlib/$TARGET_TRIPLE/lib/
+cp target/$TARGET_TRIPLE/$sysroot_channel/deps/*.rlib sysroot/lib/rustlib/$TARGET_TRIPLE/lib/