forked from rust-lang/libc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-rust.sh
executable file
·76 lines (62 loc) · 1.65 KB
/
install-rust.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env sh
# This is intended to be used in CI only.
set -eux
echo "Setup toolchain"
toolchain="${TOOLCHAIN:-nightly}"
os="${OS:-}"
case "$(uname -s)" in
Linux*) os=linux ;;
Darwin*) os=macos ;;
MINGW*) os=windows ;;
*)
echo "Unknown system $(uname -s)"
exit 1
;;
esac
if [ "$os" = "windows" ] && [ -n "${TARGET:-}" ]; then
toolchain="$toolchain-$TARGET"
rustup set profile minimal
fi
rustup set profile minimal
rustup update --force "$toolchain"
rustup default "$toolchain"
if [ -n "${TARGET:-}" ]; then
echo "Install target"
rustup target add "$TARGET"
fi
if [ -n "${INSTALL_RUST_SRC:-}" ]; then
echo "Install rust-src"
rustup component add rust-src
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
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