-
Notifications
You must be signed in to change notification settings - Fork 21
474 lines (472 loc) · 26.1 KB
/
apple.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
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
name: apple
on:
push:
branches:
- master
tags:
- '*'
pull_request: {}
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: true
matrix:
platform: [iPhoneOS, iPhoneSimulator, AppleTVOS, AppleTVSimulator, MacOSX]
arch: [arm64, x86_64]
exclude:
- platform: iPhoneOS
arch: x86_64
- platform: AppleTVOS
arch: x86_64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.5.0
with:
fetch-depth: 1
submodules: true
- name: Restore timestamps
run: |
cd src
for dir in *
do
cd $dir
timestamp=$(git log --date=local --pretty=format:"%cd" --date=format:'%Y%m%d%H%M.%S' . | head -1)
find . -exec touch -t $timestamp {} +
cd ..
done
- id: sysroot
uses: ASzc/change-string-case-action@v5
with:
string: ${{ matrix.platform }}
- name: Configure shared build for MacOSX
if: ${{ matrix.platform == 'MacOSX' }}
run: |
echo "shared=ON" >> $GITHUB_ENV
echo "static=OFF" >> $GITHUB_ENV
- name: Configure static build for non-MacOSX
if: ${{ matrix.platform != 'MacOSX' }}
run: |
echo "shared=OFF" >> $GITHUB_ENV
echo "static=ON" >> $GITHUB_ENV
- name: Download cctools
run: |
cd /opt
wget https://github.com/supertuxkart/dependencies/releases/download/cctools/cctools-14.1.tar.xz
tar xf cctools-14.1.tar.xz
rm cctools-14.1.tar.xz
- name: Build zlib
run: |
cd src/zlib
# zlib cmake will change the public header, install it first
mkdir -p $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include
mkdir -p $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
cp -p zconf.h zlib.h $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include
mkdir build
cd build
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}
../../../build_tools/fix_rpath.py $(pwd)
make -j5
if [ ${{ matrix.platform }} = "MacOSX" ]; then
cp -a libz*dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
else
cp -a libz.a $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
- name: Build Mbed TLS
run: |
cd src/mbedtls
# Remove empty paragraph passed to '\retval' error
sed -i 's/set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")//g' CMakeLists.txt
mkdir build
cd build
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF \
-DUSE_SHARED_MBEDTLS_LIBRARY=${{ env.shared }} -DUSE_STATIC_MBEDTLS_LIBRARY=${{ env.static }}
../../../build_tools/fix_rpath.py $(pwd)/library
make -j5
make install
if [ ${{ matrix.platform }} = "MacOSX" ]; then
# New CMake no longer specify @rpath when install, copy manually
cp -a library/libmbed*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
# Fix dylib permission
chmod 755 $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/libmbed*dylib || true
fi
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/cmake
- name: Build cURL
run: |
# Disable bundled zlib
cd src/curl
mkdir build
cd build
# Fix old Mac without HAVE_CLOCK_GETTIME_MONOTONIC
if [ ${{ matrix.platform }} = "MacOSX" ] && [ ${{ matrix.arch }} = "x86_64" ]; then
wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.9.sdk.tar.xz
tar xf MacOSX10.9.sdk.tar.xz
extra_flags="-isysroot $(pwd)/MacOSX10.9.sdk"
fi
# -DCURL_CA_BUNDLE=none -DCURL_CA_PATH=none because STK includes its own
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DBUILD_TESTING=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=${{ env.shared }} \
-DCURL_USE_MBEDTLS=ON -DUSE_ZLIB=ON \
-DCURL_USE_OPENSSL=OFF -DCURL_USE_LIBSSH=OFF -DCURL_USE_LIBSSH2=OFF \
-DCURL_USE_GSSAPI=OFF -DUSE_NGHTTP2=OFF -DUSE_QUICHE=OFF \
-DHTTP_ONLY=ON -DCURL_CA_BUNDLE=none -DCURL_CA_PATH=none \
-DCMAKE_C_FLAGS="$extra_flags" -DCMAKE_CXX_FLAGS="$extra_flags"
../../../build_tools/fix_rpath.py $(pwd)/lib
make -j5
make install
if [ ${{ matrix.platform }} = "MacOSX" ]; then
cp -a lib/libcurl.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/bin
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/cmake
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig
- name: Build libpng
run: |
cd src/libpng
mkdir build
cd build
# -DPNG_ARM_NEON=off is required for successful compilation of aarch64
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DPNG_SHARED=${{ env.shared }} -DPNG_STATIC=${{ env.static }} -DPNG_TESTS=OFF -DPNG_ARM_NEON=off
../../../build_tools/fix_rpath.py $(pwd)
make -j5
make install
if [ ${{ matrix.platform }} = "MacOSX" ]; then
cp -a libpng*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/bin
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/libpng
rm -f $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/libpng.a
touch -r ../README $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/png*
touch -r ../README $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/libpng16/*
- name: Build FreeType bootstrap
run: |
cd src/freetype
mkdir build
cd build
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DFT_WITH_ZLIB=ON -DFT_WITH_BZIP2=OFF -DFT_WITH_BROTLI=OFF \
-DFT_WITH_PNG=ON -DFT_WITH_HARFBUZZ=OFF -DBUILD_SHARED_LIBS=${{ env.shared }} \
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE
../../../build_tools/fix_rpath.py $(pwd)
make -j5
make install
if [ ${{ matrix.platform }} = "MacOSX" ]; then
cp -a libfreetype.*dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/cmake
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig
touch -r ../README $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/freetype2/freetype/config/*
- name: Build HarfBuzz
run: |
cd src/harfbuzz
mkdir build
cd build
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DHB_HAVE_CORETEXT=OFF -DHB_HAVE_FREETYPE=ON -DBUILD_SHARED_LIBS=${{ env.shared }} \
-DHB_BUILD_SUBSET=OFF
../../../build_tools/fix_rpath.py $(pwd)
make -j5
make install
if [ ${{ matrix.platform }} = "MacOSX" ]; then
cp -a libharfbuzz*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/cmake
- name: Build FreeType
run: |
# Circular dependency of freetype crashes gatekeeper on MacOSX (stack overflowed)
if [ ${{ matrix.platform }} = "MacOSX" ]; then
exit 0
fi
cd src/freetype
git reset --hard
rm -rf build
mkdir build
cd build
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DFT_WITH_ZLIB=ON -DFT_WITH_BZIP2=OFF -DFT_WITH_BROTLI=OFF \
-DFT_WITH_PNG=ON -DFT_WITH_HARFBUZZ=ON -DBUILD_SHARED_LIBS=${{ env.shared }} \
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE
../../../build_tools/fix_rpath.py $(pwd)
make -j5
# Don't make install again as the timestamp will be overwritten after git reset --hard
cp -a libfreetype.*dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib || true
cp libfreetype.a $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib || true
- name: Build Ogg
run: |
cd src/libogg
mkdir build
cd build
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DBUILD_SHARED_LIBS=${{ env.shared }} -DBUILD_TESTING=OFF -DINSTALL_DOCS=OFF \
-DINSTALL_PKG_CONFIG_MODULE=OFF -DINSTALL_CMAKE_PACKAGE_MODULE=OFF
../../../build_tools/fix_rpath.py $(pwd)
make -j5
make install
if [ ${{ matrix.platform }} = "MacOSX" ]; then
cp -a libogg*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
touch -r ../README.md $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/ogg/*
- name: Build Vorbis
run: |
cd src/libvorbis
mkdir build
cd build
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DBUILD_SHARED_LIBS=${{ env.shared }} -DINSTALL_CMAKE_PACKAGE_MODULE=OFF
../../../build_tools/fix_rpath.py $(pwd)/lib
make -j5
make install
if [ ${{ matrix.platform }} = "MacOSX" ]; then
cp -a lib/libvorbis*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig
- name: Build libjpeg-turbo
run: |
# As jpeg is not performance crticial enough for STK so it's built with asm disabled for non-MacOSX
if [ ${{ matrix.platform }} = "MacOSX" ]; then
sudo apt install -y yasm
fi
cd src/libjpeg
mkdir build
cd build
# libjpeg install library to lib64 folder, override it
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DENABLE_SHARED=${{ env.shared }} -DENABLE_STATIC=${{ env.static }} -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib \
-DCMAKE_SKIP_INSTALL_RPATH=ON
make -j5
make install
touch -r ../jerror.h $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include/jconfig.h
rm -r $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/bin
- name: Build libsamplerate
run: |
cd src/libsamplerate
mkdir build
cd build
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DLIBSAMPLERATE_EXAMPLES=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=${{ env.shared }}
../../../build_tools/fix_rpath.py $(pwd)/src
make -j5
make install
if [ ${{ matrix.platform }} = "MacOSX" ]; then
cp -a src/libsamplerate*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/pkgconfig
rm -rf $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib/cmake
- name: Build astc-encoder
run: |
cd src/astc-encoder
sed -i '/-Werror/d' Source/cmake_core.cmake
if [ ${{ matrix.platform }} = "MacOSX" ]; then
sed -i 's|${ASTCENC_TARGET}-shared|astcenc|g' Source/cmake_core.cmake
else
sed -i 's|${ASTCENC_TARGET}-static|astcenc|g' Source/cmake_core.cmake
fi
mkdir build
cd build
# We require SSE4.1 (x86_64) or NEON (arm*) for astc-encoder
if [ ${{ matrix.arch }} = "x86_64" ]; then
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} \
-DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DASTCENC_ISA_SSE41=ON -DASTCENC_INVARIANCE=OFF -DASTCENC_CLI=OFF \
-DASTCENC_UNIVERSAL_BUILD=OFF -DASTCENC_SHAREDLIB=ON \
-DCMAKE_C_FLAGS='-O3' -DCMAKE_CXX_FLAGS='-O3'
else
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} \
-DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DASTCENC_ISA_NEON=ON -DASTCENC_INVARIANCE=OFF -DASTCENC_CLI=OFF \
-DASTCENC_UNIVERSAL_BUILD=OFF -DASTCENC_SHAREDLIB=ON \
-DCMAKE_C_FLAGS='-O3' -DCMAKE_CXX_FLAGS='-O3'
fi
make -j5
if [ ${{ matrix.platform }} = "MacOSX" ]; then
/opt/cctools/bin/x86_64-apple-darwin11-install_name_tool -id @rpath/libastcenc.dylib Source/libastcenc.dylib
cp -a Source/libastcenc.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
else
cp -a Source/libastcenc.a $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
cp -p ../Source/astcenc.h $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include
- name: Build shaderc
run: |
cd src/shaderc
utils/git-sync-deps
curl https://github.com/supertuxkart/stk-code/commit/9ea2f3ff8cd8dea1c1a6d07a9a4a842848b901e6.diff | patch -p3
mkdir build
cd build
cmake .. -DCCTOOLS_PREFIX=/opt/cctools -DCCTOOLS_PLATFORM=${{ matrix.platform }} -DCCTOOLS_ARCH=${{ matrix.arch }} \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-cctools.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} \
-DCMAKE_BUILD_TYPE=Release -DSHADERC_SKIP_INSTALL=1 \
-DSHADERC_SKIP_TESTS=1 -DSHADERC_SKIP_EXAMPLES=1 \
-DSPIRV_HEADERS_SKIP_INSTALL=1 -DSPIRV_HEADERS_SKIP_EXAMPLES=1 \
-DSKIP_SPIRV_TOOLS_INSTALL=1 -DSPIRV_SKIP_TESTS=1 \
-DSPIRV_SKIP_EXECUTABLES=1 -DENABLE_GLSLANG_BINARIES=0 \
-DENABLE_CTEST=0
sed -i "s#install_name $(pwd)/libshaderc#install_name @rpath#g" libshaderc/CMakeFiles/shaderc_shared.dir/link.txt
make -j4
../../../build_tools/fix_rpath.py $(pwd)/libshaderc
if [ ${{ matrix.platform }} = "MacOSX" ]; then
cp -a libshaderc/libshaderc*.dylib $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
else
cp -a libshaderc/libshaderc_combined.a $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/lib
fi
cp -ra ../libshaderc/include/shaderc $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/include
- name: Prepare upload
run: |
mv $HOME/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }} .
rm -rf dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}/share
mkdir build
tar -cJf build/dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}.tar.xz dependencies-${{ steps.sysroot.outputs.lowercase }}-${{ matrix.arch }}
- name: Copy SDL2
if: ${{ matrix.platform == 'iPhoneSimulator' && matrix.arch == 'arm64' }}
run: |
tar -cJf build/sdl.tar.xz src/sdl2
- name: Upload dependencies
uses: actions/upload-artifact@v3.1.1
with:
name: build
path: build/*
packaging:
name: Packaging dependencies
needs: build
runs-on: macos-12
steps:
- uses: maxim-lobanov/setup-xcode@v1.5.1
with:
xcode-version: latest-stable
- name: Configure packaging name for git master branch
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "release_name=preview" >> $GITHUB_ENV
- name: Configure packaging name for tag
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV
- name: Exit otherwise
if: ${{ !(github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) ||
github.repository_owner != 'supertuxkart' }}
run: exit 1
- name: Check for prerelease
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }}
run: |
echo "release_pre=true" >> $GITHUB_ENV
- name: Check for non-prerelease
if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }}
run: |
echo "release_pre=false" >> $GITHUB_ENV
- name: Download dependencies
uses: actions/download-artifact@v2
- name: lipo -create libraries
run: |
tar xf build/dependencies-iphoneos-arm64.tar.xz
tar xf build/dependencies-iphonesimulator-x86_64.tar.xz
tar xf build/dependencies-iphonesimulator-arm64.tar.xz
tar xf build/dependencies-appletvos-arm64.tar.xz
tar xf build/dependencies-appletvsimulator-x86_64.tar.xz
tar xf build/dependencies-appletvsimulator-arm64.tar.xz
tar xf build/dependencies-macosx-x86_64.tar.xz
tar xf build/dependencies-macosx-arm64.tar.xz
mkdir -p dependencies-macosx/lib
mv dependencies-macosx-x86_64/include dependencies-macosx
cd dependencies-macosx/lib
for f in ../../dependencies-macosx-x86_64/lib/*.dylib; do
file=$(basename $f)
if [ -L $f ]; then
cp -a ../../dependencies-macosx-x86_64/lib/$file .
continue
fi
lipo -create ../../dependencies-macosx-x86_64/lib/$file ../../dependencies-macosx-arm64/lib/$file -output $file
done
cd ../..
for simulator in iphonesimulator appletvsimulator; do
mkdir -p dependencies-$simulator/lib
mv dependencies-$simulator-x86_64/include dependencies-$simulator
cd dependencies-$simulator/lib
for f in ../../dependencies-$simulator-x86_64/lib/*.a; do
file=$(basename $f)
lipo -create ../../dependencies-$simulator-x86_64/lib/$file ../../dependencies-$simulator-arm64/lib/$file -output $file
done
cd ../..
done
# Only single arch for iphoneos and appletvos
mv dependencies-iphoneos-arm64 dependencies-iphoneos
mv dependencies-appletvos-arm64 dependencies-appletvos
- name: Build SDL2
run: |
tar xf build/sdl.tar.xz
cd src/sdl2/Xcode/SDL
xcodebuild -project SDL.xcodeproj -target "Shared Library" -configuration Release -sdk macosx CONFIGURATION_BUILD_DIR=./build-macosx
cp -a build-macosx/libSDL2.dylib ../../../../dependencies-macosx/lib
cp -rp ../../include ../../../../dependencies-macosx/include/SDL2
xcodebuild -project SDL.xcodeproj -target "Static Library-iOS" -configuration Release -sdk iphoneos CONFIGURATION_BUILD_DIR=./build-iphoneos OTHER_CFLAGS="-fno-objc-msgsend-selector-stubs -Wno-unused-command-line-argument"
cp build-iphoneos/libSDL2.a ../../../../dependencies-iphoneos/lib
cp -rp ../../include ../../../../dependencies-iphoneos/include/SDL2
xcodebuild -project SDL.xcodeproj -target "Static Library-iOS" -configuration Release -sdk iphonesimulator CONFIGURATION_BUILD_DIR=./build-iphonesimulator OTHER_CFLAGS="-fno-objc-msgsend-selector-stubs -Wno-unused-command-line-argument"
cp build-iphonesimulator/libSDL2.a ../../../../dependencies-iphonesimulator/lib
cp -rp ../../include ../../../../dependencies-iphonesimulator/include/SDL2
xcodebuild -project SDL.xcodeproj -target "Static Library-tvOS" -configuration Release -sdk appletvos CONFIGURATION_BUILD_DIR=./build-appletvos OTHER_CFLAGS="-fno-objc-msgsend-selector-stubs -Wno-unused-command-line-argument"
cp build-appletvos/libSDL2.a ../../../../dependencies-appletvos/lib
cp -rp ../../include ../../../../dependencies-appletvos/include/SDL2
xcodebuild -project SDL.xcodeproj -target "Static Library-tvOS" -configuration Release -sdk appletvsimulator CONFIGURATION_BUILD_DIR=./build-appletvsimulator OTHER_CFLAGS="-fno-objc-msgsend-selector-stubs -Wno-unused-command-line-argument"
cp build-appletvsimulator/libSDL2.a ../../../../dependencies-appletvsimulator/lib
cp -rp ../../include ../../../../dependencies-appletvsimulator/include/SDL2
- name: Add MoltenVK
run: |
wget https://github.com/supertuxkart/dependencies/releases/download/moltenvk/moltenvk-1.2.4.tar.xz
mkdir moltenvk
tar xf moltenvk-1.2.4.tar.xz -C moltenvk
for platform in macosx iphoneos iphonesimulator appletvos appletvsimulator; do
cp -rp moltenvk/include/MoltenVK dependencies-$platform/include
cp -rp moltenvk/include/vk_video dependencies-$platform/include
cp -rp moltenvk/include/vulkan dependencies-$platform/include
done
cp moltenvk/dylib/macOS/libMoltenVK.dylib dependencies-macosx/lib
cp moltenvk/MoltenVK.xcframework/ios-arm64/libMoltenVK.a dependencies-iphoneos/lib
cp moltenvk/MoltenVK.xcframework/ios-arm64_x86_64-simulator/libMoltenVK.a dependencies-iphonesimulator/lib
cp moltenvk/MoltenVK.xcframework/tvos-arm64_arm64e/libMoltenVK.a dependencies-appletvos/lib
cp moltenvk/MoltenVK.xcframework/tvos-arm64_x86_64-simulator/libMoltenVK.a dependencies-appletvsimulator/lib
- name: Archive
run: |
tar -cJf dependencies-macosx.tar.xz dependencies-macosx
tar -cJf dependencies-iphoneos.tar.xz dependencies-iphoneos
tar -cJf dependencies-iphonesimulator.tar.xz dependencies-iphonesimulator
tar -cJf dependencies-appletvos.tar.xz dependencies-appletvos
tar -cJf dependencies-appletvsimulator.tar.xz dependencies-appletvsimulator
- name: Upload Apple dependencies
uses: ncipollo/release-action@v1.11.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "dependencies*.xz"
tag: ${{ env.release_name }}
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
allowUpdates: true
prerelease: ${{ env.release_pre }}