Module: XCFrameworkConverter::ArmPatcher
- Defined in:
- lib/xcframework_converter/arm_patcher.rb
Overview
Patches a binary (static or dynamic), turning an arm64-device into an arm64-simualtor. For more info: static libs: bogo.wtf/arm64-to-sim.html dylibs: bogo.wtf/arm64-to-sim-dylibs.html
Class Method Summary collapse
Class Method Details
.cleanup_unused_archs(slice) ⇒ Object
122 123 124 125 126 127 128 |
# File 'lib/xcframework_converter/arm_patcher.rb', line 122 def cleanup_unused_archs(slice) supported_archs = slice.supported_archs unsupported_archs = `xcrun lipo \"#{slice.binary_path}\" -archs`.split - supported_archs unsupported_archs.each do |arch| `xcrun lipo \"#{slice.binary_path}\" -remove \"#{arch}\" -output \"#{slice.binary_path}\"` end end |
.patch_arm_binary(slice) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/xcframework_converter/arm_patcher.rb', line 19 def patch_arm_binary(slice) require 'macho' case slice.build_type.linkage when :dynamic patch_arm_binary_dynamic(slice) when :static patch_arm_binary_static(slice) end slice.path.glob('**/arm64*.swiftinterface').each do |interface_file| `sed -i '' -E 's/target arm64-apple-ios([0-9.]+) /target arm64-apple-ios\\1-simulator /g' "#{interface_file}"` end end |