-
-
Notifications
You must be signed in to change notification settings - Fork 1
263 lines (237 loc) · 8.75 KB
/
create_toolchains.yaml
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
---
name: Create Toolchains
on:
push:
branches:
- main
workflow_dispatch:
jobs:
crosstool:
name: "Build crosstool-ng"
runs-on: ${{ fromJSON(matrix.host_labels) }}
strategy:
matrix:
runner: [linuxX64, macosX64, macosARM64]
include:
- runner: linuxX64
host_labels: '["ubuntu-22.04"]'
- runner: macosX64
host_labels: '["macos-12"]'
- runner: macosARM64
host_labels: '["macos-14"]' #'["self-hosted", "macOS", "ARM64"]'
steps:
- name: "Clone crosstool-ng repo"
uses: actions/checkout@v4
with:
repository: crosstool-ng/crosstool-ng
ref: master
- name: "Host info"
run: |
uname -a
- name: "Prerequisites (Linux)"
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get install -y gperf help2man libtool-bin meson ninja-build
- name: "Prerequisites (macOS)"
if: ${{ runner.os == 'macOS' }}
run: |
brew install autoconf automake bash binutils coreutils gawk gnu-sed help2man libtool make meson ncurses pkg-config python3 texinfo
- name: "Build crosstool-ng"
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
export PATH="$PATH:/usr/local/opt/binutils/bin:/usr/local/opt/coreutils/bin:/usr/local/opt/libtool/libexec/gnubin"
export CPPFLAGS="-I/usr/local/opt/ncurses/include -I/usr/local/opt/gettext/include"
export LDFLAGS="-L/usr/local/opt/ncurses/lib -L/usr/local/opt/gettext/lib"
export PATH="$PATH:/opt/homebrew/opt/binutils/bin:/opt/homebrew/opt/coreutils/bin:/opt/homebrew/opt/libtool/libexec/gnubin"
export CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/ncurses/include -I/opt/homebrew/opt/gettext/include"
export LDFLAGS="$LDFLAGS -L/opt/homebrew/opt/ncurses/lib -L/opt/homebrew/opt/gettext/lib"
fi
./bootstrap
./configure --prefix=$PWD/.local/
make
make install
tar cf ct-ng.tar .local/
- name: "Upload crosstool-ng"
uses: actions/upload-artifact@v4
with:
name: crosstool.${{ matrix.runner }}
path: ct-ng.tar
tarballs:
name: "Download required tarballs"
needs: [crosstool]
runs-on: ubuntu-22.04
steps:
- name: "Clone toolchains repo"
uses: actions/checkout@v4
- name: "Download copy of crosstool-ng"
uses: actions/download-artifact@v4
with:
name: crosstool.linuxX64
- name: "Extract copy of crosstool-ng"
run: |
tar xf ct-ng.tar
- name: "Prerequisites (Linux)"
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get install -y gperf help2man libtool-bin
echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
- name: "Gather source tarballs"
run: |
# Clear out the tools prefix so we can run everything, even without a bootstrap compiler present
for f in $(ls *.sh); do ./$f --tools-prefix= source; done
tar cvf tarballs.tar tarballs
- name: "Upload source tarballs"
uses: actions/upload-artifact@v4
with:
name: tarballs.tar
path: tarballs.tar
# Build a copy of linux/X64 toolchain to bootstrap the rest so that the resulting compilers are compatible with the old glibc.
bootstrap-linuxX64-toolchain:
name: "Build bootstrap linuxX64 toolchain"
needs: [tarballs]
uses: ./.github/workflows/create_one_toolchain.yaml
with:
runner_labels_json: '["ubuntu-22.04"]'
crosstool_host_os: linuxX64
build_host: linuxX64
target_host: linuxX64
build_script: x64linux-native-bootstrap.sh
fetch_bootstrap: false
toolchain_suffix: "_qmk_bootstrap"
canadian-host-toolchains:
name: "Build canadian host toolchains"
needs: [bootstrap-linuxX64-toolchain]
strategy:
fail-fast: false
matrix:
target_host: [linuxARM64, windowsX64]
include:
- target_host: linuxARM64
build_script: aarch64linux-native.sh
- target_host: windowsX64
build_script: win64-native.sh
uses: ./.github/workflows/create_one_toolchain.yaml
with:
runner_labels_json: '["ubuntu-22.04"]'
crosstool_host_os: linuxX64
build_host: linuxX64
target_host: ${{ matrix.target_host }}
build_script: ${{ matrix.build_script }}
native-toolchains:
name: "Build native toolchains"
needs: [bootstrap-linuxX64-toolchain]
strategy:
fail-fast: false
matrix:
build_host: [linuxX64, macosX64, macosARM64]
target_host: [baremetalARM, baremetalAVR, baremetalRV32]
include:
- build_host: linuxX64
runner_labels_json: '["ubuntu-22.04"]'
- build_host: macosX64
runner_labels_json: '["macos-12"]'
- build_host: macosARM64
runner_labels_json: '["macos-14"]' #'["self-hosted", "macOS", "ARM64"]'
- target_host: baremetalARM
build_script: arm-native.sh
- target_host: baremetalAVR
build_script: avr-native.sh
- target_host: baremetalRV32
build_script: riscv32-native.sh
uses: ./.github/workflows/create_one_toolchain.yaml
with:
runner_labels_json: ${{ matrix.runner_labels_json }}
crosstool_host_os: ${{ matrix.build_host }}
build_host: ${{ matrix.build_host }}
target_host: ${{ matrix.target_host }}
build_script: ${{ matrix.build_script }}
canadian-toolchains:
name: "Build canadian toolchains"
needs: [canadian-host-toolchains]
strategy:
fail-fast: false
matrix:
build_host: [linuxARM64, windowsX64]
target_host: [baremetalARM, baremetalAVR, baremetalRV32]
include:
- build_host: linuxARM64
script_suffix: "-aarch64linux-canadian.sh"
- build_host: windowsX64
script_suffix: "-win64-canadian.sh"
- target_host: baremetalARM
script_prefix: arm
- target_host: baremetalAVR
script_prefix: avr
- target_host: baremetalRV32
script_prefix: riscv32
uses: ./.github/workflows/create_one_toolchain.yaml
with:
runner_labels_json: '["ubuntu-22.04"]'
crosstool_host_os: linuxX64
canadian_build: true
build_host: ${{ matrix.build_host }}
target_host: ${{ matrix.target_host }}
build_script: ${{ matrix.script_prefix }}${{ matrix.script_suffix }}
native-linuxX64-toolchain:
name: "Build native linuxX64 toolchain"
needs: [bootstrap-linuxX64-toolchain]
uses: ./.github/workflows/create_one_toolchain.yaml
with:
runner_labels_json: '["ubuntu-22.04"]'
crosstool_host_os: linuxX64
build_host: linuxX64
target_host: linuxX64
build_script: x64linux-native.sh
canadian-windowsX64-toolchain:
name: "Build native windowsX64 toolchain"
needs: [canadian-toolchains]
uses: ./.github/workflows/create_one_toolchain.yaml
with:
runner_labels_json: '["ubuntu-22.04"]'
crosstool_host_os: linuxX64
canadian_build: true
build_host: windowsX64
target_host: windowsX64
build_script: win64-win64-canadian.sh
canadian-linuxARM64-toolchain:
name: "Build native linuxARM64 toolchain"
needs: [canadian-toolchains]
uses: ./.github/workflows/create_one_toolchain.yaml
with:
runner_labels_json: '["ubuntu-22.04"]'
crosstool_host_os: linuxX64
canadian_build: true
build_host: linuxARM64
target_host: linuxARM64
build_script: aarch64linux-aarch64linux-canadian.sh
publish:
name: Publish toolchains
needs: [bootstrap-linuxX64-toolchain, native-toolchains, canadian-toolchains, native-linuxX64-toolchain, canadian-windowsX64-toolchain, canadian-linuxARM64-toolchain]
if: always() && !cancelled()
runs-on: ubuntu-latest
steps:
- name: Download toolchains
if: always() && !cancelled()
uses: actions/download-artifact@v4
with:
pattern: toolchain-*
path: .
merge-multiple: true
- name: Generate pre-release... release
uses: marvinpinto/action-automatic-releases@latest
if: always() && !cancelled() && github.ref == 'refs/heads/main'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: latest
prerelease: true
title: Development Build
files: |
qmk_toolchain*
- name: Generate release
uses: marvinpinto/action-automatic-releases@latest
if: always() && !cancelled() && startsWith(github.ref, 'refs/tags/v')
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
qmk_toolchain*