@@ -10,15 +10,15 @@ The `*.xcframework` files are either available on
10
10
the [ Releases] ( https://github.com/lightningdevkit/ldk-swift/releases ) page, or can be [ compiled] ( #Compilation )
11
11
from scratch.
12
12
13
-
14
13
## Compilation
15
14
16
15
### Prerequisites
17
16
18
- - A Mac with Xcode 13.2.1 or lower (this is because there is a bug with ` cc ` that prevents it from compiling for Mac Catalyst targets with clang 13)
19
- - Python3
20
- - Rust
21
- - ` gnu-sed ` (optional; but will cut your compile times significantly!)
17
+ - A machine running macOS
18
+ - Xcode 13.2.1 or lower (this is because there is a bug with ` cc ` that prevents it from compiling for Mac Catalyst targets with clang 13)
19
+ - [ Python3] ( https://programwithus.com/learn/python/install-python3-mac )
20
+ - [ Rust] ( https://www.rust-lang.org/tools/install )
21
+ - [ GNU sed] ( https://formulae.brew.sh/formula/gnu-sed ) (optional, but will cut your compile times significantly!)
22
22
23
23
For Rust specifically, there are a couple additional requirements that can be installed once the Rust toolchain
24
24
is set up:
@@ -33,17 +33,20 @@ cargo install cbindgen
33
33
34
34
In order to generate these bindings from scratch, you will need to clone two dependency repositories:
35
35
36
- ** rust-lightning** , (a specific branch built for bindings compatibility)
36
+ ** [ rust-lightning] ( https://github.com/lightningdevkit/rust-lightning ) ** , (a specific branch built for bindings compatibility):
37
+
37
38
``` shell
38
39
git clone --branch 2022-06-108-java-bindings https://github.com/TheBlueMatt/rust-lightning /path/to/rust-lightning
39
40
```
40
41
41
- ** ldk-c-bindings**
42
+ ** [ ldk-c-bindings] ( https://github.com/lightningdevkit/ldk-c-bindings ) ** :
43
+
42
44
``` shell
43
45
git clone --branch v0.0.108.2 https://github.com/lightningdevkit/ldk-c-bindings /path/to/ldk-c-bindings
44
46
```
45
47
46
48
Take note of where you clone these directories, it's best you save the absolute path somewhere handy for the rest of the remaining steps.
49
+
47
50
### Generating Rust-to-C-bindings
48
51
49
52
Now, navigate to the ` ldk-c-bindings ` directory and run the ` genbindings.sh ` script:
@@ -85,6 +88,7 @@ git rev-parse HEAD
85
88
```
86
89
87
90
Take that commit hash and replace the ` xxx ` instances with it.
91
+
88
92
</details >
89
93
90
94
#### Generating the Swift files
@@ -99,6 +103,7 @@ python3 ./
99
103
Now, the contents of the ` bindings/LDK ` folder will have been completely regenerated.
100
104
101
105
### Preparing the correct Xcode version
106
+
102
107
To make sure the next two steps work correctly, you need to verify that you're using Xcode 13.2.1.
103
108
If you have a later version, you can download the correct version from here: https://xcodereleases.com/
104
109
@@ -116,6 +121,7 @@ sudo xcode-select -s /Applications/Xcode\ 13.2.1.app/Contents/Developer/
116
121
```
117
122
118
123
### Building requisite binaries
124
+
119
125
Navigate (` cd ` ) to the ` ./src/scripts ` folder, and run the following Python script:
120
126
121
127
``` shell
@@ -130,7 +136,7 @@ Each of those folders will contain an `architectures` directory with subdirector
130
136
or ` x86_64 ` , as well as a ` libldk.a ` file, which is the ` lipo ` product of all the targeted
131
137
architectures.
132
138
133
- #### Generating the * .xcframework files
139
+ #### Generating the \ * .xcframework files
134
140
135
141
With all the binaries generated, still in the ` ./src/scripts ` directory, you just need to run one
136
142
last Python script to produce the framework:
0 commit comments