Procházet zdrojové kódy

app: tweak android build paths and Dockerfile

jkds před 7 měsíci
rodič
revize
49bcfb575f
4 změnil soubory, kde provedl 13 přidání a 8 odebrání
  1. 4 4
      bin/app/Dockerfile
  2. 3 2
      bin/app/Makefile
  3. 5 1
      bin/app/README.md
  4. 1 1
      bin/app/build.rs

+ 4 - 4
bin/app/Dockerfile

@@ -19,8 +19,8 @@ RUN rustup target add i686-linux-android
 RUN rustup target add x86_64-linux-android
 
 # Install Android SDK
-ENV ANDROID_HOME /opt/android-sdk-linux
-ENV JAVA_HOME /usr/lib/jvm/default
+ENV ANDROID_HOME /opt/android-sdk-linux/
+ENV JAVA_HOME /usr/lib/jvm/default/
 RUN mkdir ${ANDROID_HOME} && \
     cd ${ANDROID_HOME} && \
     wget -q https://dl.google.com/android/repository/commandlinetools-linux-13114758_latest.zip && \
@@ -37,11 +37,11 @@ RUN yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager "build-tools;36.0.
 RUN ${ANDROID_HOME}/tools/bin/sdkmanager --update | grep -v = || true
 
 # Install Android NDK
-RUN cd /usr/local && \
+RUN cd /opt/ && \
     wget -q http://dl.google.com/android/repository/android-ndk-r25-linux.zip && \
     unzip -q android-ndk-r25-linux.zip && \
     rm android-ndk-r25-linux.zip
-ENV NDK_HOME /usr/local/android-ndk-r25
+ENV NDK_HOME /opt/android-ndk-r25/
 
 # Copy contents to container. Should only use this on a clean directory
 WORKDIR /root/

+ 3 - 2
bin/app/Makefile

@@ -86,8 +86,9 @@ dev: $(SRC) fonts assets/forest_1920x1080.ivf
 	-mv target/debug/darkfi-app .
 	./darkfi-app
 
+# Users should use the android-release and android-debug targets instead.
 apk: $(SRC) fonts assets/forest_720x1280.mp4
-	podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build $(DEV_FEATURES)
+	cargo quad-apk build $(DEV_FEATURES)
 	$(MAKE) install-apk
 
 install-apk:
@@ -100,7 +101,7 @@ install-apk:
 	adb $(ADB_DEVICE) logcat -v color -s darkfi -s SAPP -s libc -s DEBUG -s ActivityManager -s ActivityTaskManager -s WindowManager -s AndroidRuntime -s rkfi.darkfi_app | tee output.log
 
 # Useful for dev
-cli:
+podman-cli:
 	podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -it apk bash
 
 fmt:

+ 5 - 1
bin/app/README.md

@@ -26,10 +26,14 @@ podman build -t apk .
 make android
 ```
 
-To debug any issues, you can enter an interactive terminal using `make cli`.
+To debug any issues, you can enter an interactive terminal using `make podman-cli`.
 
 To delete everything, run `podman system reset`.
 
+Users who prefer to build locally can follow the commands in the `Dockerfile`.
+Note that the `build.rs` hardcodes the SDK/NDK paths so either you follow it
+exactly (recommended) or modify `build.rs`.
+
 # Useful Dev Commands
 
 This is just for devs. Users ignore this.

+ 1 - 1
bin/app/build.rs

@@ -53,7 +53,7 @@ fn main() {
 
     if target_os == "android" {
         // Since we run this inside a container, we can just hardcore the paths directly
-        println!("cargo:rustc-link-search=/usr/local/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.6/lib/linux/");
+        println!("cargo:rustc-link-search=/opt/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.6/lib/linux/");
         match target_arch.as_str() {
             "aarch64" => println!("cargo:rustc-link-lib=static=clang_rt.builtins-aarch64-android"),
             "arm" => println!("cargo:rustc-link-lib=static=clang_rt.builtins-arm-android"),