-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (74 loc) · 2.92 KB
/
build.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
name: Build libgcc
on:
push:
branches:
- 'trunk'
jobs:
libgcc:
strategy:
matrix:
target_arch: [i386, i686, x86_64, arm, aarch64, loongarch64, loongarch64-softfloat, riscv64, riscv64-softfloat, m68k]
name: Build and upload libgcc for ${{matrix.target_arch}}
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- name: Install dependencies
run: pacman --noconfirm -Syu && pacman --needed --noconfirm -S base-devel git autoconf automake wget
- name: Checkout code
uses: actions/checkout@v4
- name: Git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Extrapolate target triplet
run: |
set -ex
case "${{matrix.target_arch}}" in \
arm) \
echo "arm-none-eabi" >target-triplet ;; \
loongarch64-softfloat) \
echo "loongarch64-elf" >target-triplet ;; \
riscv64-softfloat) \
echo "riscv64-elf" >target-triplet ;; \
*) \
echo "${{matrix.target_arch}}-elf" >target-triplet ;; \
esac
- name: Build the toolchain
run: |
CFLAGS_FOR_TARGET=""; \
case "${{matrix.target_arch}}" in \
loongarch64-softfloat) \
CFLAGS_FOR_TARGET="-mabi=lp64s";; \
riscv64-softfloat) \
CFLAGS_FOR_TARGET="-march=rv64imac_zicsr_zifencei -mabi=lp64";; \
esac; \
case "${{matrix.target_arch}}" in \
riscv64*) \
CFLAGS_FOR_TARGET="$CFLAGS_FOR_TARGET -mno-relax";; \
esac; \
CFLAGS_FOR_TARGET="-O2 -pipe -fPIC -Wa,--noexecstack $CFLAGS_FOR_TARGET" TARGET="$(cat target-triplet)" GCCVERSION="$(cat gcc-version)" BINUTILSVERSION="$(cat binutils-version)" ./make_toolchain.sh
- name: Copy libgcc.a
run: cp toolchain/lib/gcc/$(cat target-triplet)/$(cat gcc-version)/libgcc.a ./libgcc-${{matrix.target_arch}}.a
- name: Copy extra libgcc.a's
run: |
set -ex
case "${{matrix.target_arch}}" in \
x86_64) \
cp toolchain/lib/gcc/$(cat target-triplet)/$(cat gcc-version)/no-red-zone/libgcc.a ./libgcc-x86_64-no-red-zone.a ;; \
esac
- name: Remove target-triplet
run: rm target-triplet
- name: Push new binaries
run: |
set -ex
git config user.name 'mintsuki'
git config user.email 'mintsuki@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/osdev0/libgcc-binaries.git
while true; do \
git pull --all; \
git add .; \
git commit -m "Upload binaries (${{matrix.target_arch}}) [ci skip]"; \
if git push origin trunk; then \
break; \
else \
git reset HEAD~1; \
fi; \
done