-
Notifications
You must be signed in to change notification settings - Fork 4
89 lines (81 loc) · 3.11 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
87
88
89
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.TARGET.OS }}
strategy:
fail-fast: false
matrix:
TARGET:
- {
OS: 'ubuntu-20.04',
CFLAGS: '-static -fno-stack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0',
HOST: 'i386-pc-linux',
ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-linux.tar.gz',
HOST_GCC: 'gcc'
}
- {
OS: 'macos-13',
CFLAGS: '-DDARWIN -Wno-implicit-int -Wno-return-type -Wno-error -Wno-implicit-function-declaration -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0',
HOST: 'i386-apple-darwin',
ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-mac.tar.gz',
HOST_GCC: 'gcc-13'
}
name: Building binutils for ${{ matrix.TARGET.OS }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Ubuntu)
shell: bash
if: matrix.TARGET.OS == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y build-essential bison file gperf flex
- name: Configure for mips
shell: bash
run: |
CC="${{ matrix.TARGET.HOST_GCC }}" CFLAGS="-Wno-implicit-int" ./configure --target=mips-linux --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }}
- name: Make
shell: bash
run: |
make -C bfd CFLAGS="${{ matrix.TARGET.CFLAGS }}"
make -C opcodes CFLAGS="${{ matrix.TARGET.CFLAGS }}"
make -C libiberty CFLAGS="${{ matrix.TARGET.CFLAGS }}"
make -C intl CFLAGS="${{ matrix.TARGET.CFLAGS }}"
make -C gas CFLAGS="${{ matrix.TARGET.CFLAGS }}"
make -C binutils CFLAGS="${{ matrix.TARGET.CFLAGS }}"
make -C ld CFLAGS="${{ matrix.TARGET.CFLAGS }}"
- name: Test for file
shell: bash
run: |
test -f binutils/ar
file binutils/ar
- name: Create release archive
shell: bash
run: |
mkdir -p release
cp binutils/ar release/ar
cp binutils/addr2line release/addr2line
cp binutils/cxxfilt release/cxxfilt
cp binutils/nm-new release/nm
cp binutils/objcopy release/objcopy
cp binutils/objdump release/objdump
cp binutils/ranlib release/ranlib
cp binutils/readelf release/readelf
cp binutils/strings release/strings
cp binutils/strip-new release/strip
cp gas/as-new release/as
cp ld/ld-new release/ld
strip release/*
chmod +x release/*
cd release && tar -czf ../${{ matrix.TARGET.ARCHIVE_NAME }} *
- name: Upload archive
uses: actions/upload-artifact@v3
with:
name: mips-binutils-egcs-2.9.5-${{ matrix.TARGET.OS }}
path: |
${{ matrix.TARGET.ARCHIVE_NAME }}
- name: Publish release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ matrix.TARGET.ARCHIVE_NAME }}