-
Notifications
You must be signed in to change notification settings - Fork 89
194 lines (164 loc) · 6.2 KB
/
toolchain.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
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
name: Build OpenOrbis Toolchain
on:
push:
paths-ignore:
- "**/*.md"
- '**/*.txt'
pull_request:
paths-ignore:
- "**/*.md"
- '**/*.txt'
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
llvm: [ '10', '11', '12', '13', '14', '15', '16' ]
runs-on: ubuntu-latest
steps:
- name: Checkout OOSDK
uses: actions/checkout@v3
- name: Checkout musl
uses: actions/checkout@v3
with:
repository: OpenOrbis/musl
path: musl
- name: Checkout create-fself
uses: actions/checkout@v3
with:
repository: OpenOrbis/create-fself
path: create-fself
- name: Checkout orbis-lib-gen
uses: actions/checkout@v3
with:
repository: OpenOrbis/orbis-lib-gen
path: orbis-lib-gen
- name: Checkout ps4libdoc
uses: actions/checkout@v3
with:
repository: idc/ps4libdoc
path: orbis-lib-gen/ps4libdoc
ref: '5.05'
- name: Set environment variables
run: |
echo "OO_PS4_TOOLCHAIN=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo llvm_ver=${{ matrix.llvm }} >> $GITHUB_ENV
echo "llvm_path=${{ runner.tool_cache }}/llvm" >> $GITHUB_ENV
# llvm 13 fix for ci
sudo apt install libncurses5
- name: Cache LLVM and Clang (${{ env.llvm_ver }})
id: cache-llvm
uses: actions/cache@v3
with:
path: ${{ env.llvm_path }}
key: llvm-${{ env.llvm_ver }}
- name: Install LLVM and Clang (${{ env.llvm_ver }})
uses: KyleMayes/install-llvm-action@master
with:
version: ${{ env.llvm_ver }}
directory: ${{ env.llvm_path }}
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Set up musl environment
working-directory: musl
run: |
mkdir ps4
clang -v
./configure --target=x86_64-scei-ps4 --disable-shared CC="clang" \
CFLAGS="-fPIC -DPS4 -D_LIBUNWIND_IS_BAREMETAL=1" \
--prefix=./ps4
- name: Build musl
working-directory: musl
run: make
- name: Install musl
working-directory: musl
run: |
make install
cp -r ps4/include/* ../include/
cp -r ps4/lib/* ../lib/
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Build create-fself
working-directory: create-fself/cmd/create-fself
run: |
GOOS=windows go build -o ${{ github.workspace }}/bin/windows/create-fself.exe -modfile=go-linux.mod
go build -o ${{ github.workspace }}/bin/linux/create-fself -modfile=go-linux.mod
GOOS=darwin go build -o ${{ github.workspace }}/bin/macos/create-fself-macos -modfile=go-linux.mod
- name: Generate library stub sources
working-directory: orbis-lib-gen
run: python generate.py ps4libdoc/system/common/lib
- name: Generate makefile
working-directory: orbis-lib-gen
run: python gen_makefile.py
- name: Build library stubs
working-directory: orbis-lib-gen/build
run: make
- name: Install library stubs
working-directory: orbis-lib-gen
run: |
rm build/out/libc.so
cp -r build/out/* ../lib/
- name: Remove built dependencies
run: |
rm -rf create-fself
rm -rf musl
rm -rf orbis-lib-gen
- name: Download and extract dependencies
run: |
curl -sL https://github.com/OpenOrbis/llvm-project/releases/latest/download/libcxx-full.tar.gz | tar xz -C ./
curl -sL https://github.com/OpenOrbis/SDL-PS4/releases/latest/download/SDL2.tar.gz | tar xz -C ./
curl -sL https://github.com/OpenOrbis/create-gp4/releases/latest/download/binaries.tar.gz | tar xz -C ./
curl -sL https://github.com/OpenOrbis/readoelf/releases/latest/download/binaries.tar.gz | tar xz -C ./
# Get maxton's publishing tools <3
- name: "Download and extract maxton's Publishing Tools"
run: |
BASE_URL="https://github.com/maxton/LibOrbisPkg/releases/latest/download"
curl -sL $BASE_URL/PkgEditor-0.2.231.zip | busybox unzip - -o -d bin/windows
curl -sL $BASE_URL/PkgTool.Core-0.2.231.zip | busybox unzip - -o -d bin/windows
curl -sL $BASE_URL/PkgTool.Core-linux-x64-0.2.231.zip | busybox unzip - -o -d bin/linux
curl -sL $BASE_URL/PkgTool.Core-osx-x64-0.2.231.zip | busybox unzip - -o -d bin/macos
chmod +x -R bin/
- name: Build crtlib
working-directory: src/crt
run: clang crtlib.c -c -o ../../lib/crtlib.o
- name: Merge compiler-rt into libc
working-directory: lib
run: |
echo "CREATE libcM.a" > mri.txt
echo "ADDLIB libc.a" >> mri.txt
echo "ADDLIB libclang_rt.builtins-x86_64.a" >> mri.txt
echo "SAVE" >> mri.txt
echo "END" >> mri.txt
llvm-ar -M < mri.txt
rm mri.txt libc.a
mv libcM.a libc.a
- name: Build sce_module/ and copy to samples
working-directory: src/modules
run: bash build-and-copy.sh
- name: Create toolchain tarball
run: tar -czf toolchain-llvm-${{ env.llvm_ver }}.tar.gz --transform 's,^,OpenOrbis/PS4Toolchain/,' *
- name: Build samples
working-directory: samples
run: bash ./build-all.sh
- name: Upload toolchain
uses: actions/upload-artifact@v3
with:
name: toolchain-llvm-${{ env.llvm_ver }}
path: toolchain-llvm-${{ env.llvm_ver }}.tar.gz
if-no-files-found: error
- name: Upload samples packages
uses: actions/upload-artifact@v3
with:
name: samples-pkg-llvm-${{ env.llvm_ver }}
path: samples/**/*.pkg
- name: Upload samples binaries
uses: actions/upload-artifact@v3
with:
name: samples-elf-llvm-${{ env.llvm_ver }}
path: |
samples/**/*.elf
samples/**/*.so
src/**/*.elf
src/**/*.so