Add scripts/install-toolchains.sh

This commit is contained in:
Alexander Krotov 2020-10-20 23:57:04 +03:00 committed by link2xt
parent 60d915fa13
commit 3b4ed28269
4 changed files with 13 additions and 8 deletions

View file

@ -30,8 +30,4 @@ ENV PATH ${PATH}:/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/b
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
ENV PATH ${PATH}:/root/.cargo/bin ENV PATH ${PATH}:/root/.cargo/bin
COPY jni/deltachat-core-rust/rust-toolchain ${ANDROID_HOME}
RUN rustup default `cat ${ANDROID_HOME}/rust-toolchain` \
&& rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
COPY docker/cargo-config /root/.cargo/config COPY docker/cargo-config /root/.cargo/config

View file

@ -40,8 +40,9 @@ Then, run the image:
podman run -it -v $(pwd):/home/app -w /home/app localhost/deltachat-android podman run -it -v $(pwd):/home/app -w /home/app localhost/deltachat-android
``` ```
Within the container, build the native library first: Within the container, install toolchains and build the native library:
``` ```
root@6012dcb974fe:/home/app# scripts/install-toolchains.sh
root@6012dcb974fe:/home/app# ./ndk-make.sh root@6012dcb974fe:/home/app# ./ndk-make.sh
``` ```

View file

@ -5,9 +5,8 @@ echo "starting time: `date`"
cd jni/deltachat-core-rust cd jni/deltachat-core-rust
# to setup the toolchains (from https://medium.com/visly/rust-on-android-19f34a2fb43 ) # to setup the toolchains (from https://medium.com/visly/rust-on-android-19f34a2fb43 )
# run the following in `jni/deltachat-core-rust`: # run `scripts/install-toolchains.sh`.
# $ rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android --toolchain `cat rust-toolchain` #
#
# Currently ndk20b is minimum required version # Currently ndk20b is minimum required version
# (newer versions will likely work, however, are not tested and not used in offial releases, # (newer versions will likely work, however, are not tested and not used in offial releases,
# in general, changes on the ndk-version should be done with care) # in general, changes on the ndk-version should be done with care)

9
scripts/install-toolchains.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
#
# Installs Rust cross-compilation toolchains for all supported architectures.
#
set -e
TARGETS="armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android"
TOOLCHAIN="$(cat jni/deltachat-core-rust/rust-toolchain)"
rustup install "$TOOLCHAIN"
rustup target add $TARGETS --toolchain "$TOOLCHAIN"