Skip to content

Commit

Permalink
Makefile: use "tailscale_go" build tag when using Tailscale's Go tool…
Browse files Browse the repository at this point in the history
…chain

Updates tailscale/tailscale#13527
  • Loading branch information
bradfitz committed Sep 20, 2024
1 parent 9731afd commit 98eb426
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ $(GOBIN)/gobind: go.mod go.sum

$(LIBTAILSCALE): Makefile android/libs $(shell find libtailscale -name *.go) go.mod go.sum $(GOBIN)/gomobile
$(GOBIN)/gomobile bind -target android -androidapi 26 \
-tags "$$(./build-tags.sh)" \
-ldflags "$(FULL_LDFLAGS)" \
-o $@ ./libtailscale

Expand Down
16 changes: 16 additions & 0 deletions build-tags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

if [[ -z "$TOOLCHAIN_DIR" ]]; then
# By default, if TOOLCHAIN_DIR is unset, we assume we're
# using the Tailscale Go toolchain (github.com/tailscale/go)
# at the revision specified by go.toolchain.rev. If so,
# we tell our caller to use the "tailscale_go" build tag.
echo "tailscale_go"
else
# Otherwise, if TOOLCHAIN_DIR is specified, we assume
# we're F-Droid or something using a stock Go toolchain.
# That's fine. But we don't set the tailscale_go build tag.
# Return some no-op build tag that's non-empty for clarity
# when debugging.
echo "not_tailscale_go"
fi

0 comments on commit 98eb426

Please sign in to comment.