Browse Source

Compile dependency binaries from source code

Kebin Liu 2 years ago
parent
commit
a902e20330

+ 7 - 0
.gitignore

@@ -69,3 +69,10 @@ profile
 Carthage/Build
 Carthage/Build
 
 
 IDEWorkspaceChecks.plist
 IDEWorkspaceChecks.plist
+
+####
+# Dependencies
+deps/dist
+deps/pcre*
+deps/libev*
+deps/privoxy*

+ 30 - 0
.gitmodules

@@ -0,0 +1,30 @@
+[submodule "shadowsocks-libev"]
+	path = deps/shadowsocks-libev
+	url = https://github.com/shadowsocks/shadowsocks-libev
+[submodule "libsodium"]
+	path = deps/libsodium
+	url = https://github.com/jedisct1/libsodium
+[submodule "mbedtls"]
+	path = deps/mbedtls
+	url = https://github.com/Mbed-TLS/mbedtls
+[submodule "c-ares"]
+	path = deps/c-ares
+	url = https://github.com/c-ares/c-ares
+[submodule "deps/shadowsocks-libev"]
+	path = deps/shadowsocks-libev
+	url = https://github.com/shadowsocks/shadowsocks-libev
+[submodule "deps/libsodium"]
+	path = deps/libsodium
+	url = https://github.com/jedisct1/libsodium
+[submodule "deps/mbedtls"]
+	path = deps/mbedtls
+	url = https://github.com/Mbed-TLS/mbedtls
+[submodule "deps/c-ares"]
+	path = deps/c-ares
+	url = https://github.com/c-ares/c-ares
+[submodule "deps/v2ray-plugin"]
+	path = deps/v2ray-plugin
+	url = https://github.com/shadowsocks/v2ray-plugin
+[submodule "deps/kcptun"]
+	path = deps/kcptun
+	url = https://github.com/xtaci/kcptun

+ 9 - 7
LaunchHelper/LaunchHelper.xcodeproj/project.pbxproj

@@ -102,7 +102,7 @@
 				TargetAttributes = {
 				TargetAttributes = {
 					9B9F138C1E8A282C00DE4794 = {
 					9B9F138C1E8A282C00DE4794 = {
 						CreatedOnToolsVersion = 8.2.1;
 						CreatedOnToolsVersion = 8.2.1;
-						ProvisioningStyle = Manual;
+						ProvisioningStyle = Automatic;
 					};
 					};
 				};
 				};
 			};
 			};
@@ -272,13 +272,14 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				CODE_SIGN_IDENTITY = "-";
-				CODE_SIGN_STYLE = Manual;
+				CODE_SIGN_IDENTITY = "Apple Development";
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
+				CODE_SIGN_STYLE = Automatic;
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				DEVELOPMENT_TEAM = "";
 				DEVELOPMENT_TEAM = "";
 				INFOPLIST_FILE = LaunchHelper/Info.plist;
 				INFOPLIST_FILE = LaunchHelper/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.12;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.qiuyuzhou.ShadowsocksX-NG.LaunchHelper";
 				PRODUCT_BUNDLE_IDENTIFIER = "com.qiuyuzhou.ShadowsocksX-NG.LaunchHelper";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
@@ -290,13 +291,14 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				CODE_SIGN_IDENTITY = "-";
-				CODE_SIGN_STYLE = Manual;
+				CODE_SIGN_IDENTITY = "Apple Development";
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
+				CODE_SIGN_STYLE = Automatic;
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				DEVELOPMENT_TEAM = "";
 				DEVELOPMENT_TEAM = "";
 				INFOPLIST_FILE = LaunchHelper/Info.plist;
 				INFOPLIST_FILE = LaunchHelper/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.12;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.qiuyuzhou.ShadowsocksX-NG.LaunchHelper";
 				PRODUCT_BUNDLE_IDENTIFIER = "com.qiuyuzhou.ShadowsocksX-NG.LaunchHelper";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";

+ 29 - 0
Makefile

@@ -0,0 +1,29 @@
+.PHONY: all
+all: debug
+	echo "Deps build done"
+
+.PHONY: debug
+debug: deps/dist
+	xcodebuild -workspace ShadowsocksX-NG.xcworkspace -scheme ShadowsocksX-NG -configuration Debug SYMROOT=$${PWD}/build
+
+.PHONY: release
+release: deps/dist
+	xcodebuild -workspace ShadowsocksX-NG.xcworkspace -scheme ShadowsocksX-NG -configuration Release SYMROOT=$${PWD}/build
+
+.PHONY: debug-dmg release-dmg
+debug-dmg release-dmg: TARGET = $(subst -dmg,,$@)
+debug-dmg release-dmg:
+	t="$(TARGET)" && t="`tr '[:lower:]' '[:upper:]' <<< $${t:0:1}`$${t:1}" \
+	  && rm -rf build/$${t}/ShadowsocksX-NG/ \
+	  && mkdir build/$${t}/ShadowsocksX-NG \
+	  && cp -r build/$${t}/ShadowsocksX-NG.app build/$${t}/ShadowsocksX-NG/ \
+	  && ln -s /Applications build/$${t}/ShadowsocksX-NG/Applications \
+	  && hdiutil create build/$${t}/ShadowsocksX-NG.dmg -ov -volname "ShadowsocksX-NG" -fs HFS+ -srcfolder build/$${t}/ShadowsocksX-NG/ \
+          && rm -rf build/$${t}/ShadowsocksX-NG/
+
+deps/dist:
+	$(MAKE) -C deps
+
+.PHONY: clean
+clean:
+	$(MAKE) -C deps clean

+ 18 - 27
ShadowsocksX-NG.xcodeproj/project.pbxproj

@@ -18,7 +18,6 @@
 		9B2491B41D0ACC3A003BBECC /* PreferencesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B2491B61D0ACC3A003BBECC /* PreferencesWindowController.xib */; };
 		9B2491B41D0ACC3A003BBECC /* PreferencesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B2491B61D0ACC3A003BBECC /* PreferencesWindowController.xib */; };
 		9B3546721E802B1200B510B4 /* ToastWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B3546701E802B1200B510B4 /* ToastWindowController.swift */; };
 		9B3546721E802B1200B510B4 /* ToastWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B3546701E802B1200B510B4 /* ToastWindowController.swift */; };
 		9B3546731E802B1200B510B4 /* ToastWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B3546711E802B1200B510B4 /* ToastWindowController.xib */; };
 		9B3546731E802B1200B510B4 /* ToastWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B3546711E802B1200B510B4 /* ToastWindowController.xib */; };
