libmobilecoin-ios-artifacts/LibMobileCoin.podspec
Adam Mork f24c1c8881
Fixes & Patch for Mac Catalyst Build Targets (#54)
### Motivation

Mac Catalyst builds stopped working when `cc-rs` got updated by dependabot in the `rust-mbedtls` dependency of `mobilecoin` and `libmobilecoin`. 

### In this PR
* Update `mobilecoin` repo commit to newer that includes a previous `mbedtls` big-num multiplication fix.
* Patch `cc-rs` with new compiler args so mac-catalyst will build correctly
* Patch `cmake-rs` with changes so mac-catalyst will build correctly
* Patch `rust-mbedtls` with above changes so it can build mac-catalyst
* Patch `libmobilecoin` with above patches
* Add `patch-cmake.sh` script on the local machine to workaround a restriction of `cmake` where the CMAKE_SYSTEM_NAME cannot be iOS with a CMAKE_OSX_SYSROOT pointing to a MacOSX sdk. The patched `cmake` files in this context comes from brew as a build dependency. An un-patch script is included as well. '
* re-add back in old implementations of functions for `...add_output` and `...add_change_output` for the Transaction Builder that have the old sig and pull the tokenId from the TransactionBuilder. The new versions which support "mixed" transactions for "SCI" get the "_mixed" suffix.
* Change deployment target to 11.0
* Fix dependency hell w/ cocoapods & Xcode 14, etc...

### Future Work

Find a fix that doesn't require patching `cmake` locally. Merge the patches upstream into master-repo's main branches.
Fix SwiftNIO catomic issue in Swift repo
2023-01-31 18:22:18 -08:00

119 lines
4.7 KiB
Ruby

Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.name = "LibMobileCoin"
s.version = "4.0.0-pre3"
s.summary = "A library for communicating with MobileCoin network"
s.author = "MobileCoin"
s.homepage = "https://www.mobilecoin.com/"
s.license = { :type => "GPLv3" }
s.source = {
:git => "https://github.com/mobilecoinofficial/libmobilecoin-ios-artifacts.git",
:tag => "v#{s.version}",
:submodules => true
}
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.platform = :ios, "11.0"
# ――― Subspecs ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# s.default_subspecs = :none
s.default_subspecs = "Core"
s.subspec "TestVectors" do |subspec|
subspec.source_files = "Sources/TestVector/**/*.swift"
subspec.preserve_paths = [
'Artifacts/**/libmobilecoin.a',
]
subspec.resources = [
"Vendor/mobilecoin/test-vectors/vectors/**/*.*",
]
end
s.subspec "Core" do |subspec|
subspec.preserve_paths = [
'Artifacts/**/libmobilecoin.a',
]
subspec.source_files = [
"Artifacts/include/*.h",
"Sources/Generated/Proto/*.{grpc,pb}.swift",
]
subspec.dependency "gRPC-Swift"
subspec.dependency "SwiftProtobuf", "~> 1.5"
end
s.subspec "CoreHTTP" do |subspec|
subspec.preserve_paths = [
'Artifacts/**/libmobilecoin.a',
]
subspec.source_files = [
"Artifacts/include/*.h",
"Sources/Generated/Proto/*.pb.swift",
]
subspec.dependency "SwiftProtobuf", "~> 1.5"
end
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.swift_version = "5.2"
s.pod_target_xcconfig = {
"GCC_OPTIMIZATION_LEVEL" => "z",
# "LLVM_LTO" => "YES",
# Rust bitcode is not verified to be compatible with Apple Xcode's LLVM bitcode,
# so this is disabled to be on the safe side.
"ENABLE_BITCODE" => "YES",
# Mac Catalyst is not supported since tjis library includes a vendored binary
# that only includes support for iOS archictures.
"SUPPORTS_MACCATALYST" => "YES",
# The vendored binary doesn't include support for 32-bit architectures or arm64
# for iphonesimulator. This must be manually configured to avoid Xcode's default
# setting of building 32-bit and Xcode 12's default setting of including the
# arm64 simulator. Note: 32-bit is officially dropped in iOS 11
"HEADER_SEARCH_PATHS": "$(PODS_TARGET_SRCROOT)/Artifacts/include",
"SWIFT_INCLUDE_PATHS": "$(HEADER_SEARCH_PATHS)",
"LIBMOBILECOIN_LIB_IF_NEEDED": "$(PODS_TARGET_SRCROOT)/Artifacts/target/$(CARGO_BUILD_TARGET)/release/libmobilecoin.a",
"OTHER_LDFLAGS": "-lz -u _mc_string_free $(LIBMOBILECOIN_LIB_IF_NEEDED)",
"CARGO_BUILD_TARGET[sdk=iphonesimulator*][arch=arm64]": "aarch64-apple-ios-sim",
"CARGO_BUILD_TARGET[sdk=iphonesimulator*][arch=*]": "x86_64-apple-ios",
"CARGO_BUILD_TARGET[sdk=iphoneos*]": "aarch64-apple-ios",
"CARGO_BUILD_TARGET_MAC_CATALYST_ARM_": "aarch64-apple-darwin",
"CARGO_BUILD_TARGET_MAC_CATALYST_ARM_YES": "aarch64-apple-ios-macabi",
"CARGO_BUILD_TARGET[sdk=macosx*][arch=arm64]": "$(CARGO_BUILD_TARGET_MAC_CATALYST_ARM_$(IS_MACCATALYST))",
"CARGO_BUILD_TARGET_MAC_CATALYST_X86_": "x86_64-apple-darwin",
"CARGO_BUILD_TARGET_MAC_CATALYST_X86_YES": "x86_64-apple-ios-macabi",
"CARGO_BUILD_TARGET[sdk=macosx*][arch=*]": "$(CARGO_BUILD_TARGET_MAC_CATALYST_X86_$(IS_MACCATALYST))",
"VALID_ARCHS[sdk=iphoneos*]" => "arm64",
"VALID_ARCHS[sdk=iphonesimulator*]" => "x86_64 arm64",
"ARCHS[sdk=iphonesimulator*]": "x86_64 arm64",
"ARCHS[sdk=iphoneos*]": "arm64",
"EXCLUDED_ARCHS[sdk=iphoneos*]" => "armv7",
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "i386",
}
# `user_target_xcconfig` should only be set when the setting needs to propogate to
# all targets that depend on this library.
s.user_target_xcconfig = {
"SUPPORTS_MACCATALYST" => "YES",
"EXCLUDED_ARCHS[sdk=iphoneos*]" => "armv7",
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" => "i386",
"VALID_ARCHS[sdk=iphoneos*]" => "arm64",
"VALID_ARCHS[sdk=iphonesimulator*]" => "x86_64 arm64",
}
end