mirror of
https://github.com/chatmail/core.git
synced 2026-05-06 16:36:59 +03:00
Compile deltachat-rpc-server for Android
Co-Authored-By: link2xt <link2xt@testrun.org>
This commit is contained in:
44
.github/workflows/deltachat-rpc-server.yml
vendored
44
.github/workflows/deltachat-rpc-server.yml
vendored
@@ -51,6 +51,50 @@ jobs:
|
|||||||
path: target/aarch64-unknown-linux-musl/release/deltachat-rpc-server
|
path: target/aarch64-unknown-linux-musl/release/deltachat-rpc-server
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
build_android:
|
||||||
|
name: Cross-compile deltachat-rpc-server for Android (armeabi-v7a, arm64-v8a, x86 and x86_64)
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: nttld/setup-ndk@v1
|
||||||
|
id: setup-ndk
|
||||||
|
with:
|
||||||
|
ndk-version: r21d
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
|
||||||
|
run: sh scripts/android-rpc-server.sh
|
||||||
|
|
||||||
|
- name: Upload binary
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: deltachat-rpc-server-android-armv7
|
||||||
|
path: target/armv7-linux-androideabi/release/deltachat-rpc-server
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload binary
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: deltachat-rpc-server-android-aarch64
|
||||||
|
path: target/aarch64-linux-android/release/deltachat-rpc-server
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload binary
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: deltachat-rpc-server-android-i686
|
||||||
|
path: target/i686-linux-android/release/deltachat-rpc-server
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload binary
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: deltachat-rpc-server-android-x86_64
|
||||||
|
path: target/x86_64-linux-android/release/deltachat-rpc-server
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
build_windows:
|
build_windows:
|
||||||
name: Build deltachat-rpc-server for Windows
|
name: Build deltachat-rpc-server for Windows
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
44
scripts/android-rpc-server.sh
Executable file
44
scripts/android-rpc-server.sh
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Build deltachat-rpc-server for Android.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
test -n "$ANDROID_NDK_ROOT" || exit 1
|
||||||
|
|
||||||
|
RUSTUP_TOOLCHAIN="1.64.0"
|
||||||
|
rustup install "$RUSTUP_TOOLCHAIN"
|
||||||
|
rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android --toolchain "$RUSTUP_TOOLCHAIN"
|
||||||
|
|
||||||
|
KERNEL="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||||
|
ARCH="$(uname -m)"
|
||||||
|
NDK_HOST_TAG="$KERNEL-$ARCH"
|
||||||
|
TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$NDK_HOST_TAG"
|
||||||
|
export PATH="$PATH:$TOOLCHAIN/bin/"
|
||||||
|
|
||||||
|
PACKAGE="deltachat-rpc-server"
|
||||||
|
|
||||||
|
export CARGO_PROFILE_RELEASE_LTO=on
|
||||||
|
|
||||||
|
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="$TOOLCHAIN/bin/armv7a-linux-androideabi16-clang" \
|
||||||
|
CFLAGS=-D__ANDROID_API__=16 \
|
||||||
|
TARGET_CC=armv7a-linux-androideabi16-clang \
|
||||||
|
TARGET_AR=llvm-ar \
|
||||||
|
cargo "+$RUSTUP_TOOLCHAIN" rustc --release --target armv7-linux-androideabi -p $PACKAGE
|
||||||
|
|
||||||
|
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$TOOLCHAIN/bin/aarch64-linux-android21-clang" \
|
||||||
|
CFLAGS=-D__ANDROID_API__=21 \
|
||||||
|
TARGET_CC=aarch64-linux-android21-clang \
|
||||||
|
TARGET_AR=llvm-ar \
|
||||||
|
cargo "+$RUSTUP_TOOLCHAIN" rustc --release --target aarch64-linux-android -p $PACKAGE
|
||||||
|
|
||||||
|
CARGO_TARGET_I686_LINUX_ANDROID_LINKER="$TOOLCHAIN/bin/i686-linux-android16-clang" \
|
||||||
|
CFLAGS=-D__ANDROID_API__=16 \
|
||||||
|
TARGET_CC=i686-linux-android16-clang \
|
||||||
|
TARGET_AR=llvm-ar \
|
||||||
|
cargo "+$RUSTUP_TOOLCHAIN" rustc --release --target i686-linux-android -p $PACKAGE
|
||||||
|
|
||||||
|
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER="$TOOLCHAIN/bin/x86_64-linux-android21-clang" \
|
||||||
|
CFLAGS=-D__ANDROID_API__=21 \
|
||||||
|
TARGET_CC=x86_64-linux-android21-clang \
|
||||||
|
TARGET_AR=llvm-ar \
|
||||||
|
cargo "+$RUSTUP_TOOLCHAIN" rustc --release --target x86_64-linux-android -p $PACKAGE
|
||||||
Reference in New Issue
Block a user