-		9B3F7BFF1E82BF5B00C68B75 /* libev.4.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9B3F7BF71E82BF2D00C68B75 /* libev.4.dylib */; };
 		9B3FFF0D1D05FEB30019A709 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF0C1D05FEB30019A709 /* Utils.swift */; };
 		9B3FFF0D1D05FEB30019A709 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF0C1D05FEB30019A709 /* Utils.swift */; };
 		9B3FFF141D0705810019A709 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF131D0705810019A709 /* Notifications.swift */; };
 		9B3FFF141D0705810019A709 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF131D0705810019A709 /* Notifications.swift */; };
 		9B3FFF171D072FDE0019A709 /* LaunchAtLoginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF161D072FDE0019A709 /* LaunchAtLoginController.m */; };
 		9B3FFF171D072FDE0019A709 /* LaunchAtLoginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3FFF161D072FDE0019A709 /* LaunchAtLoginController.m */; };
@@ -41,7 +40,6 @@
 		9B5DD7B02683A354005EFEF7 /* ShadowsocksX_NGTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5DD7AF2683A354005EFEF7 /* ShadowsocksX_NGTests.swift */; };
 		9B5DD7B02683A354005EFEF7 /* ShadowsocksX_NGTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5DD7AF2683A354005EFEF7 /* ShadowsocksX_NGTests.swift */; };
 		9B5DD7B82683A369005EFEF7 /* ServerProfileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5DD7B72683A369005EFEF7 /* ServerProfileTests.swift */; };
 		9B5DD7B82683A369005EFEF7 /* ServerProfileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B5DD7B72683A369005EFEF7 /* ServerProfileTests.swift */; };
 		9B6BF9541E27B2570061B9A7 /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B6BF9531E27B2570061B9A7 /* ServiceManagement.framework */; };
 		9B6BF9541E27B2570061B9A7 /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B6BF9531E27B2570061B9A7 /* ServiceManagement.framework */; };
-		9B7297E7214D69C300FD24AA /* libmbedcrypto.2.12.0.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9B7297E5214D68F800FD24AA /* libmbedcrypto.2.12.0.dylib */; };
 		9B7297EA214D7C6B00FD24AA /* ShareServerProfilesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7297E8214D7C6B00FD24AA /* ShareServerProfilesWindowController.swift */; };
 		9B7297EA214D7C6B00FD24AA /* ShareServerProfilesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B7297E8214D7C6B00FD24AA /* ShareServerProfilesWindowController.swift */; };
 		9B7297EC214DA88A00FD24AA /* ShareServerProfilesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B7297EE214DA88A00FD24AA /* ShareServerProfilesWindowController.xib */; };
 		9B7297EC214DA88A00FD24AA /* ShareServerProfilesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9B7297EE214DA88A00FD24AA /* ShareServerProfilesWindowController.xib */; };
 		9B72FB62232782A300C6AAAE /* ImportWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B72FB60232782A300C6AAAE /* ImportWindowController.swift */; };
 		9B72FB62232782A300C6AAAE /* ImportWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B72FB60232782A300C6AAAE /* ImportWindowController.swift */; };
@@ -52,7 +50,6 @@
 		9B84DAED2163A72F00DFF068 /* Diagnose.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B84DAEC2163A72F00DFF068 /* Diagnose.swift */; };
 		9B84DAED2163A72F00DFF068 /* Diagnose.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B84DAEC2163A72F00DFF068 /* Diagnose.swift */; };
 		9B86459D1E7C2CAD00A84029 /* ProxyInterfacesViewCtrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B86459C1E7C2CAD00A84029 /* ProxyInterfacesViewCtrl.swift */; };
 		9B86459D1E7C2CAD00A84029 /* ProxyInterfacesViewCtrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B86459C1E7C2CAD00A84029 /* ProxyInterfacesViewCtrl.swift */; };
 		9B9B9966236992CA0036600F /* v2ray-plugin in Resources */ = {isa = PBXBuildFile; fileRef = 9B9B9965236992C90036600F /* v2ray-plugin */; };
 		9B9B9966236992CA0036600F /* v2ray-plugin in Resources */ = {isa = PBXBuildFile; fileRef = 9B9B9965236992C90036600F /* v2ray-plugin */; };
-		9B9CBCAF1E263B1600FC61AA /* libpcre.1.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9B9CBCAD1E263A6600FC61AA /* libpcre.1.dylib */; };
 		9B9F13A71E8A28B300DE4794 /* LaunchHelper.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9B9F13A61E8A282D00DE4794 /* LaunchHelper.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
 		9B9F13A71E8A28B300DE4794 /* LaunchHelper.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9B9F13A61E8A282D00DE4794 /* LaunchHelper.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
 		9BA04B231D23D5A5005AAD7F /* ProxyConfTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */; };
 		9BA04B231D23D5A5005AAD7F /* ProxyConfTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */; };
 		9BAA662723295FAB00F5CC99 /* icons8-Eye Filled-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 9BAA661723295FAB00F5CC99 /* icons8-Eye Filled-50.png */; };
 		9BAA662723295FAB00F5CC99 /* icons8-Eye Filled-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 9BAA661723295FAB00F5CC99 /* icons8-Eye Filled-50.png */; };
@@ -76,8 +73,6 @@
 		9BB706A71D1B982300551F0E /* SWBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BB706A51D1B982300551F0E /* SWBApplication.m */; };
 		9BB706A71D1B982300551F0E /* SWBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BB706A51D1B982300551F0E /* SWBApplication.m */; };
 		9BBE7B751F508A0E00E8FFE5 /* fix_dir_owner.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BBE7B711F50790500E8FFE5 /* fix_dir_owner.sh */; };
 		9BBE7B751F508A0E00E8FFE5 /* fix_dir_owner.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BBE7B711F50790500E8FFE5 /* fix_dir_owner.sh */; };
 		9BC70EDC1D2E3E3100EDA4CA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9B172A6C1D0ADDDD00B87B9A /* Localizable.strings */; };
 		9BC70EDC1D2E3E3100EDA4CA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9B172A6C1D0ADDDD00B87B9A /* Localizable.strings */; };
-		9BCB1D6C20A15B0E005BABE7 /* libsodium.23.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9B5AA09F209C100C00E8B659 /* libsodium.23.dylib */; };
-		9BCB1D6D20A15B0E005BABE7 /* libcares.2.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 9B5AA0A2209C103900E8B659 /* libcares.2.dylib */; };
 		9BEEF0691D04D4D500FC52B3 /* install_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0651D04CB8500FC52B3 /* install_ss_local.sh */; };
 		9BEEF0691D04D4D500FC52B3 /* install_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0651D04CB8500FC52B3 /* install_ss_local.sh */; };
 		9BEEF06A1D04D4D500FC52B3 /* start_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0661D04CE8D00FC52B3 /* start_ss_local.sh */; };
 		9BEEF06A1D04D4D500FC52B3 /* start_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0661D04CE8D00FC52B3 /* start_ss_local.sh */; };
 		9BEEF06B1D04D4D500FC52B3 /* stop_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0671D04CE9A00FC52B3 /* stop_ss_local.sh */; };
 		9BEEF06B1D04D4D500FC52B3 /* stop_ss_local.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BEEF0671D04CE9A00FC52B3 /* stop_ss_local.sh */; };
