Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Combine apple and apple_future frameworks (#123)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
sbruens authored Aug 9, 2023
1 parent 4c5b7bf commit 30e3031
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 30e3031

Please sign in to comment.