From cc2167d82bf72dac9dd8992fef706b7963c1be06 Mon Sep 17 00:00:00 2001 From: Francois Date: Thu, 16 Jan 2025 14:02:09 +0200 Subject: [PATCH] add static linking of libmm2.a for iOS KDF was not linked statically or bundled with the `komodo_defi_framework` package --- .../ios/Classes/komodo_defi_framework.c | 3 +- .../ios/komodo_defi_framework.podspec | 40 +++++++++++++++++-- .../ios/mm2_plugin.podspec | 20 ---------- .../src/komodo_defi_framework.c | 1 + 4 files changed, 39 insertions(+), 25 deletions(-) delete mode 100644 packages/komodo_defi_framework/ios/mm2_plugin.podspec diff --git a/packages/komodo_defi_framework/ios/Classes/komodo_defi_framework.c b/packages/komodo_defi_framework/ios/Classes/komodo_defi_framework.c index 8a63e27..0b7d745 100644 --- a/packages/komodo_defi_framework/ios/Classes/komodo_defi_framework.c +++ b/packages/komodo_defi_framework/ios/Classes/komodo_defi_framework.c @@ -1,3 +1,4 @@ // Relative import to be able to reuse the C sources. // See the comment in ../komodo_defi_framework.podspec for more information. -// #include "../../src/komodo_defi_framework.c" +#include "../../src/komodo_defi_framework.c" + diff --git a/packages/komodo_defi_framework/ios/komodo_defi_framework.podspec b/packages/komodo_defi_framework/ios/komodo_defi_framework.podspec index 693b789..cae2232 100644 --- a/packages/komodo_defi_framework/ios/komodo_defi_framework.podspec +++ b/packages/komodo_defi_framework/ios/komodo_defi_framework.podspec @@ -21,8 +21,40 @@ A new Flutter FFI plugin project. s.source_files = 'Classes/**/*' s.dependency 'Flutter' s.platform = :ios, '12.0' - - # Flutter.framework does not contain a i386 slice. - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } s.swift_version = '5.0' -end + + s.frameworks = [ + 'CoreFoundation', + 'SystemConfiguration', + ] + + s.vendored_libraries = 'libmm2.a' + # s.vendored_libraries = 'libkdflib.dylib' + + s.pod_target_xcconfig = { + 'DEFINES_MODULE' => 'YES', + 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386', + 'OTHER_LDFLAGS' => [ + '-force_load "$(PODS_TARGET_SRCROOT)/libmm2.a"', + '-framework SystemConfiguration', + ], + # # Add rpath to ensure dylib can be found at runtime + # 'LD_RUNPATH_SEARCH_PATHS' => [ + # '$(inherited)', + # '@executable_path/Frameworks', + # '@loader_path/Frameworks' + # ] + } + + s.user_target_xcconfig = { + 'OTHER_LDFLAGS' => [ + '-framework SystemConfiguration' + ] + } + + s.libraries = ['c++', 'resolv'] + + # Ensure the dylib is copied into the final app bundle + # s.preserve_paths = 'libkdflib.dylib' + +end \ No newline at end of file diff --git a/packages/komodo_defi_framework/ios/mm2_plugin.podspec b/packages/komodo_defi_framework/ios/mm2_plugin.podspec deleted file mode 100644 index 89d5e28..0000000 --- a/packages/komodo_defi_framework/ios/mm2_plugin.podspec +++ /dev/null @@ -1,20 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'mm2_plugin' - s.version = '0.0.1' - s.summary = 'MM2 plugin for Flutter.' - s.description = <<-DESC - A new Flutter plugin for MM2. - DESC - s.homepage = 'http://example.com' - s.license = { :file => '../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } - s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' - s.dependency 'Flutter' - s.platform = :ios, '11.0' - s.vendored_libraries = 'libmm2.a' - - # Flutter.framework does not contain a i386 slice. - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } - end \ No newline at end of file diff --git a/packages/komodo_defi_framework/src/komodo_defi_framework.c b/packages/komodo_defi_framework/src/komodo_defi_framework.c index e69de29..3de6ae1 100644 --- a/packages/komodo_defi_framework/src/komodo_defi_framework.c +++ b/packages/komodo_defi_framework/src/komodo_defi_framework.c @@ -0,0 +1 @@ +#include "komodo_defi_framework.h" \ No newline at end of file