1
1
#! /bin/bash
2
2
3
+ set -e
4
+
3
5
BASEDIR=$( dirname " $0 " )
4
6
cd $BASEDIR /../
5
7
BASEDIR=` pwd`
@@ -12,17 +14,39 @@ CARGO_HOME=$BASEDIR/tools/.cargo
12
14
RUSTUP_HOME=$BASEDIR /tools/.rustup
13
15
14
16
# Install the latest rust stable and cargo
15
- ` curl https://sh.rustup.rs -sSf | CARGO_HOME=$BASEDIR /tools/.cargo RUSTUP_HOME=$BASEDIR /tools/.rustup sh -s -- -y`
16
- PATH=$PATH :$CARGO_HOME /bin
17
+ PATH=$CARGO_HOME /bin:$PATH
18
+
19
+ curl https://sh.rustup.rs -sSf > tools/rustup.sh
20
+ chmod +x tools/rustup.sh
17
21
18
- rustup default stable
19
- rustup target add arm-linux-androideabi
22
+ CARGO_HOME=$BASEDIR /tools/.cargo RUSTUP_HOME=$BASEDIR /tools/.rustup sh tools/rustup.sh --no-modify-path -y
23
+
24
+ $CARGO_HOME /bin/rustup default stable
25
+ $CARGO_HOME /bin/rustup target add arm-linux-androideabi
20
26
21
27
# Install xargo
22
- cargo install xargo --force
28
+ $CARGO_HOME /bin/ cargo install xargo --force --root $CARGO_HOME
23
29
24
30
# Create an Android toolchain
25
31
cd $BASEDIR
32
+
33
+ # Get the appropriate env variable in order to create the needed toolchain
34
+
35
+ if [ -n " ${ANDROID_NDK} " ]; then
36
+ echo " Found a pre-installed NDK in ${ANDROID_NDK} "
37
+ else
38
+ # If the NDK does not exist, download it
39
+ echo " Did not find a pre-installed NDK... Downloading one"
40
+ curl -L http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin -O
41
+ chmod u+x android-ndk-r10e-linux-x86_64.bin
42
+ ./android-ndk-r10e-linux-x86_64.bin > /dev/null
43
+ rm android-ndk-r10e-linux-x86_64.bin
44
+ ANDROID_NDK=` pwd` /android-ndk-r10e
45
+ PATH=$PATH :${ANDROID_NDK}
46
+ fi
47
+
48
+ ANDROID_NDK_HOME=${ANDROID_NDK}
49
+
26
50
sh $ANDROID_NDK /build/tools/make-standalone-toolchain.sh --platform=android-16 --arch=arm --install-dir=android-toolchain
27
51
cd android-toolchain
28
52
ANDROID_TOOLCHAIN_DIR=` pwd`
@@ -34,7 +58,7 @@ mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=${BA
34
58
35
59
# Go to the .cargo directory
36
60
cd $BASEDIR /rust
37
- mkdir .cargo
61
+ mkdir -p .cargo
38
62
cd .cargo
39
63
CURR_DIR=` pwd`
40
64
echo Entered directory $CURR_DIR
0 commit comments