darkirc: fully working docker image

This commit is contained in:
x
2023-09-05 16:37:38 +02:00
parent 291d3e343e
commit 546e5a3c46
4 changed files with 24 additions and 15 deletions

View File

@@ -24,7 +24,8 @@ android:
docker build -t test:latest . --file android.Dockerfile
# Use this command to get an interactive terminal inside docker:
#docker run -v $(shell pwd)/../../:/root/src -it test:latest /bin/bash
docker run -v $(shell pwd)/../../:/root/src -t test:latest make _aarch64-android
docker run --rm -v $(shell pwd)/../../:/root/src -t test:latest make _aarch64-android
cp -f ../../target/aarch64-linux-android/release/darkirc darkirc.aarch64-android
# Invoked inside docker by the command above
# We need to mount this directory as a volume using -v so docker can access it

View File

@@ -2,7 +2,6 @@
see [Darkfi Book](https://darkrenaissance.github.io/darkfi/misc/darkirc/darkirc.html) for the installation guide.
## Services
To operate with `darkirc` using IRC clients, we can implement special

View File

@@ -2,7 +2,7 @@ FROM ubuntu
RUN apt update
RUN apt install -yq openjdk-19-jre-headless openjdk-19-jdk-headless
RUN apt install -yq wget unzip cmake
RUN apt install -yq wget unzip cmake file
RUN cd /tmp/ && \
wget -O install-rustup.sh https://sh.rustup.rs && \
@@ -29,20 +29,19 @@ RUN cd ${ANDROID_HOME}/cmdline-tools/ && \
RUN yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --licenses
RUN ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager "platform-tools"
RUN ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager "platforms;android-34"
RUN ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager "ndk-bundle"
RUN ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager "ndk;25.2.9519653"
RUN ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0"
RUN echo '[target.aarch64-linux-android] \n\
ar = "/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar" \n\
linker = "/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang" \n\
ar = "/opt/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" \n\
linker = "/opt/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang" \n\
' > /root/.cargo/config
# Needed by the ring dependency
ENV TARGET_AR /opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar
ENV TARGET_CC /opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang
ENV TARGET_AR /opt/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
ENV TARGET_CC /opt/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang
# Make sqlite3
RUN apt install -yq file
RUN cd /tmp/ && \
wget -O sqlite.zip https://www.sqlite.org/2023/sqlite-amalgamation-3430000.zip && \
unzip sqlite.zip && \
@@ -66,14 +65,9 @@ LOCAL_C_INCLUDES := ../build \n\
LOCAL_EXPORT_C_INCLUDES := ../build \n\
LOCAL_CFLAGS := -DSQLITE_THREADSAFE=1 \n\
include $(BUILD_STATIC_LIBRARY)' > jni/Android.mk && \
/opt/android-sdk/ndk-bundle/ndk-build
/opt/android-sdk/ndk/25.2.9519653/ndk-build
ENV RUSTFLAGS "-L/tmp/sqlite/obj/local/arm64-v8a/"
# Bug in cargo
# https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html
# https://github.com/rust-lang/rust/pull/85806#issuecomment-1096266946
RUN find ${ANDROID_HOME} -name "libunwind.a" -execdir bash -c 'echo "INPUT(-lunwind)" > libgcc.a' \;
# Make directory for user code
RUN mkdir /root/src
WORKDIR /root/src/bin/darkirc/

View File

@@ -32,6 +32,21 @@ you have all the necessary dependencies.
% make darkirc
```
## Installation (Android)
This is for Android 64 bit (which is most phones).
1. Install Docker
2. Run `cd bin/darkirc/ && make android`. The resulting file will be called
`darkirc.aarch64-android`. Copy this to your phone.
3. Install Termux and RevolutionIRC on F-Droid.
4. You can access the phone storage from `/sdcard/` and copy the file
into the Termux home.
5. Run `termux-wake-lock`. This stops Android suspending the daemon.
6. Run the daemon. You can open new Termux sessions by swiping from
the left to bring up the sidebar.
7. Connect the RevolutionIRC frontend.
## Usage (DarkFi Network)
Upon compiling `darkirc` as described above, the preconfigured defaults