From 30e30313c55e4ab2a998939d603f99b0fca2c763 Mon Sep 17 00:00:00 2001 From: Sander Bruens Date: Wed, 9 Aug 2023 18:12:17 -0400 Subject: [PATCH] Combine `apple` and `apple_future` frameworks (#123) * Combine `apple` and `apple_future` frameworks so we can support older iOS versions and Catalyst at the same time. * Remove `apple_future` and `apple_legacy` and make `ios` and `macos` intermediary steps instead. * Use the target filename instead of hard-coding it. * Remove `apple_future` from workflow. --- .github/workflows/build_and_test.yml | 3 --- Makefile | 22 ++++++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0e6f7d3..68628b0 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -78,9 +78,6 @@ jobs: - name: Build for Apple platforms run: make apple - - - name: Build future Apple library - run: make apple_future android: name: Android Build diff --git a/Makefile b/Makefile index 0354a0b..3d1dbe8 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,9 @@ GOBIND=env PATH="$(GOBIN):$(PATH)" "$(GOMOBILE)" bind IMPORT_HOST=github.com IMPORT_PATH=$(IMPORT_HOST)/Jigsaw-Code/outline-go-tun2socks -.PHONY: android apple apple_future linux windows intra clean clean-all +.PHONY: android apple linux windows intra clean clean-all -all: intra android linux apple windows apple_future +all: intra android linux apple windows # Don't strip Android debug symbols so we can upload them to crash reporting tools. ANDROID_BUILD_CMD=$(GOBIND) -a -ldflags '-w' -target=android -tags android -work @@ -26,18 +26,20 @@ $(BUILDDIR)/android/tun2socks.aar: $(GOMOBILE) mkdir -p "$(BUILDDIR)/android" $(ANDROID_BUILD_CMD) -o "$@" $(IMPORT_PATH)/outline/tun2socks $(IMPORT_PATH)/outline/shadowsocks -apple: $(BUILDDIR)/apple/Tun2socks.xcframework +# 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)/outline/tun2socks $(IMPORT_PATH)/outline/shadowsocks -$(BUILDDIR)/apple/Tun2socks.xcframework: $(GOMOBILE) +$(BUILDDIR)/macos/Tun2socks.xcframework: $(GOMOBILE) # MACOSX_DEPLOYMENT_TARGET and -iosversion should match what outline-client supports. - # TODO(fortuna): -s strips symbols and is obsolete. Why are we using it? - export MACOSX_DEPLOYMENT_TARGET=10.14; $(GOBIND) -iosversion=11.0 -target=ios,iossimulator,macos -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/tun2socks $(IMPORT_PATH)/outline/shadowsocks - -apple_future: $(BUILDDIR)/apple_future/Tun2socks.xcframework + export MACOSX_DEPLOYMENT_TARGET=10.14; $(GOBIND) -iosversion=13.1 -target=macos,maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/tun2socks $(IMPORT_PATH)/outline/shadowsocks -$(BUILDDIR)/apple_future/Tun2socks.xcframework: $(GOMOBILE) - $(GOBIND) -iosversion=13.1 -target=ios,iossimulator,maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/tun2socks $(IMPORT_PATH)/outline/shadowsocks +apple: $(BUILDDIR)/apple/Tun2socks.xcframework +$(BUILDDIR)/apple/Tun2socks.xcframework: $(BUILDDIR)/ios/Tun2socks.xcframework $(BUILDDIR)/macos/Tun2socks.xcframework + find $^ -name "Tun2socks.framework" -type d | xargs -I {} echo " -framework {} " | \ + xargs xcrun xcodebuild -create-xcframework -output "$@" XGO=$(GOBIN)/xgo TUN2SOCKS_VERSION=v1.16.11