Skip to content

Commit 47a3983

Browse files
committed
android set cc in the makefile
1 parent 056ca1c commit 47a3983

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,11 @@ jobs:
3030
- os: ubuntu-latest
3131
arch: arm64-v8a
3232
name: android
33-
make:
34-
PLATFORM=android
35-
CC=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang
36-
ARCH=arm64-v8a
33+
make: PLATFORM=android ARCH=arm64-v8a
3734
- os: ubuntu-latest
3835
arch: x86_64
3936
name: android
40-
make:
41-
PLATFORM=android
42-
CC=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang
43-
ARCH=x86_64
37+
make: PLATFORM=android ARCH=x86_64
4438
sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
4539
- os: macos-latest
4640
name: ios
@@ -116,17 +110,17 @@ jobs:
116110
curl -O ${{ matrix.sqlite-amalgamation-zip }}
117111
unzip sqlite-amalgamation-*.zip
118112
export ${{ matrix.make }}
119-
$CC sqlite-amalgamation-*/shell.c sqlite-amalgamation-*/sqlite3.c -o sqlite3 -ldl
113+
$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.arch }}-linux-android26-clang sqlite-amalgamation-*/shell.c sqlite-amalgamation-*/sqlite3.c -o sqlite3 -ldl
120114
# remove unused folders to save up space
121115
rm -rf sqlite-amalgamation-*.zip sqlite-amalgamation-* openssl
122116
echo "::endgroup::"
123117
124118
echo "::group::prepare the test script"
125-
make test CC=$CC PLATFORM=$PLATFORM || echo "It should fail. Running remaining commands in the emulator"
119+
make test PLATFORM=$PLATFORM ARCH=$ARCH || echo "It should fail. Running remaining commands in the emulator"
126120
cat > commands.sh << EOF
127121
mv -f /data/local/tmp/sqlite3 /system/xbin
128122
cd /data/local/tmp
129-
$(make test CC=$CC PLATFORM=$PLATFORM ARCH=$ARCH -n)
123+
$(make test PLATFORM=$PLATFORM ARCH=$ARCH -n)
130124
EOF
131125
echo "::endgroup::"
132126

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ else ifeq ($(PLATFORM),android)
8282
ifneq (,$(filter $(ARCH),arm64 arm64-v8a))
8383
override ARCH := aarch64
8484
endif
85-
85+
86+
CC = $(BIN)/$(ARCH)-linux-android26-clang
8687
CURL_CONFIG = --host $(ARCH)-$(HOST)-android26 --with-openssl=$$ANDROID_NDK/toolchains/llvm/prebuilt/$(HOST)-x86_64/sysroot/usr LIBS="-lssl -lcrypto" AR=$(BIN)/llvm-ar AS=$(BIN)/llvm-as CC=$(BIN)/$(ARCH)-linux-android26-clang CXX=$(BIN)/$(ARCH)-linux-android26-clang++ LD=$(BIN)/ld RANLIB=$(BIN)/llvm-ranlib STRIP=$(BIN)/llvm-strip
8788
TARGET := $(DIST_DIR)/cloudsync.so
8889
LDFLAGS += -shared -lcrypto -lssl
@@ -257,13 +258,13 @@ clean:
257258
help:
258259
@echo "SQLite Sync Extension Makefile"
259260
@echo "Usage:"
260-
@echo " make [PLATFORM=platform] [target]"
261+
@echo " make [PLATFORM=platform] [ARCH=arch] [target]"
261262
@echo ""
262263
@echo "Platforms:"
263264
@echo " linux (default on Linux)"
264265
@echo " macos (default on macOS)"
265266
@echo " windows (default on Windows)"
266-
@echo " android (needs CC to be set to Android NDK's Clang compiler)"
267+
@echo " android (needs ARCH to be set to x86_64 or arm64-v8a)"
267268
@echo " ios (only on macOS)"
268269
@echo " isim (only on macOS)"
269270
@echo ""

0 commit comments

Comments
 (0)