mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 01:39:18 +02:00
adapt build script for M1/M2 hosts (#2433)
* adapt build script for M1/M2 hosts * GUI way to set up build environment, update NDK information * more precice warning message
This commit is contained in:
parent
d1b3124ab0
commit
f2e1503b52
2 changed files with 19 additions and 12 deletions
24
README.md
24
README.md
|
@ -98,11 +98,19 @@ See https://wiki.archlinux.org/index.php/Podman#Rootless_Podman for more informa
|
||||||
|
|
||||||
# <a name="install-build-environment"></a>Install Build Environment (without Docker or Podman)
|
# <a name="install-build-environment"></a>Install Build Environment (without Docker or Podman)
|
||||||
|
|
||||||
To setup build environment manually, you can read the `Dockerfile`
|
To setup build environment manually:
|
||||||
and mimic what it does.
|
- _Either_, in Android Studio, go to "Tools / SDK Manager / SDK Tools", enable "Show Package Details",
|
||||||
|
select "CMake" and the desired NDK, hit "Apply".
|
||||||
|
- _Or_ read `Dockerfile` and mimic what it does.
|
||||||
|
|
||||||
First, you need to setup Android SDK and Android NDK. Configure
|
Currently ndk20b is the minimum required version.
|
||||||
`ANDROID_NDK_ROOT` environment variable to point to the Android NDK
|
Newer versions will likely work, however, changes on the ndk-version should be
|
||||||
|
done with care. Too new versions do not support abi16 and cannot be used to target Android 4.3 or lower.
|
||||||
|
|
||||||
|
Then, in both cases, install Rust using [rustup](https://rustup.rs/)
|
||||||
|
and Rust toolchains for cross-compilation by executing `scripts/install-toolchains.sh`.
|
||||||
|
|
||||||
|
Then, configure `ANDROID_NDK_ROOT` environment variable to point to the Android NDK
|
||||||
installation directory e.g. by adding this to your `.bashrc`:
|
installation directory e.g. by adding this to your `.bashrc`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -110,14 +118,6 @@ export ANDROID_NDK_ROOT=${HOME}/Android/Sdk/ndk/[version] # (or whereever your N
|
||||||
export PATH=${PATH}:${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/:${ANDROID_NDK_ROOT}
|
export PATH=${PATH}:${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/:${ANDROID_NDK_ROOT}
|
||||||
```
|
```
|
||||||
|
|
||||||
Currently ndk20b is the minimum required version.
|
|
||||||
Newer versions will likely work, however, are not tested and not used
|
|
||||||
in official releases, in general, changes on the ndk-version should be
|
|
||||||
done with care.
|
|
||||||
|
|
||||||
Then, install Rust using [rustup](https://rustup.rs/). Install Rust
|
|
||||||
toolchains for cross-compilation by executing `scripts/install-toolchains.sh`.
|
|
||||||
|
|
||||||
After that, call `scripts/ndk-make.sh` in the root directory to build core-rust.
|
After that, call `scripts/ndk-make.sh` in the root directory to build core-rust.
|
||||||
Afterwards run the project in Android Studio. The project requires API 25.
|
Afterwards run the project in Android Studio. The project requires API 25.
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,13 @@ echo Setting CARGO_TARGET environment variables.
|
||||||
if test -z "$NDK_HOST_TAG"; then
|
if test -z "$NDK_HOST_TAG"; then
|
||||||
KERNEL="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
KERNEL="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||||
ARCH="$(uname -m)"
|
ARCH="$(uname -m)"
|
||||||
|
|
||||||
|
if test "$ARCH" == "arm64" && ! test -f "$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$KERNEL-$ARCH/bin/aarch64-linux-android21-clang"; then
|
||||||
|
echo "arm64 host is not supported by $ANDROID_NDK_ROOT; trying to use x86_64, in case the host has a binary translation such as Rosetta or QEMU installed."
|
||||||
|
echo "(Newer NDK may support arm64 host but may lack support for Android4/ABI16)"
|
||||||
|
ARCH="x86_64"
|
||||||
|
fi
|
||||||
|
|
||||||
NDK_HOST_TAG="$KERNEL-$ARCH"
|
NDK_HOST_TAG="$KERNEL-$ARCH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue