This repository has been archived by the owner on Jan 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (117 loc) · 4.93 KB
/
build-linux-arm64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Build [Linux arm64]
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build-spms:
runs-on: ubuntu-22.04
container: ubuntu:23.04
env:
TOOLCHAIN_VERSION: aarch64-unknown-linux-gnu-gcc-8.3.0-glibc-2.25-kernel-4.9-2
JAVA_HOME: /usr/lib/jvm/java-17-openjdk/
steps:
- run: echo "TOOLCHAIN=$GITHUB_WORKSPACE/toolchain" >> $GITHUB_ENV
- run: apt update
- run: apt install -y nodejs
if: env.ACT
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Test Java
run: $JAVA_HOME/bin/java --version
- run: apt install -y --reinstall git make wget pkg-config libc6-dev-i386
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Get cached libzmq
id: cache-libzmq
uses: actions/cache@v4
with:
path: libzmq
key: libzmq-arm64
- name: Download and extract toolchain
run: |
wget https://download.jetbrains.com/kotlin/native/$TOOLCHAIN_VERSION.tar.gz -O toolchain.tar.gz
tar -xzf toolchain.tar.gz
mv ./$TOOLCHAIN_VERSION $TOOLCHAIN
- name: Download libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
run: wget https://github.com/zeromq/libzmq/releases/download/v4.3.5/zeromq-4.3.5.tar.gz
- name: Extract libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
run: tar -xf ./zeromq-4.3.5.tar.gz
- name: Configure libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
working-directory: zeromq-4.3.5
# http://wiki.zeromq.org/build:arm
run: |
LDFLAGS="-lgcc -lgcc_s" \
CC=$TOOLCHAIN/bin/aarch64-unknown-linux-gnu-gcc \
CXX=$TOOLCHAIN/bin/aarch64-unknown-linux-gnu-g++ \
./configure \
--host=arm-none-linux-gnueabi \
--enable-drafts \
--enable-static \
--disable-shared \
--disable-libbsd \
--prefix=$GITHUB_WORKSPACE/libzmq
- name: Compile and install libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
working-directory: zeromq-4.3.5
run: make -j$(nproc) && make install
- name: Copy libzmq into src/nativeInterop/linux-arm64
run: mkdir -p src/nativeInterop/linux-arm64 && cp -r libzmq/* src/nativeInterop/linux-arm64
- name: Add arm64 architecture to dpkg
run: dpkg --add-architecture arm64
- name: Add arm64 apt sources
run: |
cat > /etc/apt/sources.list.d/arm64-sources.list <<EOF
deb [arch=arm64] http://ports.ubuntu.com/ lunar main restricted
deb [arch=arm64] http://ports.ubuntu.com/ lunar-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ lunar universe
deb [arch=arm64] http://ports.ubuntu.com/ lunar-updates universe
deb [arch=arm64] http://ports.ubuntu.com/ lunar multiverse
deb [arch=arm64] http://ports.ubuntu.com/ lunar-updates multiverse
deb [arch=arm64] http://ports.ubuntu.com/ lunar-backports main restricted universe multiverse
EOF
- name: Restrict main apt sources to amd64
run: |
cat > /etc/apt/sources.list <<EOF
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar-updates main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar-updates universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar-updates multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar-backports main restricted universe multiverse
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ lunar-security main restricted
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ lunar-security universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ lunar-security multiverse
EOF
- name: Install arm64 development libraries
run: |
apt update
apt install -y libmpv-dev:arm64 libcurl4-openssl-dev:arm64 libappindicator3-dev:arm64
- name: Set up Gradle
uses: gradle/gradle-build-action@v3
- name: Grant execute permission for gradlew
run: chmod +x gradle
- name: Build linux-arm64 binaries
run: ./gradlew linux-arm64Binaries -PlinkStatic
- name: Strip release binary
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip build/bin/linux-arm64/releaseExecutable/*.kexe
- name: Upload debug binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-arm64-debug
path: build/bin/linux-arm64/debugExecutable/*.kexe
- name: Upload release binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-arm64-release
path: build/bin/linux-arm64/releaseExecutable/*.kexe