-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmake-all-toolchains.sh
More file actions
executable file
·56 lines (48 loc) · 1.89 KB
/
Copy pathmake-all-toolchains.sh
File metadata and controls
executable file
·56 lines (48 loc) · 1.89 KB
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
#!/usr/bin/env bash
# Copyright 2024-2026 Nick Brassel (@tzarc)
# SPDX-License-Identifier: GPL-2.0-or-later
set -eu
this_script="$PWD/$(basename ${BASH_SOURCE[0]})"
script_dir=$(dirname "${this_script}")
cd "$script_dir"
BUILDER_IMAGE=${BUILDER_IMAGE:-ghcr.io/tzarc/qmk_toolchains:builder}
declare host_osarch_names=(
linuxX64
linuxARM64
linuxRV64
macosARM64
macosX64
windowsX64
)
declare target_names=(
baremetalARM
baremetalAVR
baremetalRV32
)
# Use gdb as it's the last step in the toolchain
declare -A check_files=(
[baremetalARM]='arm-none-eabi-gdb'
[baremetalAVR]='avr-gdb'
[baremetalRV32]='riscv32-unknown-elf-gdb'
)
for target in "${target_names[@]}"; do
for host in "${host_osarch_names[@]}"; do
check_file=${check_files[$target]}
if [ ! -x "toolchains/host_${host}-target_${target}/bin/${check_file}" ] && [ ! -x "toolchains/host_${host}-target_${target}/bin/${check_file}.exe" ]; then
echo "Missing toolchain for ${target} on ${host}, building..."
./build_toolchain.py --host ${host} --target ${target} --container-image=${BUILDER_IMAGE} --no-keep-state "$@"
fi
done
done
for target in "${target_names[@]}"; do
for host in "${host_osarch_names[@]}"; do
check_file=${check_files[$target]}
if [ -x "toolchains/host_${host}-target_${target}/bin/${check_file}" ] || [ -x "toolchains/host_${host}-target_${target}/bin/${check_file}.exe" ]; then
echo "Stripping toolchain for ${target} on ${host}..."
./strip_toolchain.sh toolchains/host_${host}-target_${target}
echo "Creating tarball for ${target} on ${host}..."
tar acf qmk_toolchain-host_${host}-target_${target}.tar --sort=name -C toolchains host_${host}-target_${target}
zstdmt -T0 -19 --long --rm --force qmk_toolchain-host_${host}-target_${target}.tar
fi
done
done