Makefile: cleanup go mobile builds some

No need to build into /tmp, the go cache will handle this for us, we can
just use go run.

Updates tailscale/corp#18202

Signed-off-by: James Tucker <james@tailscale.com>
pull/222/head
James Tucker 8 months ago committed by James Tucker
parent b4f1989b67
commit 244221706f

@ -145,30 +145,15 @@ apk: $(DEBUG_APK)
run: install run: install
adb shell am start -n com.tailscale.ipn/com.tailscale.ipn.IPNActivity adb shell am start -n com.tailscale.ipn/com.tailscale.ipn.IPNActivity
GOMOBILE=/tmp/gopath/bin/gomobile
GOBIND=/tmp/gopath/bin/gobind
LIBTAILSCALE=android/libs/libtailscale.aar LIBTAILSCALE=android/libs/libtailscale.aar
LIBTAILSCALE_SOURCES=$(shell find libtailscale -name *.go) go.mod go.sum LIBTAILSCALE_SOURCES=$(shell find libtailscale -name *.go) go.mod go.sum
$(GOMOBILE): android/libs:
@echo "building gomobile" && \ mkdir -p android/libs
export GOPATH=/tmp/gopath && \
mkdir -p $$GOPATH && \ $(LIBTAILSCALE): android/libs $(LIBTAILSCALE_SOURCES)
export PATH=$$PATH:$$GOPATH/bin && \ go run golang.org/x/mobile/cmd/gomobile init
go install golang.org/x/mobile/cmd/gomobile@latest go run golang.org/x/mobile/cmd/gomobile bind -target android -androidapi 26 -o $@ ./libtailscale
$(GOBIND): $(GOMOBILE)
@export GOPATH=/tmp/gopath && \
$(GOMOBILE) init
gomobile: $(GOBIND)
$(LIBTAILSCALE): $(LIBTAILSCALE_SOURCES) $(GOBIND)
@export GOPATH=/tmp/gopath && \
export PATH=$$PATH:$$GOPATH/bin && \
$(GOMOBILE) bind -target android -androidapi 26 ./libtailscale && \
mkdir -p android/libs/ && \
cp libtailscale.aar $(LIBTAILSCALE)
libtailscale: $(LIBTAILSCALE) libtailscale: $(LIBTAILSCALE)

Loading…
Cancel
Save