@@ -166,7 +161,6 @@
 		9B2491B51D0ACC3A003BBECC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreferencesWindowController.xib; sourceTree = "<group>"; };
 		9B2491B51D0ACC3A003BBECC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PreferencesWindowController.xib; sourceTree = "<group>"; };
 		9B3546701E802B1200B510B4 /* ToastWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastWindowController.swift; sourceTree = "<group>"; };
 		9B3546701E802B1200B510B4 /* ToastWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToastWindowController.swift; sourceTree = "<group>"; };
 		9B3546711E802B1200B510B4 /* ToastWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ToastWindowController.xib; sourceTree = "<group>"; };
 		9B3546711E802B1200B510B4 /* ToastWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ToastWindowController.xib; sourceTree = "<group>"; };
-		9B3F7BF71E82BF2D00C68B75 /* libev.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libev.4.dylib; sourceTree = "<group>"; };
 		9B3FFF0C1D05FEB30019A709 /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
 		9B3FFF0C1D05FEB30019A709 /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
 		9B3FFF131D0705810019A709 /* Notifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = "<group>"; };
 		9B3FFF131D0705810019A709 /* Notifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Notifications.swift; sourceTree = "<group>"; };
 		9B3FFF151D072FDE0019A709 /* LaunchAtLoginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchAtLoginController.h; sourceTree = "<group>"; };
 		9B3FFF151D072FDE0019A709 /* LaunchAtLoginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchAtLoginController.h; sourceTree = "<group>"; };
@@ -193,8 +187,6 @@
 		9B5831F51E7302F8009D5B7D /* ShortcutsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShortcutsController.m; sourceTree = "<group>"; };
 		9B5831F51E7302F8009D5B7D /* ShortcutsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShortcutsController.m; sourceTree = "<group>"; };
 		9B5831FA1E73098F009D5B7D /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
 		9B5831FA1E73098F009D5B7D /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
 		9B5831FD1E741969009D5B7D /* PreferencesWinController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesWinController.swift; sourceTree = "<group>"; };
 		9B5831FD1E741969009D5B7D /* PreferencesWinController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesWinController.swift; sourceTree = "<group>"; };
-		9B5AA09F209C100C00E8B659 /* libsodium.23.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libsodium.23.dylib; sourceTree = "<group>"; };
-		9B5AA0A2209C103900E8B659 /* libcares.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libcares.2.dylib; sourceTree = "<group>"; };
 		9B5AA0AB209C43C200E8B659 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
 		9B5AA0AB209C43C200E8B659 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
 		9B5D13272154A50700F99F03 /* install_kcptun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = install_kcptun.sh; sourceTree = "<group>"; };
 		9B5D13272154A50700F99F03 /* install_kcptun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = install_kcptun.sh; sourceTree = "<group>"; };
 		9B5DD7AD2683A354005EFEF7 /* ShadowsocksX-NGTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ShadowsocksX-NGTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
 		9B5DD7AD2683A354005EFEF7 /* ShadowsocksX-NGTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ShadowsocksX-NGTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -202,7 +194,6 @@
 		9B5DD7B12683A354005EFEF7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		9B5DD7B12683A354005EFEF7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		9B5DD7B72683A369005EFEF7 /* ServerProfileTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServerProfileTests.swift; sourceTree = "<group>"; };
 		9B5DD7B72683A369005EFEF7 /* ServerProfileTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServerProfileTests.swift; sourceTree = "<group>"; };
 		9B6BF9531E27B2570061B9A7 /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; };
 		9B6BF9531E27B2570061B9A7 /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; };
-		9B7297E5214D68F800FD24AA /* libmbedcrypto.2.12.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libmbedcrypto.2.12.0.dylib; sourceTree = "<group>"; };
 		9B7297E8214D7C6B00FD24AA /* ShareServerProfilesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareServerProfilesWindowController.swift; sourceTree = "<group>"; };
 		9B7297E8214D7C6B00FD24AA /* ShareServerProfilesWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareServerProfilesWindowController.swift; sourceTree = "<group>"; };
 		9B7297ED214DA88A00FD24AA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ShareServerProfilesWindowController.xib; sourceTree = "<group>"; };
 		9B7297ED214DA88A00FD24AA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ShareServerProfilesWindowController.xib; sourceTree = "<group>"; };
 		9B7297F0214DA89000FD24AA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/ShareServerProfilesWindowController.strings"; sourceTree = "<group>"; };
 		9B7297F0214DA89000FD24AA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/ShareServerProfilesWindowController.strings"; sourceTree = "<group>"; };
@@ -215,7 +206,6 @@
 		9B84DAEC2163A72F00DFF068 /* Diagnose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Diagnose.swift; sourceTree = "<group>"; };
 		9B84DAEC2163A72F00DFF068 /* Diagnose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Diagnose.swift; sourceTree = "<group>"; };
 		9B86459C1E7C2CAD00A84029 /* ProxyInterfacesViewCtrl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProxyInterfacesViewCtrl.swift; sourceTree = "<group>"; };
 		9B86459C1E7C2CAD00A84029 /* ProxyInterfacesViewCtrl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProxyInterfacesViewCtrl.swift; sourceTree = "<group>"; };
 		9B9B9965236992C90036600F /* v2ray-plugin */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = "v2ray-plugin"; sourceTree = "<group>"; };
 		9B9B9965236992C90036600F /* v2ray-plugin */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = "v2ray-plugin"; sourceTree = "<group>"; };
