Skip to content

Commit 124688c

Browse files
committed
build: progress on move to rust-android-gradle for building aw-server-rust
1 parent 2ef90b5 commit 124688c

File tree

3 files changed

+6
-50
lines changed

3 files changed

+6
-50
lines changed

Makefile

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: aw-webui
1+
.PHONY: aw-webui apk
22
SHELL := /bin/bash
33

44
# We should probably do this the "Android way" (would also help with getting it on FDroid):
@@ -8,56 +8,11 @@ SHELL := /bin/bash
88
RELEASE_TYPE = $(shell $$RELEASE && echo 'release' || echo 'debug')
99

1010
# Main targets
11-
all: aw-server-rust aw-webui
11+
all: aw-webui apk
1212
build: all
1313

14-
15-
# aw-server-rust stuff
16-
17-
RS_SRCDIR := aw-server-rust
18-
RS_OUTDIR := $(JNILIBS)
19-
RS_SOURCES := $(shell find $(RS_SRCDIR)/aw-* -type f -name '*.rs')
20-
21-
JNILIBS := mobile/src/main/jniLibs
22-
JNI_arm8 := $(JNILIBS)/arm64-v8a
23-
JNI_arm7 := $(JNILIBS)/armeabi-v7a
24-
JNI_x86 := $(JNILIBS)/x86
25-
JNI_x64 := $(JNILIBS)/x86_64
26-
27-
TARGET := aw-server-rust/target
28-
TARGET_arm7 := $(TARGET)/armv7-linux-androideabi
29-
TARGET_arm8 := $(TARGET)/aarch64-linux-android
30-
TARGET_x64 := $(TARGET)/x86_64-linux-android
31-
TARGET_x86 := $(TARGET)/i686-linux-android
32-
33-
aw-server-rust: $(JNILIBS)
34-
35-
.PHONY: $(JNILIBS)
36-
$(JNILIBS): $(JNI_arm7)/libaw_server.so $(JNI_arm8)/libaw_server.so $(JNI_x86)/libaw_server.so $(JNI_x64)/libaw_server.so
37-
ls -lL $@/*/* # Check that symlinks are valid
38-
39-
# There must be a better way to do this without repeating almost the same rule over and over?
40-
$(JNI_arm7)/libaw_server.so: $(TARGET_arm7)/$(RELEASE_TYPE)/libaw_server.so
41-
mkdir -p $$(dirname $@)
42-
ln -sfnv $$(pwd)/$^ $@
43-
$(JNI_arm8)/libaw_server.so: $(TARGET_arm8)/$(RELEASE_TYPE)/libaw_server.so
44-
mkdir -p $$(dirname $@)
45-
ln -sfnv $$(pwd)/$^ $@
46-
$(JNI_x86)/libaw_server.so: $(TARGET_x86)/$(RELEASE_TYPE)/libaw_server.so
47-
mkdir -p $$(dirname $@)
48-
ln -sfnv $$(pwd)/$^ $@
49-
$(JNI_x64)/libaw_server.so: $(TARGET_x64)/$(RELEASE_TYPE)/libaw_server.so
50-
mkdir -p $$(dirname $@)
51-
ln -sfnv $$(pwd)/$^ $@
52-
53-
# This target runs multiple times because it's matched multiple times, not sure how to fix
54-
$(RS_SRCDIR)/target/%/$(RELEASE_TYPE)/libaw_server.so: $(RS_SOURCES)
55-
echo $@
56-
cd aw-server-rust && env RUSTFLAGS="-C debuginfo=2 -Awarnings" bash compile-android.sh
57-
# Explanation of RUSTFLAGS:
58-
# `-Awarnings` allows all warnings, for cleaner output (warnings should be detected in aw-server-rust CI anyway)
59-
# `-C debuginfo=2` is to keep debug symbols, even in release builds (later stripped by gradle on production builds, non-stripped versions needed for stack resymbolizing with ndk-stack)
60-
14+
apk:
15+
env RUSTFLAGS="-C debuginfo=2 -Awarnings" TERM=xterm ./gradlew build
6116

6217
# aw-webui
6318

aw-server-rust

Submodule aw-server-rust updated 58 files

mobile/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ cargo {
8282

8383
tasks.whenTaskAdded { task ->
8484
// Build aw-server-rust
85+
// Doesn't work, chokes on building openssl-sys
8586
if ((task.name == 'javaPreCompileDebug' || task.name == 'javaPreCompileRelease')) {
8687
task.dependsOn 'cargoBuild'
8788
}

0 commit comments

Comments
 (0)