Skip to content

Commit 4250f25

Browse files
sstonepm47
authored andcommitted
Add support for linux arm64 target (ACINQ#157)
The binary must be built **on x86** with: ``` ./gradlew linuxArm64DistZip ``` Fixes ACINQ#137. --------- Co-Authored-By: pm47 <[email protected]>
1 parent a2f595b commit 4250f25

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# phoenixd
77

88
**phoenixd** is the server equivalent of the popular [phoenix wallet](https://github.com/ACINQ/phoenix) for mobile.
9-
It is written in [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) and runs natively on Linux, MacOS (x86 and ARM), and Windows (WSL).
9+
It is written in [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) and runs natively on Linux (x86 and ARM), MacOS (x86 and ARM), and Windows (WSL).
1010

1111
## Build
1212

@@ -20,6 +20,12 @@ It is written in [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatfor
2020
./gradlew linuxX64DistZip
2121
```
2222

23+
### Native Linux arm64
24+
25+
```shell
26+
./gradlew linuxArm64DistZip
27+
```
28+
2329
### Native MacOS x64
2430
```shell
2531
./gradlew macosX64DistZip

build.gradle.kts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
22
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
33
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
4-
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithHostTests
4+
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
55
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
66
import java.io.ByteArrayOutputStream
77

@@ -75,7 +75,7 @@ kotlin {
7575
}
7676
}
7777

78-
fun KotlinNativeTargetWithHostTests.phoenixBinaries() {
78+
fun KotlinNativeTarget.phoenixBinaries() {
7979
binaries {
8080
executable("phoenixd") {
8181
entryPoint = "fr.acinq.phoenixd.main"
@@ -99,6 +99,14 @@ kotlin {
9999
}
100100
phoenixBinaries()
101101
}
102+
linuxArm64 {
103+
compilations["main"].cinterops.create("sqlite") {
104+
// use sqlite3 amalgamation on linux tests to prevent linking issues on new linux distros with dependency libraries which are to recent (for example glibc)
105+
// see: https://github.com/touchlab/SQLiter/pull/38#issuecomment-867171789
106+
definitionFile.set(File("$rootDir/src/nativeInterop/cinterop/sqlite3.def"))
107+
}
108+
phoenixBinaries()
109+
}
102110
}
103111

104112
if (currentOs.isMacOsX) {
@@ -191,6 +199,9 @@ distributions {
191199
create("linuxX64") {
192200
configureNativeDistribution("linuxX64Binaries", "linuxX64", "linux-x64")
193201
}
202+
create("linuxArm64") {
203+
configureNativeDistribution("linuxArm64Binaries", "linuxArm64", "linux-arm64")
204+
}
194205
}
195206
if (currentOs.isMacOsX) {
196207
create("macosX64") {

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ kotlin.incremental.multiplatform=true
99
kotlin.mpp.stability.nowarn=true
1010
kotlin.mpp.enableCInteropCommonization=true
1111
kotlin.native.ignoreDisabledTargets=true
12-
kotlin.native.cacheKind.linuxX64=none
12+
kotlin.native.cacheKind.linuxX64=none
13+
kotlin.native.cacheKind.linuxArm64=none

settings.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
pluginManagement {
22
repositories {
33
gradlePluginPortal()
4-
maven("https://dl.bintray.com/kotlin/kotlin-eap")
54
}
65
}
76

0 commit comments

Comments
 (0)