From 2f27a9c307788f7a9252cb033e1cc9e69a089d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 21 Mar 2025 15:51:58 +0800 Subject: [PATCH] release: Do not build tailscale on iOS and tvOS --- Makefile | 4 ++-- cmd/internal/build_libbox/main.go | 26 +++++++++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 68d19eef..47b7e458 100644 --- a/Makefile +++ b/Makefile @@ -233,8 +233,8 @@ lib: go run ./cmd/internal/build_libbox -target ios lib_install: - go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.4 - go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.4 + go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.5 + go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.5 docs: venv/bin/mkdocs serve diff --git a/cmd/internal/build_libbox/main.go b/cmd/internal/build_libbox/main.go index cad3662b..8f82ff36 100644 --- a/cmd/internal/build_libbox/main.go +++ b/cmd/internal/build_libbox/main.go @@ -45,6 +45,7 @@ var ( debugFlags []string sharedTags []string iosTags []string + memcTags []string debugTags []string ) @@ -58,8 +59,9 @@ func init() { sharedFlags = append(sharedFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag+" -s -w -buildid=") debugFlags = append(debugFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag) - sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_utls", "with_clash_api", "with_tailscale") + sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_utls", "with_clash_api") iosTags = append(iosTags, "with_dhcp", "with_low_memory", "with_conntrack") + memcTags = append(memcTags, "with_tailscale") debugTags = append(debugTags, "debug") } @@ -99,18 +101,19 @@ func buildAndroid() { "-javapkg=io.nekohasekai", "-libname=box", } + if !debugEnabled { args = append(args, sharedFlags...) } else { args = append(args, debugFlags...) } - args = append(args, "-tags") - if !debugEnabled { - args = append(args, strings.Join(sharedTags, ",")) - } else { - args = append(args, strings.Join(append(sharedTags, debugTags...), ",")) + tags := append(sharedTags, memcTags...) + if debugEnabled { + tags = append(tags, debugTags...) } + + args = append(args, "-tags", strings.Join(tags, ",")) args = append(args, "./experimental/libbox") command := exec.Command(build_shared.GoBinPath+"/gomobile", args...) @@ -148,7 +151,9 @@ func buildApple() { "-v", "-target", bindTarget, "-libname=box", + "-tags-macos=" + strings.Join(memcTags, ","), } + if !debugEnabled { args = append(args, sharedFlags...) } else { @@ -156,12 +161,11 @@ func buildApple() { } tags := append(sharedTags, iosTags...) - args = append(args, "-tags") - if !debugEnabled { - args = append(args, strings.Join(tags, ",")) - } else { - args = append(args, strings.Join(append(tags, debugTags...), ",")) + if debugEnabled { + tags = append(tags, debugTags...) } + + args = append(args, "-tags", strings.Join(tags, ",")) args = append(args, "./experimental/libbox") command := exec.Command(build_shared.GoBinPath+"/gomobile", args...)