From 78aada7027184d497bd2e1da75c9834bd1fd322a Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 25 Dec 2022 22:40:09 +0000 Subject: [PATCH] Explicitly set RUSTUP_TOOLCHAIN to 1.64.0 Core is supposed to support all Rust versions above MSRV, there is no need to use the same toolchain for the core across all platforms. --- .github/workflows/preview-apk.yml | 2 -- scripts/install-toolchains.sh | 6 +++--- scripts/ndk-make.sh | 10 ++++++---- scripts/rust-toolchain | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 scripts/rust-toolchain diff --git a/.github/workflows/preview-apk.yml b/.github/workflows/preview-apk.yml index e2a5c1eb12..d7f294da98 100644 --- a/.github/workflows/preview-apk.yml +++ b/.github/workflows/preview-apk.yml @@ -14,8 +14,6 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive - - run: cp jni/deltachat-core-rust/rust-toolchain . - - uses: actions-rs/toolchain@v1 - uses: Swatinem/rust-cache@v1 with: working-directory: jni/deltachat-core-rust diff --git a/scripts/install-toolchains.sh b/scripts/install-toolchains.sh index 07e125c260..0eb8522778 100755 --- a/scripts/install-toolchains.sh +++ b/scripts/install-toolchains.sh @@ -4,6 +4,6 @@ # 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" +RUSTUP_TOOLCHAIN=$(cat "$(dirname "$0")/rust-toolchain") +rustup install "$RUSTUP_TOOLCHAIN" +rustup target add $TARGETS --toolchain "$RUSTUP_TOOLCHAIN" diff --git a/scripts/ndk-make.sh b/scripts/ndk-make.sh index fb0be8e2d8..39fc138a30 100755 --- a/scripts/ndk-make.sh +++ b/scripts/ndk-make.sh @@ -62,6 +62,8 @@ export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$TOOLCHAIN/bin/aarch64-linux-a export CARGO_TARGET_I686_LINUX_ANDROID_LINKER="$TOOLCHAIN/bin/i686-linux-android16-clang" export CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER="$TOOLCHAIN/bin/x86_64-linux-android21-clang" +RUSTUP_TOOLCHAIN=$(cat "$(dirname "$0")/rust-toolchain") + # Check if the argument is a correct architecture: if test $1 && echo "armeabi-v7a arm64-v8a x86 x86_64" | grep -vwq $1; then echo "Architecture '$1' not known, possible values are armeabi-v7a, arm64-v8a, x86 and x86_64." @@ -113,7 +115,7 @@ if test -z $1 || test $1 = armeabi-v7a; then export CFLAGS=-D__ANDROID_API__=16 TARGET_CC=armv7a-linux-androideabi16-clang \ TARGET_AR=llvm-ar \ - cargo +`cat rust-toolchain` rustc $RELEASEFLAG --target armv7-linux-androideabi -p deltachat_ffi -- -L "$TMPLIB" + cargo "+$RUSTUP_TOOLCHAIN" rustc $RELEASEFLAG --target armv7-linux-androideabi -p deltachat_ffi -- -L "$TMPLIB" cp target/armv7-linux-androideabi/$RELEASE/libdeltachat.a $jnidir/armeabi-v7a fi @@ -122,7 +124,7 @@ if test -z $1 || test $1 = arm64-v8a; then export CFLAGS=-D__ANDROID_API__=21 TARGET_CC=aarch64-linux-android21-clang \ TARGET_AR=llvm-ar \ - cargo +`cat rust-toolchain` rustc $RELEASEFLAG --target aarch64-linux-android -p deltachat_ffi -- -L "$TMPLIB" + cargo "+$RUSTUP_TOOLCHAIN" rustc $RELEASEFLAG --target aarch64-linux-android -p deltachat_ffi -- -L "$TMPLIB" cp target/aarch64-linux-android/$RELEASE/libdeltachat.a $jnidir/arm64-v8a fi @@ -131,7 +133,7 @@ if test -z $1 || test $1 = x86; then export CFLAGS=-D__ANDROID_API__=16 TARGET_CC=i686-linux-android16-clang \ TARGET_AR=llvm-ar \ - cargo +`cat rust-toolchain` rustc $RELEASEFLAG --target i686-linux-android -p deltachat_ffi -- -L "$TMPLIB" + cargo "+$RUSTUP_TOOLCHAIN" rustc $RELEASEFLAG --target i686-linux-android -p deltachat_ffi -- -L "$TMPLIB" cp target/i686-linux-android/$RELEASE/libdeltachat.a $jnidir/x86 fi @@ -140,7 +142,7 @@ if test -z $1 || test $1 = x86_64; then export CFLAGS=-D__ANDROID_API__=21 TARGET_CC=x86_64-linux-android21-clang \ TARGET_AR=llvm-ar \ - cargo +`cat rust-toolchain` rustc $RELEASEFLAG --target x86_64-linux-android -p deltachat_ffi -- -L "$TMPLIB" + cargo "+$RUSTUP_TOOLCHAIN" rustc $RELEASEFLAG --target x86_64-linux-android -p deltachat_ffi -- -L "$TMPLIB" cp target/x86_64-linux-android/$RELEASE/libdeltachat.a $jnidir/x86_64 fi diff --git a/scripts/rust-toolchain b/scripts/rust-toolchain new file mode 100644 index 0000000000..9405730420 --- /dev/null +++ b/scripts/rust-toolchain @@ -0,0 +1 @@ +1.64.0