4
4
set -eux
5
5
6
6
echo " Setup toolchain"
7
- toolchain=
8
- if [ -n " $TOOLCHAIN " ]; then
9
- toolchain=$TOOLCHAIN
10
- else
11
- toolchain=nightly
12
- fi
13
7
14
- if [ " $OS " = " windows" ]; then
8
+ toolchain=" ${TOOLCHAIN:- nightly} "
9
+ os=" ${OS:- } "
10
+
11
+ if [ " $os " = " windows" ]; then
15
12
: " ${TARGET?The TARGET environment variable must be set.} "
16
13
rustup set profile minimal
17
14
rustup update --force " $toolchain -$TARGET "
22
19
rustup default " $toolchain "
23
20
fi
24
21
25
- if [ -n " $TARGET " ]; then
22
+ if [ -n " ${ TARGET:- } " ]; then
26
23
echo " Install target"
27
24
rustup target add " $TARGET "
28
25
fi
29
26
30
- if [ -n " $INSTALL_RUST_SRC " ]; then
27
+ if [ -n " ${ INSTALL_RUST_SRC:- } " ]; then
31
28
echo " Install rust-src"
32
29
rustup component add rust-src
33
30
fi
34
31
35
- if [ " $OS " = " windows" ]; then
36
- if [ " $ARCH_BITS " = " i686" ]; then
32
+ if [ " $os " = " windows" ]; then
33
+ if [ " ${ ARCH_BITS:- } " = " i686" ]; then
37
34
echo " Install MinGW32"
38
35
choco install mingw --x86 --force
39
36
fi
@@ -44,7 +41,7 @@ if [ "$OS" = "windows" ]; then
44
41
/usr/bin/find " C:\ProgramData\Chocolatey" -name " dllcrt2*"
45
42
/usr/bin/find " C:\ProgramData\Chocolatey" -name " libmsvcrt*"
46
43
47
- if [ -n " $ARCH_BITS " ]; then
44
+ if [ -n " ${ ARCH_BITS:- } " ]; then
48
45
echo " Fix MinGW"
49
46
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do
50
47
cp -f " /C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS /$ARCH -w64-mingw32/lib/$i " " $( rustc --print sysroot) /lib/rustlib/$TARGET /lib"
0 commit comments