From d6553663588f5b1ed1a8fdc818bbc9eed9a2989d Mon Sep 17 00:00:00 2001 From: julian-CStack Date: Tue, 29 Aug 2023 07:44:48 -0600 Subject: [PATCH 01/14] WIP macos build --- scripts/macos/build_all.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/macos/build_all.sh diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh new file mode 100755 index 0000000..61dce2e --- /dev/null +++ b/scripts/macos/build_all.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ROOT_DIR="$(pwd)/../.." + +export MACOSX_DEPLOYMENT_TARGET=10.14 + +mkdir -p build + +rm -rf "$ROOT_DIR"/src/serai/target + +cd "$ROOT_DIR"/src/serai/hrf || exit + +echo "Building macos frostdart" +cargo lipo --release --targets aarch64-apple-darwin,x86_64-apple-darwin +cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/macos/frostdart.a \ No newline at end of file From 3d0bd846364b97972ecd75f507729f7cbb17c295 Mon Sep 17 00:00:00 2001 From: julian-CStack Date: Tue, 29 Aug 2023 08:52:52 -0600 Subject: [PATCH 02/14] WIP macos build pt2 --- lib/frostdart.dart | 3 ++- macos/Classes/frostdart.c | 2 +- macos/frostdart.podspec | 6 ++---- scripts/macos/build_all.sh | 5 ++++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/frostdart.dart b/lib/frostdart.dart index cc22e17..5d5e808 100644 --- a/lib/frostdart.dart +++ b/lib/frostdart.dart @@ -12,7 +12,8 @@ const String _libName = 'frostdart'; /// The dynamic library in which the symbols for [FrostdartBindings] can be found. final ffi.DynamicLibrary _dylib = () { if (Platform.isMacOS || Platform.isIOS) { - return ffi.DynamicLibrary.open('$_libName.framework/$_libName'); + return ffi.DynamicLibrary.process(); + // return ffi.DynamicLibrary.open('$_libName.framework/$_libName'); } if (Platform.isAndroid || Platform.isLinux) { return ffi.DynamicLibrary.open('$_libName.so'); diff --git a/macos/Classes/frostdart.c b/macos/Classes/frostdart.c index defb6c7..e2fe9b3 100644 --- a/macos/Classes/frostdart.c +++ b/macos/Classes/frostdart.c @@ -1,3 +1,3 @@ // Relative import to be able to reuse the C sources. // See the comment in ../{projectName}}.podspec for more information. -#include "../../src/frostdart.c" +#include "../../src/serai/hrf/header.h" diff --git a/macos/frostdart.podspec b/macos/frostdart.podspec index 5c70e92..85e530e 100644 --- a/macos/frostdart.podspec +++ b/macos/frostdart.podspec @@ -13,12 +13,10 @@ A new Flutter project. s.license = { :file => '../LICENSE' } s.author = { 'Your Company' => 'email@example.com' } - # This will ensure the source files in Classes/ are included in the native - # builds of apps using this FFI plugin. Podspec does not support relative - # paths, so Classes contains a forwarder C file that relatively imports - # `../src/*` so that the C sources can be shared among all target platforms. s.source = { :path => '.' } s.source_files = 'Classes/**/*' + s.static_framework = true + s.vendored_libraries = "**/*.a" s.dependency 'FlutterMacOS' s.platform = :osx, '10.11' diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh index 61dce2e..a83033e 100755 --- a/scripts/macos/build_all.sh +++ b/scripts/macos/build_all.sh @@ -12,4 +12,7 @@ cd "$ROOT_DIR"/src/serai/hrf || exit echo "Building macos frostdart" cargo lipo --release --targets aarch64-apple-darwin,x86_64-apple-darwin -cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/macos/frostdart.a \ No newline at end of file +mkdir -p build "$ROOT_DIR"/macos/libs +#mkdir -p build "$ROOT_DIR"/macos/include +cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/macos/libs/libfrostdart.a +#cp header.h "$ROOT_DIR"/macos/include/header.h \ No newline at end of file From 4804f96d125546f31aff8d23a5fc41d248d20b5a Mon Sep 17 00:00:00 2001 From: Likho Date: Wed, 30 Aug 2023 19:23:02 +0200 Subject: [PATCH 03/14] Macos run --- example/ios/Podfile | 44 +++++++++ example/macos/Flutter/Flutter-Debug.xcconfig | 1 + .../macos/Flutter/Flutter-Release.xcconfig | 1 + example/macos/Podfile | 43 +++++++++ example/macos/Podfile.lock | 22 +++++ .../macos/Runner.xcodeproj/project.pbxproj | 91 ++++++++++++++++++- .../contents.xcworkspacedata | 3 + example/pubspec.lock | 2 +- example/pubspec.yaml | 2 +- lib/frostdart.dart | 5 +- 10 files changed, 210 insertions(+), 4 deletions(-) create mode 100644 example/ios/Podfile create mode 100644 example/macos/Podfile create mode 100644 example/macos/Podfile.lock diff --git a/example/ios/Podfile b/example/ios/Podfile new file mode 100644 index 0000000..fdcc671 --- /dev/null +++ b/example/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '11.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/macos/Flutter/Flutter-Debug.xcconfig b/example/macos/Flutter/Flutter-Debug.xcconfig index c2efd0b..4b81f9b 100644 --- a/example/macos/Flutter/Flutter-Debug.xcconfig +++ b/example/macos/Flutter/Flutter-Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Flutter/Flutter-Release.xcconfig b/example/macos/Flutter/Flutter-Release.xcconfig index c2efd0b..5caa9d1 100644 --- a/example/macos/Flutter/Flutter-Release.xcconfig +++ b/example/macos/Flutter/Flutter-Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Podfile b/example/macos/Podfile new file mode 100644 index 0000000..c795730 --- /dev/null +++ b/example/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock new file mode 100644 index 0000000..25408db --- /dev/null +++ b/example/macos/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - FlutterMacOS (1.0.0) + - frostdart (0.0.1): + - FlutterMacOS + +DEPENDENCIES: + - FlutterMacOS (from `Flutter/ephemeral`) + - frostdart (from `Flutter/ephemeral/.symlinks/plugins/frostdart/macos`) + +EXTERNAL SOURCES: + FlutterMacOS: + :path: Flutter/ephemeral + frostdart: + :path: Flutter/ephemeral/.symlinks/plugins/frostdart/macos + +SPEC CHECKSUMS: + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + frostdart: c6f034811a19d3db383d7de0051278d968e0ba33 + +PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 + +COCOAPODS: 1.12.1 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 446c27e..0257825 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -27,6 +27,11 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 43DC9B10F6B641C478448273 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3963DE7D96BAFBE9EC455F93 /* Pods_Runner.framework */; }; + 471E685F7127011C557CF566 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CB8CBA2D04512D07A1F9686 /* Pods_RunnerTests.framework */; }; + 59076DDD2A9FAFF800934543 /* frostdart.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 59076DDC2A9FAFF800934543 /* frostdart.dylib */; settings = {ATTRIBUTES = (Weak, ); }; }; + 59076DDF2A9FB03100934543 /* frostdart.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 59076DDE2A9FB03100934543 /* frostdart.dylib */; }; + 59076DE02A9FB06400934543 /* frostdart.dylib in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 59076DDC2A9FAFF800934543 /* frostdart.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -53,6 +58,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( + 59076DE02A9FB06400934543 /* frostdart.dylib in Bundle Framework */, ); name = "Bundle Framework"; runOnlyForDeploymentPostprocessing = 0; @@ -60,11 +66,13 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0441D6BBF18804CA3A113796 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 1CB8CBA2D04512D07A1F9686 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* frostdart_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "frostdart_example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* frostdart_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = frostdart_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -76,8 +84,16 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 3963DE7D96BAFBE9EC455F93 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 40DB202C94EEEAC860A07890 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 59076DDC2A9FAFF800934543 /* frostdart.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = frostdart.dylib; path = ../../macos/frostdart.dylib; sourceTree = ""; }; + 59076DDE2A9FB03100934543 /* frostdart.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = frostdart.dylib; path = ../../macos/frostdart.dylib; sourceTree = ""; }; + 763E46EDEBE2E86AB3138324 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + AC3D3C6918558EC548778049 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + AE182DE5FECB3ED150E123DD /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + BAA5B22AF7A01A0E51BEDAB4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -85,6 +101,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 471E685F7127011C557CF566 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -92,12 +109,27 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 59076DDD2A9FAFF800934543 /* frostdart.dylib in Frameworks */, + 43DC9B10F6B641C478448273 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 25A9FB963D2D0A9948DAD6C1 /* Pods */ = { + isa = PBXGroup; + children = ( + 763E46EDEBE2E86AB3138324 /* Pods-Runner.debug.xcconfig */, + AE182DE5FECB3ED150E123DD /* Pods-Runner.release.xcconfig */, + BAA5B22AF7A01A0E51BEDAB4 /* Pods-Runner.profile.xcconfig */, + 0441D6BBF18804CA3A113796 /* Pods-RunnerTests.debug.xcconfig */, + AC3D3C6918558EC548778049 /* Pods-RunnerTests.release.xcconfig */, + 40DB202C94EEEAC860A07890 /* Pods-RunnerTests.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; 331C80D6294CF71000263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( @@ -120,11 +152,13 @@ 33CC10E42044A3C60003C045 = { isa = PBXGroup; children = ( + 59076DDE2A9FB03100934543 /* frostdart.dylib */, 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + 25A9FB963D2D0A9948DAD6C1 /* Pods */, ); sourceTree = ""; }; @@ -175,6 +209,9 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + 59076DDC2A9FAFF800934543 /* frostdart.dylib */, + 3963DE7D96BAFBE9EC455F93 /* Pods_Runner.framework */, + 1CB8CBA2D04512D07A1F9686 /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -186,6 +223,7 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( + 967901B73314F7D8FCFB8853 /* [CP] Check Pods Manifest.lock */, 331C80D1294CF70F00263BE5 /* Sources */, 331C80D2294CF70F00263BE5 /* Frameworks */, 331C80D3294CF70F00263BE5 /* Resources */, @@ -204,6 +242,7 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + F24E661F86D44E4A0E61EE35 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, @@ -282,6 +321,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 59076DDF2A9FB03100934543 /* frostdart.dylib in Resources */, 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, ); @@ -328,6 +368,50 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + 967901B73314F7D8FCFB8853 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + F24E661F86D44E4A0E61EE35 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -379,6 +463,7 @@ /* Begin XCBuildConfiguration section */ 331C80DB294CF71000263BE5 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 0441D6BBF18804CA3A113796 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -393,6 +478,7 @@ }; 331C80DC294CF71000263BE5 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = AC3D3C6918558EC548778049 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -407,6 +493,7 @@ }; 331C80DD294CF71000263BE5 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 40DB202C94EEEAC860A07890 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -605,6 +692,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + "LIBRARY_SEARCH_PATHS[arch=*]" = $PROJECT_DIR/../../macos; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -625,6 +713,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + "LIBRARY_SEARCH_PATHS[arch=*]" = $PROJECT_DIR/../../macos; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; diff --git a/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/example/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/example/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/pubspec.lock b/example/pubspec.lock index d8c9eef..862fd4f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -208,5 +208,5 @@ packages: source: hosted version: "2.1.4" sdks: - dart: ">=3.0.6 <4.0.0" + dart: ">=3.0.5 <4.0.0" flutter: ">=3.10.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 6502fd5..ceac701 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=3.0.6 <4.0.0' + sdk: '>=3.0.5 <4.0.0' # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/lib/frostdart.dart b/lib/frostdart.dart index 5d5e808..066c540 100644 --- a/lib/frostdart.dart +++ b/lib/frostdart.dart @@ -11,10 +11,13 @@ const String _libName = 'frostdart'; /// The dynamic library in which the symbols for [FrostdartBindings] can be found. final ffi.DynamicLibrary _dylib = () { - if (Platform.isMacOS || Platform.isIOS) { + if (Platform.isIOS) { return ffi.DynamicLibrary.process(); // return ffi.DynamicLibrary.open('$_libName.framework/$_libName'); } + if (Platform.isMacOS) { + return ffi.DynamicLibrary.open('$_libName.dylib'); + } if (Platform.isAndroid || Platform.isLinux) { return ffi.DynamicLibrary.open('$_libName.so'); } From ac938064f7682eccd793f6bf0ed68f792b35e902 Mon Sep 17 00:00:00 2001 From: Likho Date: Wed, 30 Aug 2023 20:01:06 +0200 Subject: [PATCH 04/14] Build aarch64 for now, need to check building both --- pubspec.yaml | 2 +- scripts/macos/build_all.sh | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 163cba7..e5b067e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.0.1 homepage: environment: - sdk: '>=3.0.6 <4.0.0' + sdk: '>=3.0.5 <4.0.0' flutter: ">=3.10.0" dependencies: diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh index a83033e..44421e4 100755 --- a/scripts/macos/build_all.sh +++ b/scripts/macos/build_all.sh @@ -11,8 +11,6 @@ rm -rf "$ROOT_DIR"/src/serai/target cd "$ROOT_DIR"/src/serai/hrf || exit echo "Building macos frostdart" -cargo lipo --release --targets aarch64-apple-darwin,x86_64-apple-darwin -mkdir -p build "$ROOT_DIR"/macos/libs -#mkdir -p build "$ROOT_DIR"/macos/include -cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/macos/libs/libfrostdart.a -#cp header.h "$ROOT_DIR"/macos/include/header.h \ No newline at end of file +cargo lipo --release --targets aarch64-apple-darwin + +cp ../target/aarch64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib \ No newline at end of file From ef1249a06de6dedc7a6619d82d7657bc63d65b9d Mon Sep 17 00:00:00 2001 From: Likho Date: Wed, 30 Aug 2023 20:16:57 +0200 Subject: [PATCH 05/14] Correctly check os platform --- scripts/macos/build_all.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh index 44421e4..c9c0e43 100755 --- a/scripts/macos/build_all.sh +++ b/scripts/macos/build_all.sh @@ -11,6 +11,10 @@ rm -rf "$ROOT_DIR"/src/serai/target cd "$ROOT_DIR"/src/serai/hrf || exit echo "Building macos frostdart" -cargo lipo --release --targets aarch64-apple-darwin +cargo lipo --release --targets aarch64-apple-darwin,x86_64-apple-darwin -cp ../target/aarch64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib \ No newline at end of file +if [[ $(uname -m) == 'arm64' ]]; then + cp ../target/aarch64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib +else + cp ../target/x86_64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib +fi \ No newline at end of file From bbb2c9b8ebf432c791f82962141adc231e1550ea Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 30 Aug 2023 17:28:18 -0600 Subject: [PATCH 06/14] wrap resharer config salt getter --- lib/frostdart.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/frostdart.dart b/lib/frostdart.dart index 5d5e808..c852363 100644 --- a/lib/frostdart.dart +++ b/lib/frostdart.dart @@ -662,6 +662,17 @@ String resharerNewParticipant({ return string; } +Uint8List resharerSalt({ + required String resharerConfig, +}) { + final resharerConfigPointer = + decodeResharerConfig(resharerConfig: resharerConfig); + final uint8Pointer = _bindings.resharer_salt(resharerConfigPointer); + final bytes = uint8Pointer.asTypedList(SALT_BYTES_LENGTH); + + return bytes; +} + String newResharerConfig({ required int newThreshold, required List resharers, From 1dc73d5f1c8e0cdf45d3734fe05f721930fa756e Mon Sep 17 00:00:00 2001 From: julian-CStack Date: Tue, 29 Aug 2023 07:44:48 -0600 Subject: [PATCH 07/14] WIP macos build --- scripts/macos/build_all.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/macos/build_all.sh diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh new file mode 100755 index 0000000..61dce2e --- /dev/null +++ b/scripts/macos/build_all.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ROOT_DIR="$(pwd)/../.." + +export MACOSX_DEPLOYMENT_TARGET=10.14 + +mkdir -p build + +rm -rf "$ROOT_DIR"/src/serai/target + +cd "$ROOT_DIR"/src/serai/hrf || exit + +echo "Building macos frostdart" +cargo lipo --release --targets aarch64-apple-darwin,x86_64-apple-darwin +cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/macos/frostdart.a \ No newline at end of file From e81e2d89196f3a7d903759ff4060091703a2969d Mon Sep 17 00:00:00 2001 From: julian-CStack Date: Tue, 29 Aug 2023 08:52:52 -0600 Subject: [PATCH 08/14] WIP macos build pt2 --- lib/frostdart.dart | 3 ++- macos/Classes/frostdart.c | 2 +- macos/frostdart.podspec | 6 ++---- scripts/macos/build_all.sh | 5 ++++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/frostdart.dart b/lib/frostdart.dart index cc22e17..5d5e808 100644 --- a/lib/frostdart.dart +++ b/lib/frostdart.dart @@ -12,7 +12,8 @@ const String _libName = 'frostdart'; /// The dynamic library in which the symbols for [FrostdartBindings] can be found. final ffi.DynamicLibrary _dylib = () { if (Platform.isMacOS || Platform.isIOS) { - return ffi.DynamicLibrary.open('$_libName.framework/$_libName'); + return ffi.DynamicLibrary.process(); + // return ffi.DynamicLibrary.open('$_libName.framework/$_libName'); } if (Platform.isAndroid || Platform.isLinux) { return ffi.DynamicLibrary.open('$_libName.so'); diff --git a/macos/Classes/frostdart.c b/macos/Classes/frostdart.c index defb6c7..e2fe9b3 100644 --- a/macos/Classes/frostdart.c +++ b/macos/Classes/frostdart.c @@ -1,3 +1,3 @@ // Relative import to be able to reuse the C sources. // See the comment in ../{projectName}}.podspec for more information. -#include "../../src/frostdart.c" +#include "../../src/serai/hrf/header.h" diff --git a/macos/frostdart.podspec b/macos/frostdart.podspec index 5c70e92..85e530e 100644 --- a/macos/frostdart.podspec +++ b/macos/frostdart.podspec @@ -13,12 +13,10 @@ A new Flutter project. s.license = { :file => '../LICENSE' } s.author = { 'Your Company' => 'email@example.com' } - # This will ensure the source files in Classes/ are included in the native - # builds of apps using this FFI plugin. Podspec does not support relative - # paths, so Classes contains a forwarder C file that relatively imports - # `../src/*` so that the C sources can be shared among all target platforms. s.source = { :path => '.' } s.source_files = 'Classes/**/*' + s.static_framework = true + s.vendored_libraries = "**/*.a" s.dependency 'FlutterMacOS' s.platform = :osx, '10.11' diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh index 61dce2e..a83033e 100755 --- a/scripts/macos/build_all.sh +++ b/scripts/macos/build_all.sh @@ -12,4 +12,7 @@ cd "$ROOT_DIR"/src/serai/hrf || exit echo "Building macos frostdart" cargo lipo --release --targets aarch64-apple-darwin,x86_64-apple-darwin -cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/macos/frostdart.a \ No newline at end of file +mkdir -p build "$ROOT_DIR"/macos/libs +#mkdir -p build "$ROOT_DIR"/macos/include +cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/macos/libs/libfrostdart.a +#cp header.h "$ROOT_DIR"/macos/include/header.h \ No newline at end of file From 554a25291ddbf703f94425a17f7ebcbab83bb3a3 Mon Sep 17 00:00:00 2001 From: Likho Date: Wed, 30 Aug 2023 19:23:02 +0200 Subject: [PATCH 09/14] Macos run --- example/ios/Podfile | 44 +++++++++ example/macos/Flutter/Flutter-Debug.xcconfig | 1 + .../macos/Flutter/Flutter-Release.xcconfig | 1 + example/macos/Podfile | 43 +++++++++ example/macos/Podfile.lock | 22 +++++ .../macos/Runner.xcodeproj/project.pbxproj | 91 ++++++++++++++++++- .../contents.xcworkspacedata | 3 + example/pubspec.lock | 2 +- example/pubspec.yaml | 2 +- lib/frostdart.dart | 5 +- 10 files changed, 210 insertions(+), 4 deletions(-) create mode 100644 example/ios/Podfile create mode 100644 example/macos/Podfile create mode 100644 example/macos/Podfile.lock diff --git a/example/ios/Podfile b/example/ios/Podfile new file mode 100644 index 0000000..fdcc671 --- /dev/null +++ b/example/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '11.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/macos/Flutter/Flutter-Debug.xcconfig b/example/macos/Flutter/Flutter-Debug.xcconfig index c2efd0b..4b81f9b 100644 --- a/example/macos/Flutter/Flutter-Debug.xcconfig +++ b/example/macos/Flutter/Flutter-Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Flutter/Flutter-Release.xcconfig b/example/macos/Flutter/Flutter-Release.xcconfig index c2efd0b..5caa9d1 100644 --- a/example/macos/Flutter/Flutter-Release.xcconfig +++ b/example/macos/Flutter/Flutter-Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Podfile b/example/macos/Podfile new file mode 100644 index 0000000..c795730 --- /dev/null +++ b/example/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock new file mode 100644 index 0000000..25408db --- /dev/null +++ b/example/macos/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - FlutterMacOS (1.0.0) + - frostdart (0.0.1): + - FlutterMacOS + +DEPENDENCIES: + - FlutterMacOS (from `Flutter/ephemeral`) + - frostdart (from `Flutter/ephemeral/.symlinks/plugins/frostdart/macos`) + +EXTERNAL SOURCES: + FlutterMacOS: + :path: Flutter/ephemeral + frostdart: + :path: Flutter/ephemeral/.symlinks/plugins/frostdart/macos + +SPEC CHECKSUMS: + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + frostdart: c6f034811a19d3db383d7de0051278d968e0ba33 + +PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 + +COCOAPODS: 1.12.1 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 446c27e..0257825 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -27,6 +27,11 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 43DC9B10F6B641C478448273 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3963DE7D96BAFBE9EC455F93 /* Pods_Runner.framework */; }; + 471E685F7127011C557CF566 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CB8CBA2D04512D07A1F9686 /* Pods_RunnerTests.framework */; }; + 59076DDD2A9FAFF800934543 /* frostdart.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 59076DDC2A9FAFF800934543 /* frostdart.dylib */; settings = {ATTRIBUTES = (Weak, ); }; }; + 59076DDF2A9FB03100934543 /* frostdart.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 59076DDE2A9FB03100934543 /* frostdart.dylib */; }; + 59076DE02A9FB06400934543 /* frostdart.dylib in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 59076DDC2A9FAFF800934543 /* frostdart.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -53,6 +58,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( + 59076DE02A9FB06400934543 /* frostdart.dylib in Bundle Framework */, ); name = "Bundle Framework"; runOnlyForDeploymentPostprocessing = 0; @@ -60,11 +66,13 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0441D6BBF18804CA3A113796 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 1CB8CBA2D04512D07A1F9686 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* frostdart_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "frostdart_example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* frostdart_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = frostdart_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -76,8 +84,16 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 3963DE7D96BAFBE9EC455F93 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 40DB202C94EEEAC860A07890 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 59076DDC2A9FAFF800934543 /* frostdart.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = frostdart.dylib; path = ../../macos/frostdart.dylib; sourceTree = ""; }; + 59076DDE2A9FB03100934543 /* frostdart.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = frostdart.dylib; path = ../../macos/frostdart.dylib; sourceTree = ""; }; + 763E46EDEBE2E86AB3138324 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + AC3D3C6918558EC548778049 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + AE182DE5FECB3ED150E123DD /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + BAA5B22AF7A01A0E51BEDAB4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -85,6 +101,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 471E685F7127011C557CF566 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -92,12 +109,27 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 59076DDD2A9FAFF800934543 /* frostdart.dylib in Frameworks */, + 43DC9B10F6B641C478448273 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 25A9FB963D2D0A9948DAD6C1 /* Pods */ = { + isa = PBXGroup; + children = ( + 763E46EDEBE2E86AB3138324 /* Pods-Runner.debug.xcconfig */, + AE182DE5FECB3ED150E123DD /* Pods-Runner.release.xcconfig */, + BAA5B22AF7A01A0E51BEDAB4 /* Pods-Runner.profile.xcconfig */, + 0441D6BBF18804CA3A113796 /* Pods-RunnerTests.debug.xcconfig */, + AC3D3C6918558EC548778049 /* Pods-RunnerTests.release.xcconfig */, + 40DB202C94EEEAC860A07890 /* Pods-RunnerTests.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; 331C80D6294CF71000263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( @@ -120,11 +152,13 @@ 33CC10E42044A3C60003C045 = { isa = PBXGroup; children = ( + 59076DDE2A9FB03100934543 /* frostdart.dylib */, 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + 25A9FB963D2D0A9948DAD6C1 /* Pods */, ); sourceTree = ""; }; @@ -175,6 +209,9 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + 59076DDC2A9FAFF800934543 /* frostdart.dylib */, + 3963DE7D96BAFBE9EC455F93 /* Pods_Runner.framework */, + 1CB8CBA2D04512D07A1F9686 /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -186,6 +223,7 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( + 967901B73314F7D8FCFB8853 /* [CP] Check Pods Manifest.lock */, 331C80D1294CF70F00263BE5 /* Sources */, 331C80D2294CF70F00263BE5 /* Frameworks */, 331C80D3294CF70F00263BE5 /* Resources */, @@ -204,6 +242,7 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + F24E661F86D44E4A0E61EE35 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, @@ -282,6 +321,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 59076DDF2A9FB03100934543 /* frostdart.dylib in Resources */, 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, ); @@ -328,6 +368,50 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + 967901B73314F7D8FCFB8853 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + F24E661F86D44E4A0E61EE35 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -379,6 +463,7 @@ /* Begin XCBuildConfiguration section */ 331C80DB294CF71000263BE5 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 0441D6BBF18804CA3A113796 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -393,6 +478,7 @@ }; 331C80DC294CF71000263BE5 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = AC3D3C6918558EC548778049 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -407,6 +493,7 @@ }; 331C80DD294CF71000263BE5 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 40DB202C94EEEAC860A07890 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -605,6 +692,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + "LIBRARY_SEARCH_PATHS[arch=*]" = $PROJECT_DIR/../../macos; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -625,6 +713,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + "LIBRARY_SEARCH_PATHS[arch=*]" = $PROJECT_DIR/../../macos; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; diff --git a/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/example/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/example/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/pubspec.lock b/example/pubspec.lock index d8c9eef..862fd4f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -208,5 +208,5 @@ packages: source: hosted version: "2.1.4" sdks: - dart: ">=3.0.6 <4.0.0" + dart: ">=3.0.5 <4.0.0" flutter: ">=3.10.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 6502fd5..ceac701 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=3.0.6 <4.0.0' + sdk: '>=3.0.5 <4.0.0' # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/lib/frostdart.dart b/lib/frostdart.dart index 5d5e808..066c540 100644 --- a/lib/frostdart.dart +++ b/lib/frostdart.dart @@ -11,10 +11,13 @@ const String _libName = 'frostdart'; /// The dynamic library in which the symbols for [FrostdartBindings] can be found. final ffi.DynamicLibrary _dylib = () { - if (Platform.isMacOS || Platform.isIOS) { + if (Platform.isIOS) { return ffi.DynamicLibrary.process(); // return ffi.DynamicLibrary.open('$_libName.framework/$_libName'); } + if (Platform.isMacOS) { + return ffi.DynamicLibrary.open('$_libName.dylib'); + } if (Platform.isAndroid || Platform.isLinux) { return ffi.DynamicLibrary.open('$_libName.so'); } From e82dd0685dff953a1dfb076118021abb03739f4f Mon Sep 17 00:00:00 2001 From: Likho Date: Wed, 30 Aug 2023 20:01:06 +0200 Subject: [PATCH 10/14] Build aarch64 for now, need to check building both --- pubspec.yaml | 2 +- scripts/macos/build_all.sh | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 163cba7..e5b067e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.0.1 homepage: environment: - sdk: '>=3.0.6 <4.0.0' + sdk: '>=3.0.5 <4.0.0' flutter: ">=3.10.0" dependencies: diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh index a83033e..44421e4 100755 --- a/scripts/macos/build_all.sh +++ b/scripts/macos/build_all.sh @@ -11,8 +11,6 @@ rm -rf "$ROOT_DIR"/src/serai/target cd "$ROOT_DIR"/src/serai/hrf || exit echo "Building macos frostdart" -cargo lipo --release --targets aarch64-apple-darwin,x86_64-apple-darwin -mkdir -p build "$ROOT_DIR"/macos/libs -#mkdir -p build "$ROOT_DIR"/macos/include -cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/macos/libs/libfrostdart.a -#cp header.h "$ROOT_DIR"/macos/include/header.h \ No newline at end of file +cargo lipo --release --targets aarch64-apple-darwin + +cp ../target/aarch64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib \ No newline at end of file From 94770a4ec6dc4190311e562cc1edd33cdc6a0427 Mon Sep 17 00:00:00 2001 From: Likho Date: Wed, 30 Aug 2023 20:16:57 +0200 Subject: [PATCH 11/14] Correctly check os platform --- scripts/macos/build_all.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh index 44421e4..c9c0e43 100755 --- a/scripts/macos/build_all.sh +++ b/scripts/macos/build_all.sh @@ -11,6 +11,10 @@ rm -rf "$ROOT_DIR"/src/serai/target cd "$ROOT_DIR"/src/serai/hrf || exit echo "Building macos frostdart" -cargo lipo --release --targets aarch64-apple-darwin +cargo lipo --release --targets aarch64-apple-darwin,x86_64-apple-darwin -cp ../target/aarch64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib \ No newline at end of file +if [[ $(uname -m) == 'arm64' ]]; then + cp ../target/aarch64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib +else + cp ../target/x86_64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib +fi \ No newline at end of file From 852fb63300aecd7bf16e968ceba7aafe26990c85 Mon Sep 17 00:00:00 2001 From: Julian Date: Thu, 18 Jan 2024 09:19:03 -0600 Subject: [PATCH 12/14] macos build clean up --- .gitignore | 2 ++ example/macos/Podfile.lock | 4 ++-- macos/Classes/frostdart.c | 3 --- macos/frostdart.podspec | 1 - scripts/macos/build_all.sh | 3 ++- 5 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 macos/Classes/frostdart.c diff --git a/.gitignore b/.gitignore index 59d1dcb..0bbb9c2 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ build/ .flutter-plugins-dependencies android/src/main/jniLibs/ + +macos/frostdart.dylib diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 25408db..d1ba120 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -15,8 +15,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - frostdart: c6f034811a19d3db383d7de0051278d968e0ba33 + frostdart: e6bf3119527ccfbcec1b8767da6ede5bb4c4f716 PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 -COCOAPODS: 1.12.1 +COCOAPODS: 1.11.3 diff --git a/macos/Classes/frostdart.c b/macos/Classes/frostdart.c deleted file mode 100644 index e2fe9b3..0000000 --- a/macos/Classes/frostdart.c +++ /dev/null @@ -1,3 +0,0 @@ -// Relative import to be able to reuse the C sources. -// See the comment in ../{projectName}}.podspec for more information. -#include "../../src/serai/hrf/header.h" diff --git a/macos/frostdart.podspec b/macos/frostdart.podspec index 85e530e..f5971d6 100644 --- a/macos/frostdart.podspec +++ b/macos/frostdart.podspec @@ -14,7 +14,6 @@ A new Flutter project. s.author = { 'Your Company' => 'email@example.com' } s.source = { :path => '.' } - s.source_files = 'Classes/**/*' s.static_framework = true s.vendored_libraries = "**/*.a" s.dependency 'FlutterMacOS' diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh index c9c0e43..8481475 100755 --- a/scripts/macos/build_all.sh +++ b/scripts/macos/build_all.sh @@ -11,10 +11,11 @@ rm -rf "$ROOT_DIR"/src/serai/target cd "$ROOT_DIR"/src/serai/hrf || exit echo "Building macos frostdart" -cargo lipo --release --targets aarch64-apple-darwin,x86_64-apple-darwin if [[ $(uname -m) == 'arm64' ]]; then + cargo lipo --release --targets aarch64-apple-darwin cp ../target/aarch64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib else + cargo lipo --release --targets x86_64-apple-darwin cp ../target/x86_64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib fi \ No newline at end of file From 2f19d43135b1ef6571f62fc1c1ea6ff6ae4625f6 Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 1 Sep 2023 12:38:06 -0600 Subject: [PATCH 13/14] WIP: ios build --- scripts/ios/build_all.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 scripts/ios/build_all.sh diff --git a/scripts/ios/build_all.sh b/scripts/ios/build_all.sh new file mode 100755 index 0000000..ddb9a9a --- /dev/null +++ b/scripts/ios/build_all.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +ROOT_DIR="$(pwd)/../.." + +mkdir -p build + +rm -rf "$ROOT_DIR"/src/serai/target + +cd "$ROOT_DIR"/src/serai/hrf || exit + +echo "Building ios frostdart" +cargo lipo --release +cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/ios/frostdart.a \ No newline at end of file From 488c1d38133086f6fbbb51f95f07a477bf98ec6c Mon Sep 17 00:00:00 2001 From: ryleedavis Date: Fri, 1 Sep 2023 12:40:05 -0600 Subject: [PATCH 14/14] WIP: ios build --- lib/frostdart.dart | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/frostdart.dart b/lib/frostdart.dart index 7f47197..066c540 100644 --- a/lib/frostdart.dart +++ b/lib/frostdart.dart @@ -665,17 +665,6 @@ String resharerNewParticipant({ return string; } -Uint8List resharerSalt({ - required String resharerConfig, -}) { - final resharerConfigPointer = - decodeResharerConfig(resharerConfig: resharerConfig); - final uint8Pointer = _bindings.resharer_salt(resharerConfigPointer); - final bytes = uint8Pointer.asTypedList(SALT_BYTES_LENGTH); - - return bytes; -} - String newResharerConfig({ required int newThreshold, required List resharers,