-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (134 loc) · 5.79 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Build [Linux arm64]
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
jobs:
build-spms:
runs-on: ubuntu-22.04
container: ubuntu:23.04
if: ${{ github.event.pull_request.draft == false && (github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, 'noci')) }}
env:
TOOLCHAIN_VERSION: aarch64-unknown-linux-gnu-gcc-8.3.0-glibc-2.25-kernel-4.9-2
JAVA_HOME: /usr/lib/jvm/java-21-openjdk/
steps:
- run: echo "TOOLCHAIN=$GITHUB_WORKSPACE/toolchain" >> $GITHUB_ENV
- run: echo "SPMS_ARCH=arm64" >> $GITHUB_ENV
- run: apt update
- run: apt install -y nodejs
if: env.ACT
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: |
22
21
- 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 library/src/nativeInterop/linuxArm64
run: mkdir -p library/src/nativeInterop/linuxArm64 && cp -r libzmq/* library/src/nativeInterop/linuxArm64
- 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-get update
apt-get install -y libmpv-dev:arm64 libayatana-appindicator3-dev:arm64
- name: Set up Gradle
uses: gradle/gradle-build-action@v3
- name: Build Linux Arm64 minimal binaries
run: ./gradlew app:linuxArm64Binaries -PMINIMAL --stacktrace
- name: Strip release binary
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip app/build/bin/linuxArm64/releaseExecutable/*.kexe
- name: Upload debug binary
uses: actions/upload-artifact@v3
with:
name: spms-minimal-linux-arm64-debug
path: app/build/bin/linuxArm64/debugExecutable/*.kexe
- name: Upload release binary
uses: actions/upload-artifact@v3
with:
name: spms-minimal-linux-arm64-release
path: app/build/bin/linuxArm64/releaseExecutable/*.kexe
- name: Build Linux Arm64 full binaries
run: ./gradlew app:linuxArm64Binaries --stacktrace
- name: Strip release binary
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip app/build/bin/linuxArm64/releaseExecutable/*.kexe
- name: Upload debug binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-arm64-debug
path: app/build/bin/linuxArm64/debugExecutable/*.kexe
- name: Upload release binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-arm64-release
path: app/build/bin/linuxArm64/releaseExecutable/*.kexe