diff --git a/Makefile b/Makefile index 0d49b9e717..a6dbb2e11c 100644 --- a/Makefile +++ b/Makefile @@ -21,14 +21,13 @@ $(BUILDDIR)/android/tun2socks.aar: $(GOMOBILE) mkdir -p "$(BUILDDIR)/android" $(ANDROID_BUILD_CMD) -o "$@" $(IMPORT_PATH)/$(ROOT_PKG)/outline/tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/shadowsocks -# TODO(fortuna): -s strips symbols and is obsolete. Why are we using it? $(BUILDDIR)/ios/Tun2socks.xcframework: $(GOMOBILE) # -iosversion should match what outline-client supports. - $(GOBIND) -iosversion=11.0 -target=ios,iossimulator -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/shadowsocks + $(GOBIND) -iosversion=11.0 -target=ios,iossimulator -o $@ -ldflags '-w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/shadowsocks $(BUILDDIR)/macos/Tun2socks.xcframework: $(GOMOBILE) # MACOSX_DEPLOYMENT_TARGET and -iosversion should match what outline-client supports. - export MACOSX_DEPLOYMENT_TARGET=10.14; $(GOBIND) -iosversion=13.1 -target=macos,maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/shadowsocks + export MACOSX_DEPLOYMENT_TARGET=10.14; $(GOBIND) -iosversion=13.1 -target=macos,maccatalyst -o $@ -ldflags '-w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/shadowsocks apple: $(BUILDDIR)/apple/Tun2socks.xcframework @@ -38,7 +37,7 @@ $(BUILDDIR)/apple/Tun2socks.xcframework: $(BUILDDIR)/ios/Tun2socks.xcframework $ XGO=$(GOBIN)/xgo TUN2SOCKS_VERSION=v1.16.11 -XGO_LDFLAGS='-s -w -X main.version=$(TUN2SOCKS_VERSION)' +XGO_LDFLAGS='-w -X main.version=$(TUN2SOCKS_VERSION)' ELECTRON_PKG=$(ROOT_PKG)/outline/electron # TODO: build directly when on linux diff --git a/src/tun2socks/build.action.mjs b/src/tun2socks/build.action.mjs index 86d4fb8900..c91c9889e6 100644 --- a/src/tun2socks/build.action.mjs +++ b/src/tun2socks/build.action.mjs @@ -27,8 +27,18 @@ export async function main(...parameters) { const currentPlatform = os.platform() === 'win32' ? 'windows' : os.platform(); + if (targetPlatform === 'browser') { + return; + } + if (targetPlatform === currentPlatform && ['linux', 'windows'].includes(targetPlatform)) { - return spawnStream('go', 'build', '-o', `output/build/${targetPlatform}/tun2socks`, 'github.com/Jigsaw-Code/outline-client/src/tun2socks/outline/electron'); + return spawnStream( + 'go', + 'build', + '-o', + `output/build/${targetPlatform}/tun2socks`, + 'github.com/Jigsaw-Code/outline-client/src/tun2socks/outline/electron' + ); } await spawnStream('make', ['ios', 'macos', 'maccatalyst'].includes(targetPlatform) ? 'apple' : targetPlatform);