feat(build): add Android build targets

Enable cross-compiling the launcher and main binary for Android (arm64), and exclude desktop systray code from Android builds.
This commit is contained in:
wenzirui 2026-03-23 16:36:04 +08:00
parent 054b55fdfc
commit 47f68e0f8a
3 changed files with 20 additions and 2 deletions

View file

@ -125,6 +125,17 @@ build-launcher:
@ln -sf picoclaw-launcher-$(PLATFORM)-$(ARCH) $(BUILD_DIR)/picoclaw-launcher
@echo "Build complete: $(BUILD_DIR)/picoclaw-launcher"
## build-launcher-android: Build picoclaw-launcher for Android ARM64
build-launcher-android:
@echo "Building picoclaw-launcher for android/arm64..."
@mkdir -p $(BUILD_DIR)
@if [ ! -f web/backend/dist/index.html ]; then \
echo "Building frontend..."; \
cd web/frontend && pnpm install && pnpm build:backend; \
fi
GOOS=android GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(BUILD_DIR)/picoclaw-launcher-android-arm64 ./web/backend
@echo "Build complete: $(BUILD_DIR)/picoclaw-launcher-android-arm64"
## build-whatsapp-native: Build with WhatsApp native (whatsmeow) support; larger binary
build-whatsapp-native: generate
## @echo "Building $(BINARY_NAME) with WhatsApp native for $(PLATFORM)/$(ARCH)..."
@ -169,6 +180,13 @@ build-linux-mipsle: generate
build-pi-zero: build-linux-arm build-linux-arm64
@echo "Pi Zero 2 W builds: $(BUILD_DIR)/$(BINARY_NAME)-linux-arm (32-bit), $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 (64-bit)"
## build-android-arm64: Build for Android ARM64
build-android: generate
@echo "Building for android/arm64..."
@mkdir -p $(BUILD_DIR)
GOOS=android GOARCH=arm64 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-android-arm64 ./$(CMD_DIR)
@echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)-android-arm64"
## build-all: Build picoclaw for all platforms
build-all: generate
@echo "Building for multiple platforms..."

View file

@ -1,4 +1,4 @@
//go:build (!darwin && !freebsd) || cgo
//go:build (!darwin && !freebsd && !android) || cgo
package main

View file

@ -1,4 +1,4 @@
//go:build (darwin || freebsd) && !cgo
//go:build (darwin || freebsd || android) && !cgo
package main