Skip to content

Commit a0d20e9

Browse files
committed
rust-lang setup improvements:
* Use CARGO_HOME and RUSTUP_HOME * Install the proper toolchains
1 parent ad14f7d commit a0d20e9

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

rust-build/build_rust_for_rust_keylock_android.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ cd $BASEDIR/../
55
BASEDIR=`pwd`
66
echo Entered Base directory $BASEDIR
77

8+
# Add cargo to the path
9+
CARGO_HOME=$BASEDIR/tools/.cargo
10+
RUSTUP_HOME=$BASEDIR/tools/.rustup
11+
PATH=$PATH:$CARGO_HOME/bin
12+
813
ANDROID_RUST="$BASEDIR/rust"
914
ANDROID_RUST_KEYLOCK_LIB="$ANDROID_RUST/target/arm-linux-androideabi/release/librustkeylockandroid.so"
1015
ANDROID_JAVA_NATIVE="$BASEDIR/java/libs/armeabi/"
@@ -15,4 +20,4 @@ xargo build --target=arm-linux-androideabi --release
1520
echo "Copying $ANDROID_RUST_KEYLOCK_LIB to $ANDROID_JAVA_NATIVE"
1621
cp $ANDROID_RUST_KEYLOCK_LIB $ANDROID_JAVA_NATIVE
1722

18-
echo "Rust build for rust-keylock-android completed."
23+
echo "Rust build for rust-keylock-android completed."

rust-build/pre_build_rust_keylock_android.sh

+10-6
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ cd $BASEDIR/../
55
BASEDIR=`pwd`
66
echo Base directory is $BASEDIR
77

8-
# Save the current HOME variable and override it with a subdirectory
9-
mkdir home
10-
HOME_BAK=$HOME
11-
HOME=$BASEDIR/home
8+
# Set the home directories for cargo and rustup
9+
mkdir -p tools/.cargo
10+
mkdir -p tools/.rustup
11+
CARGO_HOME=$BASEDIR/tools/.cargo
12+
RUSTUP_HOME=$BASEDIR/tools/.rustup
1213

1314
# Install the latest rust stable and cargo
14-
`curl https://sh.rustup.rs -sSf | sh -s -- -y`
15-
PATH=$PATH:$HOME/.cargo/bin
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+
18+
rustup default stable
19+
rustup target add arm-linux-androideabi
1620

1721
# Install xargo
1822
cargo install xargo --force

0 commit comments

Comments
 (0)