Skip to content

Commit fa594c4

Browse files
committed
Merge remote-tracking branch 'bitwalt/feat/ci-multi-arch-rgb-node' into build
2 parents 1c76ee1 + 93b8064 commit fa594c4

5 files changed

Lines changed: 241 additions & 49 deletions

File tree

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,29 @@ jobs:
6363
- name: Install frontend dependencies
6464
run: pnpm install
6565

66+
# New steps for building rgb-lightning-node
67+
- name: Build rgb-lightning-node binary
68+
run: |
69+
if [[ "${{ matrix.platform }}" == "macos-latest" && "${{ matrix.args }}" == "--target aarch64-apple-darwin" ]]; then
70+
make build-arm-macos
71+
elif [[ "${{ matrix.platform }}" == "macos-latest" && "${{ matrix.args }}" == "--target x86_64-apple-darwin" ]]; then
72+
make build-x86-macos
73+
elif [[ "${{ matrix.platform }}" == "ubuntu-22.04" ]]; then
74+
# This assumes ubuntu-22.04 is for x86_64, which is typical for GitHub runners
75+
make build-x86-linux
76+
else
77+
echo "Unsupported platform/args combination for rgb-lightning-node build"
78+
exit 1
79+
fi
80+
shell: bash
81+
82+
- name: Verify rgb-lightning-node binary
83+
run: |
84+
ls -l bin/rgb-lightning-node
85+
file bin/rgb-lightning-node
86+
shell: bash
87+
# End of new steps
88+
6689
- name: Build Tauri app
6790
uses: tauri-apps/tauri-action@v0
6891
env:

Makefile

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,45 @@ help:
117117
@echo " make run-debug - Update repo, compile in debug mode and run the program"
118118
@echo " make clean - Clean the build files"
119119
@echo " make test - Update repo and run the tests"
120+
@echo " make build-arm-macos - Build the project for aarch64 macOS (Apple Silicon)"
121+
@echo " make build-x86-macos - Build the project for x86_64 macOS (Intel)"
122+
@echo " make build-x86-linux - Build the project for x86_64 Linux"
120123
@echo " make help - Show this help message"
121124

122-
.PHONY: all release debug run run-debug clean test help check_cargo check_cargo_env check_dependencies check_curl check_openssl clone_repo update_repo build
125+
check_arm_macos_target:
126+
@rustup target list --installed | grep aarch64-apple-darwin > /dev/null || \
127+
(echo "Error: Rust target aarch64-apple-darwin not installed." && \
128+
echo "Please install it by running: rustup target add aarch64-apple-darwin" && \
129+
exit 1)
130+
131+
build-arm-macos: check_dependencies check_cargo_env update_repo check_arm_macos_target
132+
cd $(PROJECT_DIR) && $(CARGO) build --target aarch64-apple-darwin --manifest-path $(PROJECT_DIR)/Cargo.toml
133+
@mkdir -p $(BIN_DIR)
134+
@cp $(PROJECT_DIR)/target/aarch64-apple-darwin/debug/$(PROJECT_NAME) $(BIN_DIR)/$(PROJECT_NAME)
135+
@echo "Successfully built aarch64 macOS binary at $(BIN_DIR)/$(PROJECT_NAME)"
136+
137+
check_x86_macos_target:
138+
@rustup target list --installed | grep x86_64-apple-darwin > /dev/null || \
139+
(echo "Error: Rust target x86_64-apple-darwin not installed." && \
140+
echo "Please install it by running: rustup target add x86_64-apple-darwin" && \
141+
exit 1)
142+
143+
build-x86-macos: check_dependencies check_cargo_env update_repo check_x86_macos_target
144+
cd $(PROJECT_DIR) && $(CARGO) build --target x86_64-apple-darwin --manifest-path $(PROJECT_DIR)/Cargo.toml
145+
@mkdir -p $(BIN_DIR)
146+
@cp $(PROJECT_DIR)/target/x86_64-apple-darwin/debug/$(PROJECT_NAME) $(BIN_DIR)/$(PROJECT_NAME)
147+
@echo "Successfully built x86_64 macOS binary at $(BIN_DIR)/$(PROJECT_NAME)"
148+
149+
check_x86_linux_target:
150+
@rustup target list --installed | grep x86_64-unknown-linux-gnu > /dev/null || \
151+
(echo "Error: Rust target x86_64-unknown-linux-gnu not installed." && \
152+
echo "Please install it by running: rustup target add x86_64-unknown-linux-gnu" && \
153+
exit 1)
154+
155+
build-x86-linux: check_dependencies check_cargo_env update_repo check_x86_linux_target
156+
cd $(PROJECT_DIR) && $(CARGO) build --target x86_64-unknown-linux-gnu --manifest-path $(PROJECT_DIR)/Cargo.toml
157+
@mkdir -p $(BIN_DIR)
158+
@cp $(PROJECT_DIR)/target/x86_64-unknown-linux-gnu/debug/$(PROJECT_NAME) $(BIN_DIR)/$(PROJECT_NAME)
159+
@echo "Successfully built x86_64 Linux binary at $(BIN_DIR)/$(PROJECT_NAME)"
160+
161+
.PHONY: all release debug run run-debug clean test help check_cargo check_cargo_env check_dependencies check_curl check_openssl clone_repo update_repo build check_arm_macos_target build-arm-macos check_x86_macos_target build-x86-macos check_x86_linux_target build-x86-linux

