From f36ed9c15fe533e9e629a2217593aaa25d1bf710 Mon Sep 17 00:00:00 2001 From: Elena Doty Date: Wed, 11 Jan 2023 10:16:08 -0800 Subject: [PATCH 1/7] example catalyst makefile --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8acd8a9..c5ed2a6 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,9 @@ GOMOBILE=$(GOBIN)/gomobile GOBIND=env PATH="$(GOBIN):$(PATH)" "$(GOMOBILE)" bind IMPORT_PATH=github.com/Jigsaw-Code/outline-go-tun2socks -.PHONY: android apple linux windows intra clean clean-all +.PHONY: android apple catalyst linux windows intra clean clean-all -all: intra android linux apple windows +all: intra android linux apple catalyst 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 @@ -31,7 +31,13 @@ apple: $(BUILDDIR)/apple/Tun2socks.xcframework $(BUILDDIR)/apple/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=9.0 -target=ios,iossimulator,macos,maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/apple $(IMPORT_PATH)/outline/shadowsocks + 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/apple $(IMPORT_PATH)/outline/shadowsocks + +catalyst: $(BUILDDIR)/catalyst/Tun2socks.xcframework + +# build catalyst separately, then copy into the apple info.plist and tun2socks.framework/ products +$(BUILDDIR)/catalyst/Tun2socks.xcframework: $(GOMOBILE) + export MACOSX_DEPLOYMENT_TARGET=10.14; $(GOBIND) -iosversion=14.0 -target=maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/apple $(IMPORT_PATH)/outline/shadowsocks XGO=$(GOBIN)/xgo From 0a4b7ffd7dc98fe09c8d34d29d72ac6a489db225 Mon Sep 17 00:00:00 2001 From: Elena Doty Date: Wed, 11 Jan 2023 11:09:54 -0800 Subject: [PATCH 2/7] update readme --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 328e5b1..bcfcda5 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,15 @@ unzip build/android/tun2socks.aar 'jni/*' -d build/android ### Build ``` -make clean && make apple +make clean && make apple && make catalyst ``` -This will create `build/apple/Tun2socks.xcframework`. +This will create `build/apple/Tun2socks.xcframework` and `build/catalyst/Tun2socks.xcframework`. Because we want to continue supporting older iOS versions (pre-14.0), these frameworks need to be build separately then merged. To merge, do the following: + +1. Run `open build/apple/Tun2socks.xcframework/Info.plist && open build/catalyst/Tun2socks.xcframework/Info.plist` +2. Expand the `AvailableLibraries` dropdown in both files, and copy `Item 0` from the Catalyst file into the Apple file (insert it into the existing array). There should now be four items in the Apple plist AvailableLibraries field. Save the files and close. +3. Run `cp -r build/catalyst/Tun2socks.xcframework/ios-arm64_x86_64-maccatalyst build/apple/Tun2socks.xcframework/`. +4. If you run `ls build/apple/Tun2socks.xcframework/` there should now be five items: `Info.plist`, `ios-arm64`, `ios-arm64_x86_64-maccatalyst`, `macos-arm64_x86_64`, and `ios-arm64_x86_64-simulator`. +5. If needed, zip the apple directory: `cd build && zip -r apple.zip apple` ## Linux and Windows From f3f11385ee4b1a091f88af8f3c34b51c8ba39a42 Mon Sep 17 00:00:00 2001 From: Elena Doty Date: Sat, 14 Jan 2023 06:54:10 -0800 Subject: [PATCH 3/7] bump iOS version to 13.1 so that we can use catalyst in the same target --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bcfcda5..328e5b1 100644 --- a/README.md +++ b/README.md @@ -46,15 +46,9 @@ unzip build/android/tun2socks.aar 'jni/*' -d build/android ### Build ``` -make clean && make apple && make catalyst +make clean && make apple ``` -This will create `build/apple/Tun2socks.xcframework` and `build/catalyst/Tun2socks.xcframework`. Because we want to continue supporting older iOS versions (pre-14.0), these frameworks need to be build separately then merged. To merge, do the following: - -1. Run `open build/apple/Tun2socks.xcframework/Info.plist && open build/catalyst/Tun2socks.xcframework/Info.plist` -2. Expand the `AvailableLibraries` dropdown in both files, and copy `Item 0` from the Catalyst file into the Apple file (insert it into the existing array). There should now be four items in the Apple plist AvailableLibraries field. Save the files and close. -3. Run `cp -r build/catalyst/Tun2socks.xcframework/ios-arm64_x86_64-maccatalyst build/apple/Tun2socks.xcframework/`. -4. If you run `ls build/apple/Tun2socks.xcframework/` there should now be five items: `Info.plist`, `ios-arm64`, `ios-arm64_x86_64-maccatalyst`, `macos-arm64_x86_64`, and `ios-arm64_x86_64-simulator`. -5. If needed, zip the apple directory: `cd build && zip -r apple.zip apple` +This will create `build/apple/Tun2socks.xcframework`. ## Linux and Windows From 2f683ef4adf98b03cc9e10714d0b817ebed3608b Mon Sep 17 00:00:00 2001 From: Elena Doty Date: Sat, 14 Jan 2023 07:51:11 -0800 Subject: [PATCH 4/7] remove catalyst target from makefile --- Makefile | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index c5ed2a6..b4102bc 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,9 @@ GOMOBILE=$(GOBIN)/gomobile GOBIND=env PATH="$(GOBIN):$(PATH)" "$(GOMOBILE)" bind IMPORT_PATH=github.com/Jigsaw-Code/outline-go-tun2socks -.PHONY: android apple catalyst linux windows intra clean clean-all +.PHONY: android apple linux windows intra clean clean-all -all: intra android linux apple catalyst windows +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 @@ -31,13 +31,7 @@ apple: $(BUILDDIR)/apple/Tun2socks.xcframework $(BUILDDIR)/apple/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/apple $(IMPORT_PATH)/outline/shadowsocks - -catalyst: $(BUILDDIR)/catalyst/Tun2socks.xcframework - -# build catalyst separately, then copy into the apple info.plist and tun2socks.framework/ products -$(BUILDDIR)/catalyst/Tun2socks.xcframework: $(GOMOBILE) - export MACOSX_DEPLOYMENT_TARGET=10.14; $(GOBIND) -iosversion=14.0 -target=maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/apple $(IMPORT_PATH)/outline/shadowsocks + export MACOSX_DEPLOYMENT_TARGET=10.14; $(GOBIND) -iosversion=13.1 -target=ios,iossimulator,macos,maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/apple $(IMPORT_PATH)/outline/shadowsocks XGO=$(GOBIN)/xgo From 688be9a7aa34f1bed40bb58e2a57792fe598f5d1 Mon Sep 17 00:00:00 2001 From: Elena Doty Date: Wed, 18 Jan 2023 08:26:18 -0800 Subject: [PATCH 5/7] have two apple targets (one with catalyst) --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b4102bc..58cc563 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,9 @@ GOMOBILE=$(GOBIN)/gomobile GOBIND=env PATH="$(GOBIN):$(PATH)" "$(GOMOBILE)" bind IMPORT_PATH=github.com/Jigsaw-Code/outline-go-tun2socks -.PHONY: android apple linux windows intra clean clean-all +.PHONY: android apple apple_catalyst linux windows intra clean clean-all -all: intra android linux apple windows +all: intra android linux apple windows apple_catalyst # 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 @@ -25,10 +25,16 @@ $(BUILDDIR)/android/tun2socks.aar: $(GOMOBILE) mkdir -p "$(BUILDDIR)/android" $(ANDROID_BUILD_CMD) -o "$@" $(IMPORT_PATH)/outline/android $(IMPORT_PATH)/outline/shadowsocks - apple: $(BUILDDIR)/apple/Tun2socks.xcframework $(BUILDDIR)/apple/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/apple $(IMPORT_PATH)/outline/shadowsocks + +apple_catalyst: $(BUILDDIR)/apple_catalyst/Tun2socks.xcframework + +$(BUILDDIR)/apple_catalyst/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=13.1 -target=ios,iossimulator,macos,maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/apple $(IMPORT_PATH)/outline/shadowsocks From fb79422ff6729d4a2841afbc444b6be187584b3b Mon Sep 17 00:00:00 2001 From: Elena Doty Date: Wed, 18 Jan 2023 10:25:06 -0800 Subject: [PATCH 6/7] remove comments and macos from catalyst target --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 58cc563..a5ed97a 100644 --- a/Makefile +++ b/Makefile @@ -35,9 +35,7 @@ $(BUILDDIR)/apple/Tun2socks.xcframework: $(GOMOBILE) apple_catalyst: $(BUILDDIR)/apple_catalyst/Tun2socks.xcframework $(BUILDDIR)/apple_catalyst/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=13.1 -target=ios,iossimulator,macos,maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/apple $(IMPORT_PATH)/outline/shadowsocks + $(GOBIND) -iosversion=13.1 -target=ios,iossimulator,maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/outline/apple $(IMPORT_PATH)/outline/shadowsocks XGO=$(GOBIN)/xgo From 05386e4401463da264da2a98663a1e8b2757d269 Mon Sep 17 00:00:00 2001 From: Elena Doty Date: Wed, 18 Jan 2023 15:33:50 -0800 Subject: [PATCH 7/7] rename to apple_future --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a5ed97a..d3a0c3e 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,9 @@ GOMOBILE=$(GOBIN)/gomobile GOBIND=env PATH="$(GOBIN):$(PATH)" "$(GOMOBILE)" bind IMPORT_PATH=github.com/Jigsaw-Code/outline-go-tun2socks -.PHONY: android apple apple_catalyst linux windows intra clean clean-all +.PHONY: android apple apple_future linux windows intra clean clean-all -all: intra android linux apple windows apple_catalyst +all: intra android linux apple windows apple_future # 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 @@ -32,9 +32,9 @@ $(BUILDDIR)/apple/Tun2socks.xcframework: $(GOMOBILE) # 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/apple $(IMPORT_PATH)/outline/shadowsocks -apple_catalyst: $(BUILDDIR)/apple_catalyst/Tun2socks.xcframework +apple_future: $(BUILDDIR)/apple_future/Tun2socks.xcframework -$(BUILDDIR)/apple_catalyst/Tun2socks.xcframework: $(GOMOBILE) +$(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/apple $(IMPORT_PATH)/outline/shadowsocks