From bd02c1febfc53aa757964f937a586c08fbeab393 Mon Sep 17 00:00:00 2001 From: m Date: Mon, 6 May 2024 21:41:40 +0100 Subject: [PATCH] Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script. --- configure_cake_wallet.sh | 8 ++- howto-build-ios.md | 101 +++++++++++++++++++++++++++++ howto-build-macos.md | 103 ++++++++++++++++++++++++++++++ ios/Podfile.lock | 27 -------- macos/Podfile.lock | 21 ------ scripts/ios/build_monero_all.sh | 2 +- scripts/macos/build_monero_all.sh | 2 +- 7 files changed, 213 insertions(+), 51 deletions(-) create mode 100644 howto-build-ios.md create mode 100644 howto-build-macos.md diff --git a/configure_cake_wallet.sh b/configure_cake_wallet.sh index d18f6c22a..2eb6d8f25 100755 --- a/configure_cake_wallet.sh +++ b/configure_cake_wallet.sh @@ -2,8 +2,9 @@ IOS="ios" ANDROID="android" +MACOS="macos" -PLATFORMS=($IOS $ANDROID) +PLATFORMS=($IOS $ANDROID $MACOS) PLATFORM=$1 if ! [[ " ${PLATFORMS[*]} " =~ " ${PLATFORM} " ]]; then @@ -16,6 +17,11 @@ if [ "$PLATFORM" == "$IOS" ]; then cd scripts/ios fi +if [ "$PLATFORM" == "$MACOS" ]; then + echo "Configuring for macOS" + cd scripts/macos +fi + if [ "$PLATFORM" == "$ANDROID" ]; then echo "Configuring for Android" cd scripts/android diff --git a/howto-build-ios.md b/howto-build-ios.md new file mode 100644 index 000000000..3abf3e915 --- /dev/null +++ b/howto-build-ios.md @@ -0,0 +1,101 @@ +# Building CakeWallet for iOS + +## Requirements and Setup + +The following are the system requirements to build CakeWallet for your iOS device. + +``` +macOS >= 14.0 +Xcode 15.3 +Flutter 3.10.x +``` + +## Building CakeWallet on iOS + +These steps will help you configure and execute a build of CakeWallet from its source code. + +### 1. Installing Package Dependencies + +CakeWallet cannot be built without the following packages installed on your build system. + +For installing dependency tools you can use brew [Install brew](https://brew.sh). + +You may easily install them on your build system with the following command: + +`$ brew install cmake xz cocoapods` + +### 2. Installing Xcode + +You may download and install the latest version of [Xcode](https://developer.apple.com/xcode/) from macOS App Store. + +### 3. Installing Flutter + +Need to install flutter with version `3.10.x`. For this please check section [Install Flutter](https://docs.flutter.dev/get-started/install/macos/mobile-ios?tab=download). + +### 4. Verify Installations + +Verify that the Flutter and Xcode have been correctly installed on your system with the following command: + +`$ flutter doctor` + +The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding. +``` +Doctor summary (to see all details, run flutter doctor -v): +[✓] Flutter (Channel stable, 3.10.x, on macOS 14.x.x) +[✓] Xcode - develop for iOS and macOS (Xcode 15.3) +``` + +### 5. Acquiring the CakeWallet source code + +Download the source code. + +`$ git clone https://github.com/cake-tech/cake_wallet.git --branch main` + +Proceed into the source code before proceeding with the next steps: + +`$ cd cake_wallet/scripts/ios/` + +### 6. Execute Build & Setup Commands for CakeWallet + +We need to generate project settings like app name, app icon, package name, etc. For this need to setup environment variables and configure project files. + +Please pick what app you want to build: cakewallet or monero.com. + +`$ source ./app_env.sh ` +(it should be like `$ source ./app_env.sh cakewallet` or `$ source ./app_env.sh monero.com`) + +Then run configuration script for setup app name, app icon and etc: + +`$ ./app_config.sh` + +Build the Monero libraries and their dependencies: + +`$ ./build_monero_all.sh` + +It is now time to change back to the base directory of the CakeWallet source code: + +`$ cd ../../` + +Install Flutter package dependencies with this command: + +`$ flutter pub get` + +Your CakeWallet binary will be built with cryptographic salts, which are used for secure encryption of your data. You may generate these secret salts with the following command: + +`$ flutter packages pub run tool/generate_new_secrets.dart` + +Then we need to generate localization files and mobx models. + +`$ ./configure_cake_wallet.sh ios` + +### 7. Build! + +`$ flutter build ios --release` + +Then you can open `ios/Runner.xcworkspace` with Xcode and you can to archive the application. + +Or if you want to run to connected device: + +`$ flutter run --release` + +Copyright (c) 2024 Cake Technologies LLC. diff --git a/howto-build-macos.md b/howto-build-macos.md new file mode 100644 index 000000000..c8cc5bf52 --- /dev/null +++ b/howto-build-macos.md @@ -0,0 +1,103 @@ +# Building CakeWallet for macOS + +## Requirements and Setup + +The following are the system requirements to build CakeWallet for your macOS device. + +``` +macOS >= 14.0 +Xcode 15.3 +Flutter 3.10.x +``` + +## Building CakeWallet on macOS + +These steps will help you configure and execute a build of CakeWallet from its source code. + +### 1. Installing Package Dependencies + +CakeWallet cannot be built without the following packages installed on your build system. + +For installing dependency tools you can use brew [Install brew](https://brew.sh). + +You may easily install them on your build system with the following command: + +`$ brew install cmake xz unbound boost@1.76 zmq cocoapods` + +`$ brew link boost@1.76` + +### 2. Installing Xcode + +You may download and install the latest version of [Xcode](https://developer.apple.com/xcode/) from macOS App Store. + +### 3. Installing Flutter + +Need to install flutter with version `3.10.x`. For this please check section [Install Flutter](https://docs.flutter.dev/get-started/install/macos/desktop?tab=download). + +### 4. Verify Installations + +Verify that Flutter and Xcode have been correctly installed on your system with the following command: + +`$ flutter doctor` + +The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding. +``` +Doctor summary (to see all details, run flutter doctor -v): +[✓] Flutter (Channel stable, 3.10.x, on macOS 14.x.x) +[✓] Xcode - develop for iOS and macOS (Xcode 15.3) +``` + +### 5. Acquiring the CakeWallet source code + +Download the source code. + +`$ git clone https://github.com/cake-tech/cake_wallet.git --branch main` + +Proceed into the source code before proceeding with the next steps: + +`$ cd cake_wallet/scripts/macos/` + +### 6. Execute Build & Setup Commands for CakeWallet + +We need to generate project settings like app name, app icon, package name, etc. For this need to setup environment variables and configure project files. + +Please pick what app you want to build: cakewallet or monero.com. + +`$ source ./app_env.sh ` +(it should be like `$ source ./app_env.sh cakewallet` or `$ source ./app_env.sh monero.com`) + +Then run configuration script for setup app name, app icon and etc: + +`$ ./app_config.sh` + +Build the Monero libraries and their dependencies: + +`$ ./build_monero_all.sh` + +It is now time to change back to the base directory of the CakeWallet source code: + +`$ cd ../../` + +Install Flutter package dependencies with this command: + +`$ flutter pub get` + +Your CakeWallet binary will be built with cryptographic salts, which are used for secure encryption of your data. You may generate these secret salts with the following command: + +`$ flutter packages pub run tool/generate_new_secrets.dart` + +Then we need to generate localization files and mobx models. + +`$ ./configure_cake_wallet.sh macos` + +### 7. Build! + +`$ flutter build macos --release` + +Then you can open `macos/Runner.xcworkspace` with Xcode and you can to archive the application. + +Or if you want to run to connected device: + +`$ flutter run --release` + +Copyright (c) 2024 Cake Technologies LLC. diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 67c0c9ee8..68003b8fe 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -27,29 +27,6 @@ PODS: - cw_haven/Sodium (0.0.1): - cw_shared_external - Flutter - - cw_monero (0.0.2): - - cw_monero/Boost (= 0.0.2) - - cw_monero/Monero (= 0.0.2) - - cw_monero/OpenSSL (= 0.0.2) - - cw_monero/Sodium (= 0.0.2) - - cw_monero/Unbound (= 0.0.2) - - cw_shared_external - - Flutter - - cw_monero/Boost (0.0.2): - - cw_shared_external - - Flutter - - cw_monero/Monero (0.0.2): - - cw_shared_external - - Flutter - - cw_monero/OpenSSL (0.0.2): - - cw_shared_external - - Flutter - - cw_monero/Sodium (0.0.2): - - cw_shared_external - - Flutter - - cw_monero/Unbound (0.0.2): - - cw_shared_external - - Flutter - cw_shared_external (0.0.1): - cw_shared_external/Boost (= 0.0.1) - cw_shared_external/OpenSSL (= 0.0.1) @@ -162,7 +139,6 @@ DEPENDENCIES: - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - CryptoSwift - cw_haven (from `.symlinks/plugins/cw_haven/ios`) - - cw_monero (from `.symlinks/plugins/cw_monero/ios`) - cw_shared_external (from `.symlinks/plugins/cw_shared_external/ios`) - device_display_brightness (from `.symlinks/plugins/device_display_brightness/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) @@ -210,8 +186,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/connectivity_plus/ios" cw_haven: :path: ".symlinks/plugins/cw_haven/ios" - cw_monero: - :path: ".symlinks/plugins/cw_monero/ios" cw_shared_external: :path: ".symlinks/plugins/cw_shared_external/ios" device_display_brightness: @@ -265,7 +239,6 @@ SPEC CHECKSUMS: connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d CryptoSwift: b9c701d6f5011df23794dbf7f2e480a77835d83d cw_haven: b3e54e1fbe7b8e6fda57a93206bc38f8e89b898a - cw_monero: 4cf3b96f2da8e95e2ef7d6703dd4d2c509127b7d cw_shared_external: 2972d872b8917603478117c9957dfca611845a92 device_display_brightness: 1510e72c567a1f6ce6ffe393dcd9afd1426034f7 device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 diff --git a/macos/Podfile.lock b/macos/Podfile.lock index f83e18c40..261f76f06 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -2,23 +2,6 @@ PODS: - connectivity_plus (0.0.1): - FlutterMacOS - ReachabilitySwift - - cw_monero (0.0.1): - - cw_monero/Boost (= 0.0.1) - - cw_monero/Monero (= 0.0.1) - - cw_monero/OpenSSL (= 0.0.1) - - cw_monero/Sodium (= 0.0.1) - - cw_monero/Unbound (= 0.0.1) - - FlutterMacOS - - cw_monero/Boost (0.0.1): - - FlutterMacOS - - cw_monero/Monero (0.0.1): - - FlutterMacOS - - cw_monero/OpenSSL (0.0.1): - - FlutterMacOS - - cw_monero/Sodium (0.0.1): - - FlutterMacOS - - cw_monero/Unbound (0.0.1): - - FlutterMacOS - device_info_plus (0.0.1): - FlutterMacOS - devicelocale (0.0.1): @@ -52,7 +35,6 @@ PODS: DEPENDENCIES: - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`) - - cw_monero (from `Flutter/ephemeral/.symlinks/plugins/cw_monero/macos`) - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) - devicelocale (from `Flutter/ephemeral/.symlinks/plugins/devicelocale/macos`) - flutter_inappwebview_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos`) @@ -75,8 +57,6 @@ SPEC REPOS: EXTERNAL SOURCES: connectivity_plus: :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos - cw_monero: - :path: Flutter/ephemeral/.symlinks/plugins/cw_monero/macos device_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos devicelocale: @@ -106,7 +86,6 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747 - cw_monero: f8b7f104508efba2591548e76b5c058d05cba3f0 device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f devicelocale: 9f0f36ac651cabae2c33f32dcff4f32b61c38225 flutter_inappwebview_macos: 9600c9df9fdb346aaa8933812009f8d94304203d diff --git a/scripts/ios/build_monero_all.sh b/scripts/ios/build_monero_all.sh index 89ba7e804..261ebd710 100755 --- a/scripts/ios/build_monero_all.sh +++ b/scripts/ios/build_monero_all.sh @@ -12,7 +12,7 @@ set -x -e cd "$(dirname "$0")" -NPROC="-j$(nproc)" +NPROC="-j$(sysctl -n hw.logicalcpu)" ../prepare_moneroc.sh diff --git a/scripts/macos/build_monero_all.sh b/scripts/macos/build_monero_all.sh index 53083f1ca..ae9c8889b 100755 --- a/scripts/macos/build_monero_all.sh +++ b/scripts/macos/build_monero_all.sh @@ -3,7 +3,7 @@ set -x -e cd "$(dirname "$0")" -NPROC="-j$(nproc)" +NPROC="-j$(sysctl -n hw.logicalcpu)" ../prepare_moneroc.sh