-		9B9CBCAD1E263A6600FC61AA /* libpcre.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libpcre.1.dylib; sourceTree = "<group>"; };
 		9B9F13A11E8A282C00DE4794 /* LaunchHelper.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LaunchHelper.xcodeproj; path = LaunchHelper/LaunchHelper.xcodeproj; sourceTree = "<group>"; };
 		9B9F13A11E8A282C00DE4794 /* LaunchHelper.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LaunchHelper.xcodeproj; path = LaunchHelper/LaunchHelper.xcodeproj; sourceTree = "<group>"; };
 		9BA04B211D23D5A5005AAD7F /* ProxyConfTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyConfTool.h; sourceTree = "<group>"; };
 		9BA04B211D23D5A5005AAD7F /* ProxyConfTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyConfTool.h; sourceTree = "<group>"; };
 		9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProxyConfTool.m; sourceTree = "<group>"; };
 		9BA04B221D23D5A5005AAD7F /* ProxyConfTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProxyConfTool.m; sourceTree = "<group>"; };
@@ -428,11 +418,6 @@
 		9B5AA0A9209C41EC00E8B659 /* ss-local */ = {
 		9B5AA0A9209C41EC00E8B659 /* ss-local */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
-				9B7297E5214D68F800FD24AA /* libmbedcrypto.2.12.0.dylib */,
-				9B3F7BF71E82BF2D00C68B75 /* libev.4.dylib */,
-				9B5AA09F209C100C00E8B659 /* libsodium.23.dylib */,
-				9B5AA0A2209C103900E8B659 /* libcares.2.dylib */,
-				9B9CBCAD1E263A6600FC61AA /* libpcre.1.dylib */,
 				9B07EFA61D048BBB0052D9DF /* ss-local */,
 				9B07EFA61D048BBB0052D9DF /* ss-local */,
 				9BEEF0651D04CB8500FC52B3 /* install_ss_local.sh */,
 				9BEEF0651D04CB8500FC52B3 /* install_ss_local.sh */,
 				9BEEF0661D04CE8D00FC52B3 /* start_ss_local.sh */,
 				9BEEF0661D04CE8D00FC52B3 /* start_ss_local.sh */,
@@ -596,6 +581,7 @@
 		9B0BFFDD1D0460A70040E62B /* Project object */ = {
 		9B0BFFDD1D0460A70040E62B /* Project object */ = {
 			isa = PBXProject;
 			isa = PBXProject;
 			attributes = {
 			attributes = {
+				BuildIndependentTargetsInParallel = NO;
 				LastSwiftUpdateCheck = 1250;
 				LastSwiftUpdateCheck = 1250;
 				LastUpgradeCheck = 1250;
 				LastUpgradeCheck = 1250;
 				ORGANIZATIONNAME = qiuyuzhou;
 				ORGANIZATIONNAME = qiuyuzhou;
@@ -603,11 +589,11 @@
 					9B0BFFE41D0460A70040E62B = {
 					9B0BFFE41D0460A70040E62B = {
 						CreatedOnToolsVersion = 7.3.1;
 						CreatedOnToolsVersion = 7.3.1;
 						LastSwiftMigration = 1250;
 						LastSwiftMigration = 1250;
-						ProvisioningStyle = Manual;
+						ProvisioningStyle = Automatic;
 					};
 					};
 					9B3FFF431D09CD3B0019A709 = {
 					9B3FFF431D09CD3B0019A709 = {
 						CreatedOnToolsVersion = 7.3.1;
 						CreatedOnToolsVersion = 7.3.1;
-						ProvisioningStyle = Manual;
+						ProvisioningStyle = Automatic;
 					};
 					};
 					9B5DD7AC2683A354005EFEF7 = {
 					9B5DD7AC2683A354005EFEF7 = {
 						CreatedOnToolsVersion = 12.5.1;
 						CreatedOnToolsVersion = 12.5.1;
@@ -660,19 +646,14 @@
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
 				9B5D132A2154A62600F99F03 /* install_kcptun.sh in Resources */,
 				9B5D132A2154A62600F99F03 /* install_kcptun.sh in Resources */,
-				9B7297E7214D69C300FD24AA /* libmbedcrypto.2.12.0.dylib in Resources */,
-				9BCB1D6C20A15B0E005BABE7 /* libsodium.23.dylib in Resources */,
-				9BCB1D6D20A15B0E005BABE7 /* libcares.2.dylib in Resources */,
 				9BBE7B751F508A0E00E8FFE5 /* fix_dir_owner.sh in Resources */,
 				9BBE7B751F508A0E00E8FFE5 /* fix_dir_owner.sh in Resources */,
 				9BAA66382329636200F5CC99 /* user-privoxy.config in Resources */,
 				9BAA66382329636200F5CC99 /* user-privoxy.config in Resources */,
-				9B3F7BFF1E82BF5B00C68B75 /* libev.4.dylib in Resources */,
 				9BAA662D23295FAC00F5CC99 /* icons8-Blind Filled-50.png in Resources */,
 				9BAA662D23295FAC00F5CC99 /* icons8-Blind Filled-50.png in Resources */,
 				9BAA663623295FAC00F5CC99 /* menu_g_icon.png in Resources */,
 				9BAA663623295FAC00F5CC99 /* menu_g_icon.png in Resources */,
 				9BAA662E23295FAC00F5CC99 /* menu_p_icon@2x.png in Resources */,
 				9BAA662E23295FAC00F5CC99 /* menu_p_icon@2x.png in Resources */,
 				1C82DBAA1FA96FB600B32551 /* install_simple_obfs.sh in Resources */,
 				1C82DBAA1FA96FB600B32551 /* install_simple_obfs.sh in Resources */,
 				9B74B5E9232949B100DEA386 /* ImportWindowController.xib in Resources */,
 				9B74B5E9232949B100DEA386 /* ImportWindowController.xib in Resources */,
 				9BAA663523295FAC00F5CC99 /* virtual-server-icon-3.png in Resources */,
 				9BAA663523295FAC00F5CC99 /* virtual-server-icon-3.png in Resources */,
-				9B9CBCAF1E263B1600FC61AA /* libpcre.1.dylib in Resources */,
 				9B3FFF541D09E2D10019A709 /* proxy_conf_helper in Resources */,
 				9B3FFF541D09E2D10019A709 /* proxy_conf_helper in Resources */,
 				9BAA662723295FAB00F5CC99 /* icons8-Eye Filled-50.png in Resources */,
 				9BAA662723295FAB00F5CC99 /* icons8-Eye Filled-50.png in Resources */,
 				9BEEF0691D04D4D500FC52B3 /* install_ss_local.sh in Resources */,
 				9BEEF0691D04D4D500FC52B3 /* install_ss_local.sh in Resources */,
@@ -1041,7 +1022,8 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_IDENTITY = "-";
 				CODE_SIGN_IDENTITY = "-";
-				CODE_SIGN_STYLE = Manual;
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
+				CODE_SIGN_STYLE = Automatic;
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				DEVELOPMENT_TEAM = "";
 				DEVELOPMENT_TEAM = "";
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
@@ -1050,6 +1032,7 @@
 					"$(SRCROOT)/libipset/include/",
 					"$(SRCROOT)/libipset/include/",
 				);
 				);
 				INFOPLIST_FILE = "ShadowsocksX-NG/Info.plist";
 				INFOPLIST_FILE = "ShadowsocksX-NG/Info.plist";
+				INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
 				LIBRARY_SEARCH_PATHS = (
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",
@@ -1076,7 +1059,8 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_IDENTITY = "-";
 				CODE_SIGN_IDENTITY = "-";
-				CODE_SIGN_STYLE = Manual;
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
+				CODE_SIGN_STYLE = Automatic;
 				COMBINE_HIDPI_IMAGES = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				DEVELOPMENT_TEAM = "";
 				DEVELOPMENT_TEAM = "";
 				HEADER_SEARCH_PATHS = (
 				HEADER_SEARCH_PATHS = (
@@ -1085,6 +1069,7 @@
 					"$(SRCROOT)/libipset/include/",
 					"$(SRCROOT)/libipset/include/",
 				);
 				);
 				INFOPLIST_FILE = "ShadowsocksX-NG/Info.plist";
 				INFOPLIST_FILE = "ShadowsocksX-NG/Info.plist";
+				INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
 				LIBRARY_SEARCH_PATHS = (
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",
@@ -1107,9 +1092,11 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = B4E6A97CA843F3943524B686 /* Pods-proxy_conf_helper.debug.xcconfig */;
 			baseConfigurationReference = B4E6A97CA843F3943524B686 /* Pods-proxy_conf_helper.debug.xcconfig */;
 			buildSettings = {
 			buildSettings = {
-				CODE_SIGN_IDENTITY = "-";
-				CODE_SIGN_STYLE = Manual;
+				CODE_SIGN_IDENTITY = "Apple Development";
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
+				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = "";
 				DEVELOPMENT_TEAM = "";
+				MACOSX_DEPLOYMENT_TARGET = 10.12;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SKIP_INSTALL = YES;
 				SKIP_INSTALL = YES;
@@ -1120,9 +1107,13 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 297AF069022A197FD8E9D226 /* Pods-proxy_conf_helper.release.xcconfig */;
 			baseConfigurationReference = 297AF069022A197FD8E9D226 /* Pods-proxy_conf_helper.release.xcconfig */;
 			buildSettings = {
 			buildSettings = {
-				CODE_SIGN_IDENTITY = "-";
+				CODE_SIGN_IDENTITY = "Apple Development";
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
+				CODE_SIGN_STYLE = Automatic;
 				DEVELOPMENT_TEAM = "";
 				DEVELOPMENT_TEAM = "";
+				MACOSX_DEPLOYMENT_TARGET = 10.12;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				PROVISIONING_PROFILE_SPECIFIER = "";
 				SKIP_INSTALL = YES;
 				SKIP_INSTALL = YES;
 			};
 			};
 			name = Release;
 			name = Release;

+ 10 - 11
ShadowsocksX-NG/LaunchAgentUtils.swift

@@ -8,10 +8,10 @@
 
 
 import Foundation
 import Foundation
 
 
-let SS_LOCAL_VERSION = "3.2.5"
-let KCPTUN_CLIENT_VERSION = "v20190905_1"
-let V2RAY_PLUGIN_VERSION = "v1.3.1-9-gddd7ab4"
-let PRIVOXY_VERSION = "3.0.26.static"
+//let SS_LOCAL_VERSION = "3.2.5"
+//let KCPTUN_CLIENT_VERSION = "v20190905_1"
+//let V2RAY_PLUGIN_VERSION = "v1.3.1-9-gddd7ab4"
+//let PRIVOXY_VERSION = "3.0.26.static"
 let SIMPLE_OBFS_VERSION = "0.0.5_1"
 let SIMPLE_OBFS_VERSION = "0.0.5_1"
 let APP_SUPPORT_DIR = "/Library/Application Support/ShadowsocksX-NG/"
 let APP_SUPPORT_DIR = "/Library/Application Support/ShadowsocksX-NG/"
 let USER_CONFIG_DIR = "/.ShadowsocksX-NG/"
 let USER_CONFIG_DIR = "/.ShadowsocksX-NG/"
@@ -34,7 +34,7 @@ func getFileSHA1Sum(_ filepath: String) -> String {
 //  MARK: sslocal
 //  MARK: sslocal
 
 
 func generateSSLocalLauchAgentPlist() -> Bool {
 func generateSSLocalLauchAgentPlist() -> Bool {
-    let sslocalPath = NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local-latest/ss-local"
+    let sslocalPath = NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local/ss-local"
     let logFilePath = NSHomeDirectory() + "/Library/Logs/ss-local.log"
     let logFilePath = NSHomeDirectory() + "/Library/Logs/ss-local.log"
     let launchAgentDirPath = NSHomeDirectory() + LAUNCH_AGENT_DIR
     let launchAgentDirPath = NSHomeDirectory() + LAUNCH_AGENT_DIR
     let plistFilepath = launchAgentDirPath + LAUNCH_AGENT_CONF_SSLOCAL_NAME
     let plistFilepath = launchAgentDirPath + LAUNCH_AGENT_CONF_SSLOCAL_NAME
@@ -62,7 +62,7 @@ func generateSSLocalLauchAgentPlist() -> Bool {
     
     
     // For a complete listing of the keys, see the launchd.plist manual page.
     // For a complete listing of the keys, see the launchd.plist manual page.
     let dyld_library_paths = [
     let dyld_library_paths = [
-        NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local-latest/",
+        NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local/",
         NSHomeDirectory() + APP_SUPPORT_DIR + "plugins/",
         NSHomeDirectory() + APP_SUPPORT_DIR + "plugins/",
         ]
         ]
     
     
@@ -113,8 +113,7 @@ func InstallSSLocal() {
     let fileMgr = FileManager.default
     let fileMgr = FileManager.default
     let homeDir = NSHomeDirectory()
     let homeDir = NSHomeDirectory()
     let appSupportDir = homeDir+APP_SUPPORT_DIR
     let appSupportDir = homeDir+APP_SUPPORT_DIR
-    if !fileMgr.fileExists(atPath: appSupportDir + "ss-local-\(SS_LOCAL_VERSION)/ss-local")
-       || !fileMgr.fileExists(atPath: appSupportDir + "ss-local-\(SS_LOCAL_VERSION)/libmbedcrypto.0.dylib") {
+    if !fileMgr.fileExists(atPath: appSupportDir + "ss-local/ss-local") {
         let bundle = Bundle.main
         let bundle = Bundle.main
         let installerPath = bundle.path(forResource: "install_ss_local.sh", ofType: nil)
         let installerPath = bundle.path(forResource: "install_ss_local.sh", ofType: nil)
         let task = Process.launchedProcess(launchPath: installerPath!, arguments: [""])
         let task = Process.launchedProcess(launchPath: installerPath!, arguments: [""])
@@ -226,7 +225,7 @@ func InstallKcptun() {
     let fileMgr = FileManager.default
     let fileMgr = FileManager.default
     let homeDir = NSHomeDirectory()
     let homeDir = NSHomeDirectory()
     let appSupportDir = homeDir+APP_SUPPORT_DIR
     let appSupportDir = homeDir+APP_SUPPORT_DIR
-    if !fileMgr.fileExists(atPath: appSupportDir + "kcptun_\(KCPTUN_CLIENT_VERSION)/client") {
+    if !fileMgr.fileExists(atPath: appSupportDir + "kcptun/client") {
         let bundle = Bundle.main
         let bundle = Bundle.main
         let installerPath = bundle.path(forResource: "install_kcptun", ofType: "sh")
         let installerPath = bundle.path(forResource: "install_kcptun", ofType: "sh")
         let task = Process.launchedProcess(launchPath: "/bin/sh", arguments: [installerPath!])
         let task = Process.launchedProcess(launchPath: "/bin/sh", arguments: [installerPath!])
@@ -246,7 +245,7 @@ func InstallV2rayPlugin() {
     let fileMgr = FileManager.default
     let fileMgr = FileManager.default
     let homeDir = NSHomeDirectory()
     let homeDir = NSHomeDirectory()
     let appSupportDir = homeDir+APP_SUPPORT_DIR
     let appSupportDir = homeDir+APP_SUPPORT_DIR
-    if !fileMgr.fileExists(atPath: appSupportDir + "v2ray-plugin_\(V2RAY_PLUGIN_VERSION)/v2ray-plugin") {
+    if !fileMgr.fileExists(atPath: appSupportDir + "v2ray-plugin/v2ray-plugin") {
         let bundle = Bundle.main
         let bundle = Bundle.main
         let installerPath = bundle.path(forResource: "install_v2ray_plugin", ofType: "sh")
         let installerPath = bundle.path(forResource: "install_v2ray_plugin", ofType: "sh")
         let task = Process.launchedProcess(launchPath: "/bin/sh", arguments: [installerPath!])
         let task = Process.launchedProcess(launchPath: "/bin/sh", arguments: [installerPath!])
@@ -323,7 +322,7 @@ func InstallPrivoxy() {
     let fileMgr = FileManager.default
     let fileMgr = FileManager.default
     let homeDir = NSHomeDirectory()
     let homeDir = NSHomeDirectory()
     let appSupportDir = homeDir+APP_SUPPORT_DIR
     let appSupportDir = homeDir+APP_SUPPORT_DIR
-    if !fileMgr.fileExists(atPath: appSupportDir + "privoxy-\(PRIVOXY_VERSION)/privoxy") {
+    if !fileMgr.fileExists(atPath: appSupportDir + "privoxy/privoxy") {
         let bundle = Bundle.main
         let bundle = Bundle.main
         let installerPath = bundle.path(forResource: "install_privoxy.sh", ofType: nil)
         let installerPath = bundle.path(forResource: "install_privoxy.sh", ofType: nil)
         let task = Process.launchedProcess(launchPath: installerPath!, arguments: [""])
         let task = Process.launchedProcess(launchPath: installerPath!, arguments: [""])

BIN
ShadowsocksX-NG/kcptun/client


+ 2 - 4
ShadowsocksX-NG/kcptun/install_kcptun.sh

@@ -10,12 +10,10 @@
 # We use an adatper to handle it.
 # We use an adatper to handle it.
 # https://github.com/xtaci/kcptun/releases
 # https://github.com/xtaci/kcptun/releases
 
 
-VERSION="v20190905_1"
-
 cd "$(dirname "${BASH_SOURCE[0]}")"
 cd "$(dirname "${BASH_SOURCE[0]}")"
 
 
-mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_$VERSION"
-cp -f client "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun_$VERSION/"
+mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun"
+cp -f client "$HOME/Library/Application Support/ShadowsocksX-NG/kcptun/"
 
 
 # Delete old kcptun symbol link
 # Delete old kcptun symbol link
 rm -f "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/kcptun"
 rm -f "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/kcptun"

+ 1 - 2
ShadowsocksX-NG/kcptun/kcptun.sh

@@ -34,10 +34,9 @@ for i in "${_OPTS[@]}"; do
 done
 done
 
 
 PLUGIN_NAME="kcptun"
 PLUGIN_NAME="kcptun"
-PLUGIN_VERSION="v20190905_1"
 PLUGIN_BINARY_NAME="client"
 PLUGIN_BINARY_NAME="client"
 
 
-CMD="$(dirname "${BASH_SOURCE[0]}")/../${PLUGIN_NAME}_${PLUGIN_VERSION}/${PLUGIN_BINARY_NAME}"
+CMD="$(dirname "${BASH_SOURCE[0]}")/../${PLUGIN_NAME}/${PLUGIN_BINARY_NAME}"
 
 
 # Check if it is an IPv6 address
 # Check if it is an IPv6 address
 if  [[ $SS_REMOTE_HOST == *":"* ]]; then
 if  [[ $SS_REMOTE_HOST == *":"* ]]; then

+ 3 - 4
ShadowsocksX-NG/privoxy/install_privoxy.sh

@@ -9,10 +9,9 @@
 
 
 cd "$(dirname "${BASH_SOURCE[0]}")"
 cd "$(dirname "${BASH_SOURCE[0]}")"
 
 
-privoxyVersion=3.0.26.static
-mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy-$privoxyVersion"
-cp -f privoxy "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy-$privoxyVersion/"
+mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy"
+cp -f privoxy "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy/"
 rm -f "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy"
 rm -f "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy"
-ln -s "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy-$privoxyVersion/privoxy" "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy"
+ln -s "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy/privoxy" "$HOME/Library/Application Support/ShadowsocksX-NG/privoxy"
 
 
 echo done
 echo done

BIN
ShadowsocksX-NG/privoxy/privoxy


+ 2 - 25
ShadowsocksX-NG/ss-local/install_ss_local.sh

@@ -10,35 +10,12 @@
 cd "$(dirname "${BASH_SOURCE[0]}")"
 cd "$(dirname "${BASH_SOURCE[0]}")"
 
 
 NGDir="$HOME/Library/Application Support/ShadowsocksX-NG"
 NGDir="$HOME/Library/Application Support/ShadowsocksX-NG"
-TargetDir="$NGDir/ss-local-3.2.5"
-LatestTargetDir="$NGDir/ss-local-latest"
+TargetDir="$NGDir/ss-local"
 
 
 echo ngdir: ${NGDir}
 echo ngdir: ${NGDir}
 
 
-# 3.2.5 https://bintray.com/homebrew/bottles/shadowsocks-libev/
+# https://bintray.com/homebrew/bottles/shadowsocks-libev/
 mkdir -p "$TargetDir"
 mkdir -p "$TargetDir"
 cp -f ss-local "$TargetDir"
 cp -f ss-local "$TargetDir"
-rm -f "$LatestTargetDir"
-ln -s "$TargetDir" "$LatestTargetDir"
-
-cp -f libev.4.dylib "$TargetDir"
-
-# 2.8.0 https://bintray.com/homebrew/bottles/mbedtls
-cp -f libmbedcrypto.2.12.0.dylib "$TargetDir"
-ln -sfh  "$TargetDir/libmbedcrypto.2.12.0.dylib" "$TargetDir/libmbedcrypto.2.dylib"
-ln -sfh  "$TargetDir/libmbedcrypto.2.12.0.dylib" "$TargetDir/libmbedcrypto.3.dylib"
-
-# 8.42 https://bintray.com/homebrew/bottles/pcre
-cp -f libpcre.1.dylib "$TargetDir"
-
-# 1.0.18 https://bintray.com/homebrew/bottles/libsodium
-cp -f libsodium.23.dylib "$TargetDir"
-ln -sfh "$TargetDir/libsodium.23.dylib" "$TargetDir/libsodium.dylib"
-
-#cp -f libudns.0.dylib "$TargetDir"
-
-# 1.15.0 https://bintray.com/homebrew/bottles/c-ares
-cp -f libcares.2.dylib "$TargetDir"
-ln -sfh "$TargetDir/libcares.2.dylib" "$TargetDir/libcares.dylib"
 
 
 echo done
 echo done

BIN
ShadowsocksX-NG/ss-local/libcares.2.dylib


BIN
ShadowsocksX-NG/ss-local/libev.4.dylib


BIN
ShadowsocksX-NG/ss-local/libmbedcrypto.2.12.0.dylib


BIN
ShadowsocksX-NG/ss-local/libpcre.1.dylib


BIN
ShadowsocksX-NG/ss-local/libsodium.23.dylib


BIN
ShadowsocksX-NG/ss-local/ss-local


+ 4 - 5
ShadowsocksX-NG/v2ray-plugin/install_v2ray_plugin.sh

@@ -13,14 +13,13 @@
 # v2ray-plugin_darwin_universal: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64]
 # v2ray-plugin_darwin_universal: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64]
 # v2ray-plugin_darwin_universal (for architecture x86_64):        Mach-O 64-bit executable x86_64
 # v2ray-plugin_darwin_universal (for architecture x86_64):        Mach-O 64-bit executable x86_64
 # v2ray-plugin_darwin_universal (for architecture arm64): Mach-O 64-bit executable arm64
 # v2ray-plugin_darwin_universal (for architecture arm64): Mach-O 64-bit executable arm64
-VERSION="v1.3.1-9-gddd7ab4"
 
 
 cd "$(dirname "${BASH_SOURCE[0]}")"
 cd "$(dirname "${BASH_SOURCE[0]}")"
 
 
-mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/v2ray-plugin_$VERSION"
-cp -f v2ray-plugin "$HOME/Library/Application Support/ShadowsocksX-NG/v2ray-plugin_$VERSION/"
+mkdir -p "$HOME/Library/Application Support/ShadowsocksX-NG/v2ray-plugin"
+cp -f v2ray-plugin "$HOME/Library/Application Support/ShadowsocksX-NG/v2ray-plugin/"
 
 
-ln -sfh "$HOME/Library/Application Support/ShadowsocksX-NG/v2ray-plugin_$VERSION/v2ray-plugin" "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/v2ray-plugin"
-ln -sfh "$HOME/Library/Application Support/ShadowsocksX-NG/v2ray-plugin_$VERSION/v2ray-plugin" "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/v2ray"
+ln -sfh "$HOME/Library/Application Support/ShadowsocksX-NG/v2ray-plugin/v2ray-plugin" "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/v2ray-plugin"
+ln -sfh "$HOME/Library/Application Support/ShadowsocksX-NG/v2ray-plugin/v2ray-plugin" "$HOME/Library/Application Support/ShadowsocksX-NG/plugins/v2ray"
 
 
 echo "install v2ray-plugin done"
 echo "install v2ray-plugin done"

BIN
ShadowsocksX-NG/v2ray-plugin/v2ray-plugin


+ 189 - 0
deps/Makefile

@@ -0,0 +1,189 @@
+ARCH ?= $(shell uname -m)
+TARGET := $(ARCH)-apple-macos10.12
+JOBS := $(shell getconf _NPROCESSORS_ONLN)
+GOROOT := $${PWD}/../dist/go
+GO := $(GOROOT)/bin/go
+
+ifeq ($(ARCH),arm64)
+ARCH := aarch64
+endif
+
+ifeq ($(ARCH),x86_64)
+GOARCH := amd64
+else
+GOARCH := arm64
+endif
+
+.PHONY: all
+all: 
+	$(MAKE) ARCH=x86_64 shadowsocks-libev privoxy v2ray-plugin kcptun
+	$(MAKE) ARCH=aarch64 shadowsocks-libev privoxy v2ray-plugin kcptun
+	$(MAKE) universal
+
+.PHONY: universal
+universal:
+	# shadowsocks-libev
+	mkdir -p $${PWD}/dist/universal/shadowsocks-libev/bin
+	lipo \
+		$${PWD}/dist/x86_64/shadowsocks-libev/bin/ss-local \
+		$${PWD}/dist/aarch64/shadowsocks-libev/bin/ss-local \
+		-create \
+		-output $${PWD}/dist/universal/shadowsocks-libev/bin/ss-local
+	cp $${PWD}/dist/universal/shadowsocks-libev/bin/ss-local $${PWD}/../ShadowsocksX-NG/ss-local/
+
+	# privoxy
+	mkdir -p $${PWD}/dist/universal/privoxy/sbin
+	lipo \
+		$${PWD}/dist/x86_64/privoxy/sbin/privoxy \
+		$${PWD}/dist/aarch64/privoxy/sbin/privoxy \
+		-create \
+		-output $${PWD}/dist/universal/privoxy/sbin/privoxy
+	cp $${PWD}/dist/universal/privoxy/sbin/privoxy $${PWD}/../ShadowsocksX-NG/privoxy/
+
+	# v2ray-plugin
+	mkdir -p $${PWD}/dist/universal/v2ray-plugin/bin
+	lipo \
+		$${PWD}/dist/x86_64/v2ray-plugin/bin/v2ray-plugin \
+		$${PWD}/dist/aarch64/v2ray-plugin/bin/v2ray-plugin \
+		-create \
+		-output $${PWD}/dist/universal/v2ray-plugin/bin/v2ray-plugin
+	cp $${PWD}/dist/universal/v2ray-plugin/bin/v2ray-plugin $${PWD}/../ShadowsocksX-NG/v2ray-plugin/
+
+	# kcptun
+	mkdir -p $${PWD}/dist/universal/kcptun/bin
+	lipo \
+		$${PWD}/dist/x86_64/kcptun/bin/client \
+		$${PWD}/dist/aarch64/kcptun/bin/client \
+		-create \
+		-output $${PWD}/dist/universal/kcptun/bin/client
+	cp $${PWD}/dist/universal/kcptun/bin/client $${PWD}/../ShadowsocksX-NG/kcptun/
+
+.PHONY: pcre
+pcre:
+	[ -f pcre.tar.gz ] || curl -L -o pcre.tar.gz 'https://downloads.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz'
+	tar -xf pcre.tar.gz
+	cd pcre-8.45 \
+		&& CXXFLAGS="-target $(TARGET)" CFLAGS="-target $(TARGET)" ./configure --prefix $${PWD}/../dist/$(ARCH)/pcre \
+		--host=$(TARGET) \
+		--disable-dependency-tracking \
+		--enable-utf8 \
+		--enable-pcre8 \
+		--enable-pcre16 \
+		--enable-pcre32 \
+		--enable-unicode-properties \
+		--enable-pcregrep-libz \
+		--enable-pcregrep-libbz2 \
+		--enable-static \
+		--disable-shared \
+		&& make -j$(JOBS) \
+		&& make install \
+		&& make clean
+
+.PHONY: libev
+libev:
+	[ -f libev.tar.gz ] || curl -L -o libev.tar.gz 'http://dist.schmorp.de/libev/libev-4.33.tar.gz'
+	tar -xf libev.tar.gz
+	cd libev-4.33 \
+		&& CFLAGS="-target $(TARGET)" ./configure --prefix $${PWD}/../dist/$(ARCH)/libev \
+		--host=$(TARGET) \
+		--disable-dependency-tracking \
+		--enable-static \
+		--disable-shared \
+		&& make -j$(JOBS) \
+		&& make install \
+		&& make clean
+
+.PHONY: privoxy
+privoxy:
+	[ -f privoxy.tar.gz ] || curl -L -o privoxy.tar.gz 'https://www.privoxy.org/sf-download-mirror/Sources/3.0.28%20%28stable%29/privoxy-3.0.28-stable-src.tar.gz'
+	tar -xf privoxy.tar.gz
+	cd privoxy-3.0.28-stable \
+		&& autoreconf -fi \
+		&& LDFLAGS="-target $(TARGET)" CFLAGS="-target $(TARGET)" ./configure --prefix $${PWD}/../dist/$(ARCH)/privoxy \
+		--host=$(TARGET) \
+		--disable-dependency-tracking \
+		--enable-static \
+		--disable-shared \
+		&& make -j$(JOBS) \
+		&& make install \
+		&& make clean
+
+.PHONY: c-ares
+c-ares:
+	cd c-ares \
+		&& autoreconf -fi \
+		&& CXXFLAGS="-target $(TARGET)" CFLAGS="-target $(TARGET)" ./configure --prefix=$${PWD}/../dist/$(ARCH)/c-ares \
+		--host=$(TARGET) \
+		--disable-dependency-tracking \
+		--enable-static \
+		--disable-shared \
+		&& make -j$(JOBS) \
+		&& make install \
+		&& make clean
+
+.PHONY: libsodium
+libsodium:
+	cd libsodium \
+		&& ./autogen.sh \
+		&& CFLAGS="-target $(TARGET)" ./configure --prefix $${PWD}/../dist/$(ARCH)/libsodium \
+		--host=$(TARGET) \
+		--enable-static \
+		--disable-shared \
+		&& make -j$(JOBS) \
+		&& make install \
+		&& make clean
+
+.PHONY: mbedtls
+mbedtls:
+	cd mbedtls \
+		&& make CFLAGS="-target $(TARGET) -O2" LDFLAGS="-target $(TARGET) -O2" -j$(JOBS)\
+		&& make DESTDIR=$${PWD}/../dist/$(ARCH)/mbedtls install \
+		&& make clean
+
+.PHONY: shadowsocks-libev
+shadowsocks-libev: pcre libev c-ares libsodium mbedtls 
+	cd shadowsocks-libev \
+		&& ./autogen.sh \
+		&& CFLAGS="-target $(TARGET)" LDFLAGS="-lresolv" ./configure --prefix $${PWD}/../dist/$(ARCH)/shadowsocks-libev \
+		--host=$(TARGET) \
+		--disable-dependency-tracking \
+		--enable-static \
+		--disable-shared \
+		--disable-documentation \
+		--with-mbedtls=$${PWD}/../dist/$(ARCH)/mbedtls \
+		--with-pcre=$${PWD}/../dist/$(ARCH)/pcre \
+		--with-sodium=$${PWD}/../dist/$(ARCH)/libsodium \
+		--with-cares=$${PWD}/../dist/$(ARCH)/c-ares \
+		--with-ev=$${PWD}/../dist/$(ARCH)/libev \
+		&& make -j$(JOBS) \
+		&& make install \
+		&& make clean
+
+.PHONY: v2ray-plugin
+v2ray-plugin: go
+	cd v2ray-plugin \
+		&& GOROOT=$(GOROOT) GOOS=darwin GOARCH=$(GOARCH) \
+			$(GO) build -trimpath -ldflags "-s -w" -o $${PWD}/../dist/$(ARCH)/v2ray-plugin/bin/v2ray-plugin 
+
+.PHONY: kcptun
+kcptun: go
+	cd kcptun \
+		&& GOROOT=$(GOROOT) GOOS=darwin GOARCH=$(GOARCH) \
+			$(GO) build -trimpath -ldflags "-s -w" -o $${PWD}/../dist/$(ARCH)/kcptun/bin/client github.com/xtaci/kcptun/client 
+
+.PHONY: go
+go:
+	[ -d dist ] || mkdir dist
+ifeq ($(shell uname -m),arm64)
+	[ -f dist/go.tar.gz ] || curl "https://dl.google.com/go/go1.18.darwin-arm64.tar.gz" --output dist/go.tar.gz
+else
+	[ -f dist/go.tar.gz ] || curl "https://dl.google.com/go/go1.18.darwin-amd64.tar.gz" --output dist/go.tar.gz
+endif
+	cd dist \
+		&& tar -zxf go.tar.gz
+
+clean:
+	rm -rf dist
+	rm -rf pcre*
+	rm -rf libev*
+	rm -rf privoxy*

+ 1 - 0
deps/c-ares

@@ -0,0 +1 @@
+Subproject commit 2aa086f822aad5017a6f2061ef656f237a62d0ed

+ 1 - 0
deps/kcptun

@@ -0,0 +1 @@
+Subproject commit 208deccd09b3e9f90fc5c39c16271a53c1128ef2

+ 1 - 0
deps/libsodium

@@ -0,0 +1 @@
+Subproject commit 4f5e89fa84ce1d178a6765b8b46f2b6f91216677

+ 1 - 0
deps/mbedtls

@@ -0,0 +1 @@
+Subproject commit 89f040a5c938985c5f30728baed21e49d0846a53

+ 1 - 0
deps/shadowsocks-libev

@@ -0,0 +1 @@
+Subproject commit 8285e5a7de093b8ae5a2ca68f7108e6f273092b1

+ 1 - 0
deps/v2ray-plugin

@@ -0,0 +1 @@
+Subproject commit ddd7ab46b4aeee0ca8b272efed9d7da3e3a6e52c