diff options
author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-10-10 23:01:28 +0900 |
---|---|---|
committer | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-10-14 07:40:01 +0900 |
commit | 2f605023a40f076f0e1f64cd3d3f2481895176f5 (patch) | |
tree | 14ee7b61f4e736868a99c7e87ac53583fe8f1ba0 /ci/install-rust.sh | |
parent | 885f69109764cd11cc58fb2a530eff6d8fd6b774 (diff) | |
download | rust-libc-2f605023a40f076f0e1f64cd3d3f2481895176f5.tar.gz |
Split off Rust installation scripts
Diffstat (limited to 'ci/install-rust.sh')
-rw-r--r-- | ci/install-rust.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/ci/install-rust.sh b/ci/install-rust.sh new file mode 100644 index 0000000000..598dec282d --- /dev/null +++ b/ci/install-rust.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env sh +# This is intended to be used in CI only. + +set -ex + +echo "Setup toolchain" +toolchain= +if [ -n "$TOOLCHAIN" ]; then + toolchain=$TOOLCHAIN +else + toolchain=nightly +fi +if [ "$OS" = "windows" ]; then + : "${TARGET?The TARGET environment variable must be set.}" + rustup set profile minimal + rustup update --force $toolchain-"$TARGET" + rustup default $toolchain-"$TARGET" +else + rustup set profile minimal + rustup update --force $toolchain + rustup default $toolchain +fi + +if [ -n "$TARGET" ]; then + echo "Install target" + rustup target add "$TARGET" +fi + +if [ "$OS" = "windows" ]; then + if [ "$ARCH_BITS" = "i686" ]; then + echo "Install MinGW32" + choco install mingw --x86 --force + fi + + echo "Find GCC libraries" + gcc -print-search-dirs + /usr/bin/find "C:\ProgramData\Chocolatey" -name "crt2*" + /usr/bin/find "C:\ProgramData\Chocolatey" -name "dllcrt2*" + /usr/bin/find "C:\ProgramData\Chocolatey" -name "libmsvcrt*" + + if [ -n "$ARCH_BITS" ]; then + echo "Fix MinGW" + for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do + cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib" + done + fi +fi + +echo "Query rust and cargo versions" +rustc -Vv +cargo -V +rustup -Vv +rustup show +which rustc +which cargo +which rustup + +echo "Generate lockfile" +N=5 +n=0 +until [ $n -ge $N ] +do + if cargo generate-lockfile; then + break + fi + n=$((n+1)) + sleep 1 +done |