Explorar el Código

wallet: add android build instructions and fix Cargo.toml paths

darkfi hace 2 años
padre
commit
4ef00a37c0

+ 2 - 2
bin/darkwallet/Cargo.toml

@@ -10,9 +10,9 @@ edition = "2021"
 [dependencies]
 #miniquad = "0.4.0-alpha"
 #miniquad = { git = "https://github.com/not-fl3/miniquad" }
-miniquad = { path = "/tmp/miniquad" }
+miniquad = { git = "https://github.com/narodnik/miniquad.git" }
 #harfbuzz_rs = { git = "https://github.com/narodnik/harfbuzz_rs.git", features = ["freetype"] }
-harfbuzz_rs = { path = "/tmp/harfbuzz_rs", features = ["freetype"] }
+harfbuzz_rs = { git = "https://github.com/narodnik/hbrs2.git", features = ["freetype"] }
 freetype-rs = { git = "https://github.com/narodnik/freetype-rs.git" }
 #harfbuzz = { version = "0.6.0", features = ["bundled"] }
 #harfbuzz_rs = "2.0.1"

+ 51 - 0
bin/darkwallet/Dockerfile

@@ -0,0 +1,51 @@
+FROM archlinux
+
+RUN pacman -Syu --noconfirm
+RUN pacman -S --noconfirm jdk8-openjdk unzip wget cmake rustup openssl pkgconf gcc git
+
+# github override HOME, so here we are
+ENV RUSTUP_HOME=/usr/local/rustup \
+    CARGO_HOME=/usr/local/cargo \
+    PATH=/usr/local/cargo/bin:$PATH 
+
+RUN rustup toolchain install nightly
+RUN rustup default nightly
+RUN rustc --version
+
+RUN rustup target add armv7-linux-androideabi
+RUN rustup target add aarch64-linux-android
+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
+RUN mkdir ${ANDROID_HOME} && \
+    cd ${ANDROID_HOME} && \
+    wget -q https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && \
+    unzip -q sdk-tools-linux-4333796.zip && \
+    rm sdk-tools-linux-4333796.zip && \
+    chown -R root:root /opt
+RUN mkdir -p ~/.android && touch ~/.android/repositories.cfg
+RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager "platform-tools" | grep -v = || true
+RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager "platforms;android-31" | grep -v = || true
+RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager "build-tools;31.0.0"  | grep -v = || true
+RUN ${ANDROID_HOME}/tools/bin/sdkmanager --update | grep -v = || true
+
+# Install Android NDK
+RUN cd /usr/local && \
+    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
+
+# Copy contents to container. Should only use this on a clean directory
+WORKDIR /root/
+RUN git clone https://github.com/not-fl3/cargo-quad-apk cargo-apk
+
+# Install binary
+RUN cargo install --path /root/cargo-apk
+
+# Add build-tools to PATH, for apksigner
+ENV PATH="/opt/android-sdk-linux/build-tools/31.0.0/:${PATH}"
+

+ 29 - 0
bin/darkwallet/README.android.md

@@ -0,0 +1,29 @@
+Docker commands:
+
+```
+docker system prune -a
+docker build -t apk .
+```
+
+```
+# This command gives an interactive terminal (useful for debugging):
+#docker run -v $(pwd):/root/dw -it apk bash
+
+docker run -v $(pwd):/root/dw -w /root/dw -t apk cargo quad-apk build
+```
+
+Enable USB debugging in developer options and run the following commands:
+
+```
+adb install -r target/android-artifacts/debug/apk/darkwallet.apk
+adb logcat -s darkfi
+```
+
+# Debugging Missing Symbols (note to self)
+
+```
+"hb_ft_font_create_referenced"
+
+nm libharfbuzz_rs-5d6b743170eb0207.rlib | grep hb_ | less
+```
+

+ 1 - 1
bin/darkwallet/src/gfx.rs

@@ -1265,7 +1265,7 @@ pub fn run_gui(scene_graph: SceneGraphPtr) {
     #[cfg(target_os = "android")]
     {
         android_logger::init_once(
-            android_logger::Config::default().with_max_level(LevelFilter::Debug).with_tag("fagman"),
+            android_logger::Config::default().with_max_level(LevelFilter::Debug).with_tag("darkfi"),
         );
     }