mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 01:39:18 +02:00
Update Dockerfile to build Rust core
This commit is contained in:
parent
3dac8d8fa0
commit
aee9324a83
3 changed files with 81 additions and 26 deletions
57
Dockerfile
57
Dockerfile
|
@ -1,25 +1,36 @@
|
|||
FROM ubuntu:17.04
|
||||
FROM ubuntu:18.04
|
||||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update -y && \
|
||||
apt-get install -y software-properties-common && \
|
||||
apt-get update -y && \
|
||||
apt-get install -y libc6:i386=2.24-9ubuntu2.2 libncurses5:i386=6.0+20160625-1ubuntu1 libstdc++6:i386=6.3.0-12ubuntu2 lib32z1=1:1.2.11.dfsg-0ubuntu1 wget openjdk-8-jdk=8u131-b11-2ubuntu1.17.04.3 git unzip && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
apt-get autoremove -y && \
|
||||
apt-get clean
|
||||
# Install Android Studio requirements
|
||||
# See https://developer.android.com/studio/install#linux
|
||||
RUN apt-get update -y \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
wget \
|
||||
curl \
|
||||
unzip \
|
||||
openjdk-11-jre \
|
||||
file \
|
||||
build-essential \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV ANDROID_SDK_FILENAME android-sdk_r24.4.1-linux.tgz
|
||||
ENV ANDROID_SDK_URL https://dl.google.com/android/${ANDROID_SDK_FILENAME}
|
||||
ENV ANDROID_API_LEVELS android-27
|
||||
ENV ANDROID_BUILD_TOOLS_VERSION 27.0.1
|
||||
ENV ANDROID_HOME /usr/local/android-sdk-linux
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
|
||||
RUN cd /usr/local/ && \
|
||||
wget -q ${ANDROID_SDK_URL} && \
|
||||
tar -xzf ${ANDROID_SDK_FILENAME} && \
|
||||
rm ${ANDROID_SDK_FILENAME}
|
||||
RUN echo y | android update sdk --no-ui -a --filter ${ANDROID_API_LEVELS}
|
||||
RUN echo y | android update sdk --no-ui -a --filter extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository
|
||||
RUN echo y | android update sdk --no-ui -a --filter tools,platform-tools,build-tools-${ANDROID_BUILD_TOOLS_VERSION}
|
||||
RUN rm -rf ${ANDROID_HOME}/tools && unzip ${ANDROID_HOME}/temp/*.zip -d ${ANDROID_HOME}
|
||||
ENV ANDROID_HOME /android-sdk
|
||||
|
||||
WORKDIR /android-sdk
|
||||
RUN wget -q https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip && \
|
||||
unzip commandlinetools-linux-6200805_latest.zip && \
|
||||
rm commandlinetools-linux-6200805_latest.zip
|
||||
|
||||
RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} --licenses
|
||||
|
||||
ENV PATH ${PATH}:/android-sdk/tools/bin
|
||||
|
||||
# Install NDK manually. Other SDK parts are installed automatically by gradle.
|
||||
RUN sdkmanager --sdk_root=${ANDROID_HOME} ndk-bundle
|
||||
|
||||
ENV PATH ${PATH}:/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/:/android-sdk/ndk-bundle/
|
||||
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
|
||||
ENV PATH ${PATH}:/root/.cargo/bin
|
||||
RUN rustup default nightly-2019-11-06 \
|
||||
&& rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
|
||||
|
||||
COPY docker/cargo-config /root/.cargo/config
|
||||
|
|
42
README.md
42
README.md
|
@ -12,7 +12,7 @@ For the core library and other common info, please refer to the
|
|||
<img alt="Screenshot Chat List" src="docs/images/2019-01-chatlist.png" width="298" /> <img alt="Screenshot Chat View" src="docs/images/2019-01-chat.png" width="298" />
|
||||
|
||||
|
||||
# Build
|
||||
# Check Out Repository
|
||||
|
||||
When checking out _deltachat-android_, make sure also to check out the
|
||||
subproject _deltachat-core-rust_:
|
||||
|
@ -22,8 +22,44 @@ subproject _deltachat-core-rust_:
|
|||
or later by `git submodule update --init --recursive`. If you do this in your
|
||||
home directory, this results in the folder `~/deltachat-android` which is just fine.
|
||||
|
||||
Then, open `ndk-make.sh` in an editor and follow the instructions
|
||||
to set up a rust build environment. This is needed only once.
|
||||
# Build Using Dockerfile
|
||||
|
||||
If you only want to build an APK, the easiest way is to use
|
||||
provided `Dockerfile` with [Docker](https://www.docker.com/) or
|
||||
[Podman](https://podman.io/). Podman is a drop-in replacement for Docker
|
||||
that does not require root privileges. It is used in the following
|
||||
example.
|
||||
|
||||
First, build the image `deltachat-android` by running
|
||||
```
|
||||
podman build . -t deltachat-android
|
||||
```
|
||||
|
||||
Then, run the image:
|
||||
```
|
||||
podman run -it -v $(pwd):/home/app -w /home/app localhost/deltachat-android
|
||||
```
|
||||
|
||||
Within the container, build the native library first:
|
||||
```
|
||||
root@6012dcb974fe:/home/app# ./ndk-make.sh
|
||||
```
|
||||
|
||||
Then, [build an APK](https://developer.android.com/studio/build/building-cmdline):
|
||||
```
|
||||
root@6012dcb974fe:/home/app# ./gradlew assembleDebug
|
||||
```
|
||||
|
||||
If you don't want to use Docker or Podman, proceed to the next section.
|
||||
|
||||
# Install Build Environment
|
||||
|
||||
To setup build environment manually, you can read the `Dockerfile`
|
||||
and mimic what it does.
|
||||
|
||||
First, you need to setup Android SDK and Android NDK. Then, open
|
||||
`ndk-make.sh` in an editor and follow the instructions to set up a rust
|
||||
build environment. This is needed only once.
|
||||
|
||||
After that, call `./ndk-make.sh` in the root directory to build core-rust.
|
||||
Afterwards run the project in Android Studio. The project requires API 25.
|
||||
|
|
8
docker/cargo-config
Normal file
8
docker/cargo-config
Normal file
|
@ -0,0 +1,8 @@
|
|||
[target.armv7-linux-androideabi]
|
||||
linker = "/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi16-clang"
|
||||
[target.aarch64-linux-android]
|
||||
linker = "/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang"
|
||||
[target.i686-linux-android]
|
||||
linker = "/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android16-clang"
|
||||
[target.x86_64-linux-android]
|
||||
linker = "/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang"
|
Loading…
Add table
Add a link
Reference in a new issue