diff --git a/OpenVPNAdapter.podspec b/OpenVPNAdapter.podspec index 73cf7fd..a0477b7 100644 --- a/OpenVPNAdapter.podspec +++ b/OpenVPNAdapter.podspec @@ -35,35 +35,11 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/ss-abramchuk/OpenVPNAdapter.git", :tag => "#{s.version}" } - # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - - framework_path = "Sources/OpenVPNAdapter" - vendors_path = "#{framework_path}/Libraries/Vendors" - - s.source_files = "#{framework_path}/*.{h,m,mm}" - - s.public_header_files = "#{framework_path}/*.h" - s.private_header_files = [ - "#{framework_path}/*+Internal.h", - "#{framework_path}/OpenVPNReachabilityTracker.h", - "#{framework_path}/OpenVPNClient.h", - "#{framework_path}/OpenVPNNetworkSettingsBuilder.h", - "#{framework_path}/OpenVPNPacket.h", - "#{framework_path}/OpenVPNPacketFlowBridge.h", - "#{framework_path}/NSError+OpenVPNError.h", - "#{framework_path}/NSArray+OpenVPNAdditions.h" - ] - - s.module_map = "Configuration/OpenVPNAdapter.modulemap" - - # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # s.ios.frameworks = "Foundation", "NetworkExtension", "SystemConfiguration", "UIKit" s.osx.frameworks = "Foundation", "NetworkExtension", "SystemConfiguration" - s.libraries = "lz4", "mbedcrypto", "mbedtls", "mbedx509" - # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # @@ -81,70 +57,53 @@ Pod::Spec.new do |s| # ――― Subspecs ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - s.subspec "lz4" do |lz4| - lz4_path = "#{vendors_path}/lz4" + s.subspec "OpenVPNAdapter" do |adapter| + adapter_path = "Sources/OpenVPNAdapter" - lz4.preserve_paths = "#{lz4_path}/include/*.h" + adapter.source_files = "#{adapter_path}/library/*.{h,m,mm}" + adapter.public_header_files = "#{adapter_path}/include/*.h" - lz4.ios.vendored_libraries = [ - "#{lz4_path}/lib/ios/liblz4.a" - ] - - lz4.osx.vendored_libraries = [ - "#{lz4_path}/lib/macos/liblz4.a" - ] - - lz4.xcconfig = { - "HEADER_SEARCH_PATHS" => "${PODS_TARGET_SRCROOT}/#{lz4_path}/include/**" - } + adapter.compiler_flags = "-DUSE_ASIO" end - s.subspec "mbedtls" do |mbedtls| - mbedtls_path = "#{vendors_path}/mbedtls" + s.subspec "ASIO" do |asio| + asio_path = "Sources/ASIO" - mbedtls.preserve_paths = "#{mbedtls_path}/include/**/*.h" - - mbedtls.ios.vendored_libraries = [ - "#{mbedtls_path}/lib/ios/libmbedcrypto.a", - "#{mbedtls_path}/lib/ios/libmbedtls.a", - "#{mbedtls_path}/lib/ios/libmbedx509.a" - ] - - mbedtls.osx.vendored_libraries = [ - "#{mbedtls_path}/lib/macos/libmbedcrypto.a", - "#{mbedtls_path}/lib/macos/libmbedtls.a", - "#{mbedtls_path}/lib/macos/libmbedx509.a" - ] - - mbedtls.xcconfig = { - "HEADER_SEARCH_PATHS" => "${PODS_TARGET_SRCROOT}/#{mbedtls_path}/include/**" - } + asio.public_header_files = "#{asio_path}/asio/include/**/*.{hpp,ipp}" end - s.subspec "asio" do |asio| - asio_path = "#{vendors_path}/asio" + s.subspec "LZ4" do |lz4| + lz4_path = "Sources/LZ4" - asio.preserve_paths = "#{asio_path}/asio/include/**/*.{hpp,ipp}" + lz4.source_files = "#{lz4_path}/lib/*.{h,c}" + lz4.public_header_files = "#{lz4_path}/include/*.h" - asio.xcconfig = { - "HEADER_SEARCH_PATHS" => "${PODS_TARGET_SRCROOT}/#{asio_path}/asio/include/**" - } + lz4.compiler_flags = "-DXXH_NAMESPACE=LZ4_" end - s.subspec "openvpn" do |openvpn| - openvpn_path = "#{vendors_path}/openvpn" + s.subspec "mbedTLS" do |mbedtls| + mbedtls_path = "Sources/mbedTLS" - openvpn.source_files = "#{openvpn_path}/client/*.{hpp,cpp}" - openvpn.private_header_files = "#{openvpn_path}/client/*.hpp" + mbedtls.source_files = "#{mbedtls_path}/library/*.{c}" + mbedtls.public_header_files = "#{mbedtls_path}/include/*.h" - openvpn.preserve_paths = "#{openvpn_path}/openvpn/**/*.hpp" + mbedtls.compiler_flags = "-DMBEDTLS_MD4_C", "-DMBEDTLS_RELAXED_X509_DATE", "-D_FILE_OFFSET_BITS=64" + end - openvpn.compiler_flags = "-x objective-c++" + s.subspec "OpenVPN3" do |openvpn| + openvpn_path = "Sources/OpenVPN3" - openvpn.xcconfig = { - "HEADER_SEARCH_PATHS" => "${PODS_TARGET_SRCROOT}/#{openvpn_path}/**", - "OTHER_CPLUSPLUSFLAGS" => "$(OTHER_CFLAGS) -DUSE_ASIO -DUSE_ASIO_THREADLOCAL -DASIO_STANDALONE -DASIO_NO_DEPRECATED -DASIO_HAS_STD_STRING_VIEW -DHAVE_LZ4 -DUSE_MBEDTLS -DOPENVPN_FORCE_TUN_NULL -DUSE_TUN_BUILDER" - } + openvpn.public_header_files = "#{openvpn_path}/openvpn/**/*.hpp" + openvpn.preserve_paths = "#{openvpn_path}/client/*.{hpp,cpp}" + end + + s.subspec "OpenVPNClient" do |client| + client_path = "Sources/OpenVPNClient" + + client.source_files = "#{client_path}/library/*.{mm}" + client.public_header_files = "#{client_path}/include/*.h" + + client.compiler_flags = "-DUSE_ASIO", "-DUSE_ASIO_THREADLOCAL", "-DASIO_STANDALONE", "-DASIO_NO_DEPRECATED", "-DASIO_HAS_STD_STRING_VIEW", "-DHAVE_LZ4", "-DUSE_MBEDTLS", "-DOPENVPN_FORCE_TUN_NULL", "-DUSE_TUN_BUILDER" end end