README.md

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
- [Building and Running](#building-and-running)
2727
- [Usage 💡](#usage-)
2828
- [Connecting to an RGB Lightning Node](#connecting-to-an-rgb-lightning-node)
29-
- [Trading and Swapping Assets](#trading-and-swapping-assets)
29+
- [Getting Started with Trading](#getting-started-with-trading)
3030
- [Managing Channels](#managing-channels)
3131
- [Deposits and Withdrawals](#deposits-and-withdrawals)
3232
- [Backup](#backup)
@@ -67,23 +67,16 @@ You can install the app in two ways:
6767
### 1. Download Binaries
6868

6969
1. Download the appropriate binary for your operating system from the [Releases](https://github.com/kaleidoswap/desktop-app/releases) page.
70-
2. Download both the binary file and its corresponding `.sig` signature file.
70+
2. Download the manifest.txt file and its corresponding `.sig` signature file.
7171
3. Import our public GPG key:
7272
```sh
73-
curl https://keybase.io/bitwalt/pgp_keys.asc | gpg --import
73+
curl https://github.com/bitwalt.gpg | gpg --import
7474
```
75-
4. Verify the signature:
75+
4. Verify the manifest signature:
7676
```sh
77-
# For Linux
78-
gpg --verify kaleido-swap_0.0.1_amd64.AppImage.sig kaleido-swap_0.0.1_amd64.AppImage
79-
80-
# For macOS
81-
gpg --verify Kaleido-Swap_0.0.1_x64.dmg.sig Kaleido-Swap_0.0.1_x64.dmg
82-
83-
# For Windows
84-
gpg --verify Kaleido-Swap_0.0.1_x64-setup.exe.sig Kaleido-Swap_0.0.1_x64-setup.exe
77+
gpg --verify manifest.txt.sig manifest.txt
8578
```
86-
5. Verify the SHA256 checksum of the binary.
79+
5. Verify the SHA256 checksum of your binary against the one listed in the manifest.txt file.
8780
6. Run the app by executing the binary.
8881

8982
### 2. Building Locally
@@ -116,6 +109,13 @@ You can install the app in two ways:
116109
3. **Tauri Prerequisites**
117110
Confirm correct installation of Rust, Node.js, npm, and pnpm.
118111

112+
#### Arch Linux (AUR)
113+
114+
- Install via an AUR helper like `yay`:
115+
```sh
116+
yay -S kaleidoswap
117+
```
118+
119119
#### Building and Running
120120

121121
1. **Install dependencies**:
@@ -124,30 +124,41 @@ You can install the app in two ways:
124124
```
125125
2. **Build the Tauri app**:
126126
```sh
127-
tauri build
127+
npm run tauri build
128128
```
129129
3. **Run Kaleidoswap in development mode**:
130130
```sh
131-
tauri dev
131+
npm run tauri dev
132132
```
133133

134134
## Usage 💡
135135

136136
### Connecting to an RGB Lightning Node
137137

138138
1. **Launch** Kaleidoswap.
139-
2. **Configure the Node** in the **Settings** page:
140-
- Connect to a local or remote instance of [rgb-lightning-node](https://github.com/RGB-Tools/rgb-lightning-node).
141-
- Provide the correct host/port and any additional configuration details required.
142-
143-
### Trading and Swapping Assets
144-
145-
1. **Select or Add a Market Maker** on the **Settings** page.
146-
- KaleidoSwap currently provides two built-in makers: one for **regtest** and another for **signet** (mutinynet). Supported assets and pairs can be found at [KaleidoSwap RGB Registry](https://registry.kaleidoswap.com/).
147-
2. **Check Supported Pairs**: Ensure you have at least one Lightning channel funded with the RGB asset you want to trade.
148-
- If you lack a channel, you can **buy one** from an LSP that supports your chosen RGB asset.
149-
3. **Initiate the Swap**:
150-
- Go to the trading interface, pick your maker and select a supported trading pair.
139+
2. **Setup Your Node**:
140+
- Create a new local node using the setup wizard, or
141+
- Connect to a remote instance of [rgb-lightning-node](https://github.com/RGB-Tools/rgb-lightning-node) by providing the correct host/port and any additional configuration details required.
142+
143+
### Getting Started with Trading
144+
145+
1. **Deposit Bitcoin**:
146+
- Use one of the available faucets to deposit some Bitcoin to your wallet.
147+
- Wait for the transaction to confirm.
148+
149+
2. **Buy a Channel with RGB Assets**:
150+
- Navigate to the **Buy New Channel** page.
151+
- Request a channel from an LSP, specifying capacity and the RGB asset you want included.
152+
- Wait for the channel to be opened and confirmed.
153+
154+
3. **Select or Add a Market Maker**:
155+
- KaleidoSwap currently provides two built-in makers: one for **regtest** and another for **signet** (mutinynet).
156+
- Supported assets and pairs can be found at [KaleidoSwap RGB Registry](https://registry.kaleidoswap.com/).
157+
- Go to the **Settings** page if you want to add a different market maker.
158+
159+
4. **Initiate the Swap**:
160+
- Go to the trading interface and select a supported trading pair.
161+
- Ensure you have at least one Lightning channel funded with the RGB asset you want to trade.
151162
- Accept the RFQ price to execute the swap.
152163

153164
> **Important**: Since Kaleidoswap is in alpha, swaps may fail or get stuck. Check the [docs](https://docs.kaleidoswap.com) for troubleshooting, and feel free to [open an issue](#support-) if you encounter problems.
@@ -221,4 +232,4 @@ Kaleidoswap is licensed under the [MIT License](LICENSE.md).
221232
- The software may contain bugs, errors, or security vulnerabilities that could result in the loss of funds.
222233
---
223234

224-
*Thanks for using Kaleidoswap! We're excited to see what you build, and we appreciate your feedback and contributions.*
235+
*Thanks for using Kaleidoswap! We're excited to see what you build, and we appreciate your feedback and contributions.*

docs/MACOS_X86_GUIDE.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Guide for Intel (x86_64) Mac Users: Compiling a Compatible rgb-lightning-node
2+
3+
## 1. Introduction
4+
5+
This guide is for users of Intel-based (x86_64) Macs who are using KaleidoSwap. The default KaleidoSwap application might ship with an ARM64 (Apple Silicon) version of the `rgb-lightning-node` binary. This binary is incompatible with Intel Macs and will prevent the RGB node features from working.
6+
7+
These instructions will help you compile an x86_64 version of `rgb-lightning-node` from the source and replace the incompatible binary within your KaleidoSwap application.
8+
9+
## 2. Prerequisites
10+
11+
Before you begin, ensure you have the following installed on your Mac:
12+
13+
* **Xcode Command Line Tools**: These provide essential development tools like `git` and compilers. If you don't have them, running `make check_dependencies` in the project (see compilation steps) should prompt you to install them. You can also manually install them by running `xcode-select --install` in your Terminal.
14+
* **Rust and Cargo**: The Rust programming language and its package manager, Cargo, are required. If you don't have them, the `make check_cargo_env` step (or simply `make`) in the project's Makefile will guide you through the installation via [rustup.rs](https://rustup.rs/).
15+
* **`x86_64-apple-darwin` Rust Target**: This specific Rust target is needed to compile for Intel Macs. You can install it by running the following command in your Terminal:
16+
```bash
17+
rustup target add x86_64-apple-darwin
18+
```
19+
The `make build-x86-macos` command will also check for this and provide an error if it's missing.
20+
21+
## 3. Compilation Steps
22+
23+
Follow these steps to compile the x86_64 `rgb-lightning-node` binary:
24+
25+
1. **Clone the KaleidoSwap Desktop Repository**:
26+
Open your Terminal and run:
27+
```bash
28+
git clone https://github.com/kaleidoswap/kaleidoswap-desktop.git
29+
```
30+
*Note: If the `rgb-lightning-node` is part of a different repository that KaleidoSwap Desktop uses as a submodule (e.g., `rgb-lightning-node` itself), you'd clone that specific repository. However, the `make build-x86-macos` target is defined in the `kaleidoswap-desktop` Makefile, which handles the `rgb-lightning-node` submodule.*
31+
32+
2. **Navigate to the Project Directory**:
33+
```bash
34+
cd kaleidoswap-desktop
35+
```
36+
37+
3. **Run the Makefile Target to Build for x86 macOS**:
38+
This command will check dependencies, update the `rgb-lightning-node` submodule, and compile the binary for the x86_64 architecture.
39+
```bash
40+
make build-x86-macos
41+
```
42+
43+
4. **Locate the Compiled Binary**:
44+
After a successful build, the binary will be located at:
45+
`bin/rgb-lightning-node-x86_64`
46+
(Relative to the `kaleidoswap-desktop` project directory).
47+
48+
## 4. Replacing the Binary in KaleidoSwap.app
49+
50+
Once you have compiled the `rgb-lightning-node-x86_64` binary, you need to replace the existing one inside your `KaleidoSwap.app` package.
51+
52+
1. **Locate `KaleidoSwap.app`**: This is usually in your `/Applications` folder.
53+
2. **Show Package Contents**: Right-click on `KaleidoSwap.app` and select "Show Package Contents".
54+
3. **Navigate to the Binary Directory**: In the new Finder window that opens, navigate to:
55+
`Contents/Resources/_up_/bin/`
56+
4. **Back Up the Existing Binary (Important!)**:
57+
Inside this `bin` directory, you might see an existing `rgb-lightning-node` file. Before proceeding, **back this file up**. You can rename it to `rgb-lightning-node_ARM_backup` or copy it to a safe location.
58+
5. **Copy the Compiled Binary**:
59+
Copy the `rgb-lightning-node-x86_64` file from your `kaleidoswap-desktop/bin/` directory into the app bundle's `Contents/Resources/_up_/bin/` directory.
60+
6. **Rename the Copied Binary**:
61+
Inside the app bundle (`Contents/Resources/_up_/bin/`), rename the file you just copied from `rgb-lightning-node-x86_64` to `rgb-lightning-node`.
62+
7. **Ensure Executability**:
63+
Open your Terminal application and run the `chmod +x` command to make sure the new binary is executable. Adjust the path if your `KaleidoSwap.app` is not in the `/Applications` folder:
64+
```bash
65+
chmod +x /Applications/KaleidoSwap.app/Contents/Resources/_up_/bin/rgb-lightning-node
66+
```
67+
68+
After these steps, try launching KaleidoSwap. The application should now use your compiled x86_64 `rgb-lightning-node`.
69+
70+
## 5. Troubleshooting/Notes
71+
72+
* **Application Updates**: If you update the KaleidoSwap application (e.g., by downloading a new version), it will likely overwrite your custom `rgb-lightning-node` binary. You will need to repeat the steps in Section 4 ("Replacing the Binary in KaleidoSwap.app") after each update.
73+
* **Node Startup Issues**: If the RGB node still fails to start, the enhanced error reporting (recently added to the node management code) should provide more specific error messages within the KaleidoSwap application or its logs.
74+
* **Checking Logs**: You can find detailed logs from the `rgb-lightning-node` which might help diagnose issues. On macOS, these logs are typically stored at:
75+
`~/Library/Logs/com.kaleidoswap.dev/rgb-lightning-node.log`
76+
You can open this file with Console.app or any text editor to view the logs.
77+
78+
By following this guide, Intel Mac users should be able to run the `rgb-lightning-node` and utilize its features within KaleidoSwap.

0 commit comments

Comments
 (0)