Skip to content

Commit f26a828

Browse files
committed
Makefile: use "tailscale_go" build tag when using Tailscale's Go toolchain
Updates tailscale/tailscale#13527 Signed-off-by: Brad Fitzpatrick <[email protected]>
1 parent 9731afd commit f26a828

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ $(GOBIN)/gobind: go.mod go.sum
156156

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

build-tags.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
if [[ -z "$TOOLCHAIN_DIR" ]]; then
4+
# By default, if TOOLCHAIN_DIR is unset, we assume we're
5+
# using the Tailscale Go toolchain (github.com/tailscale/go)
6+
# at the revision specified by go.toolchain.rev. If so,
7+
# we tell our caller to use the "tailscale_go" build tag.
8+
echo "tailscale_go"
9+
else
10+
# Otherwise, if TOOLCHAIN_DIR is specified, we assume
11+
# we're F-Droid or something using a stock Go toolchain.
12+
# That's fine. But we don't set the tailscale_go build tag.
13+
# Return some no-op build tag that's non-empty for clarity
14+
# when debugging.
15+
echo "not_tailscale_go"
16+
fi

0 commit comments

Comments
 (0)