-
Notifications
You must be signed in to change notification settings - Fork 21
582 lines (580 loc) · 29 KB
/
win.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
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
name: win
on:
push:
branches:
- master
tags:
- '*'
pull_request: {}
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: true
matrix:
arch: [i686, x86_64, armv7, aarch64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.5.0
with:
fetch-depth: 1
submodules: true
- 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: Setting up llvm-dlltool arch for i686
if: ${{ matrix.arch == 'i686' }}
run: |
echo "dlltool_arch=i386" >> $GITHUB_ENV
- name: Setting up llvm-dlltool arch for x86_64
if: ${{ matrix.arch == 'x86_64' }}
run: |
echo "dlltool_arch=i386:x86-64" >> $GITHUB_ENV
- name: Setting up llvm-dlltool arch for armv7
if: ${{ matrix.arch == 'armv7' }}
run: |
echo "dlltool_arch=arm" >> $GITHUB_ENV
- name: Setting up llvm-dlltool arch for aarch64
if: ${{ matrix.arch == 'aarch64' }}
run: |
echo "dlltool_arch=arm64" >> $GITHUB_ENV
- name: Get LLVM MinGW
run: |
sudo cp build_tools/dll2lib.sh /usr/local/bin
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20210423/llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64.tar.xz -P $HOME
cd $HOME
tar xf llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64.tar.xz
mv llvm-mingw-20210423-msvcrt-ubuntu-18.04-x86_64 llvm-mingw
- name: Set up MinGW for x86 or x64
if: ${{ matrix.arch == 'i686' || matrix.arch == 'x86_64' }}
run: |
cd /
sudo mkdir -p /data/mxe/usr
cd /data/mxe/usr
# It's compiled from https://github.com/mxe/mxe
sudo wget https://github.com/supertuxkart/dependencies/releases/download/preview/mxe_static_mingw.zip
sudo unzip mxe_static_mingw.zip
sudo rm mxe_static_mingw.zip
# For libfl.so.2
sudo apt install -y libfl-dev
- name: Restore timestamps
run: |
cd src
for dir in *
do
cd $dir
last_time=$(git log --date=local --pretty=format:"%cd" . | head -1)
find . -exec touch -d "$last_time" {} +
cd ..
done
- name: Build zlib
run: |
cd src/zlib
# zlib cmake will change the public header, install it first
mkdir -p $HOME/dependencies-win-${{ matrix.arch }}/bin
mkdir -p $HOME/dependencies-win-${{ matrix.arch }}/include
mkdir -p $HOME/dependencies-win-${{ matrix.arch }}/lib
cp -p zconf.h zlib.h $HOME/dependencies-win-${{ matrix.arch }}/include
mkdir build
cd build
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }}
make -j4
dll2lib.sh ${{ env.dlltool_arch }} libzlib.dll
cp libzlib.dll libzlib.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
# Windows finds only zlib.lib
cp libzlib.lib $HOME/dependencies-win-${{ matrix.arch }}/lib/zlib.lib
- name: Build Mbed TLS
run: |
cd src/mbedtls
# Fix C99 error
sed -i 's/set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")//g' CMakeLists.txt
# Windows XP compatibility
sed -i 's/if defined(_TRUNCATE)/if 0/g' library/platform.c
mkdir build
cd build
unset EXTRA_CFLAGS
if [ ${{ matrix.arch }} = "armv7" ]; then
# Required for armv7 build, otherwise including bn_mul.h fails
EXTRA_CFLAGS="-DMULADDC_CANNOT_USE_R7=0"
fi
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF \
-DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=OFF \
-DCMAKE_C_FLAGS=$EXTRA_CFLAGS
make -j4
make install
rm -rf $HOME/dependencies-${{ matrix.sysroot }}/cmake
cd library
dll2lib.sh ${{ env.dlltool_arch }} libmbedcrypto.dll
dll2lib.sh ${{ env.dlltool_arch }} libmbedx509.dll
dll2lib.sh ${{ env.dlltool_arch }} libmbedtls.dll
cp *.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp *.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/*.a
- name: Build cURL
run: |
cd src/curl
mkdir build
cd build
# -DCURL_TARGET_WINDOWS_VERSION=0x0501 for Windows XP
# -DCURL_CA_BUNDLE=none -DCURL_CA_PATH=none because STK includes its own
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DBUILD_TESTING=OFF -DBUILD_CURL_EXE=OFF \
-DCURL_STATIC_CRT=ON -DCURL_TARGET_WINDOWS_VERSION=0x0501 \
-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
make -j4
make install
cd lib
dll2lib.sh ${{ env.dlltool_arch }} libcurl.dll
cp libcurl.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libcurl.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
rm -f $HOME/dependencies-win-${{ matrix.arch }}/bin/curl-config
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/cmake
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/pkgconfig
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/*.a
- name: Build SQLite
run: |
cd src/sqlite
sed -i 's/Rpcrt4.lib/rpcrt4/g' CMakeLists.txt
mkdir build
cd build
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }}
make
dll2lib.sh ${{ env.dlltool_arch }} libsqlite3.dll
cp -p ../sqlite3ext.h ../sqlite3.h $HOME/dependencies-win-${{ matrix.arch }}/include
cp libsqlite3.dll libsqlite3.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libsqlite3.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
- name: Build libpng
run: |
cd src/libpng
mkdir build
cd build
# -DPNG_INTEL_SSE=off for non-sse2 capable CPUs (at the moment it only get enabled
# in x86_64 only)
# -DPNG_ARM_NEON=off is required for successful compilation of aarch64
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DPNG_STATIC=OFF -DPNG_TESTS=OFF -DPNG_ARM_NEON=off
make -j4
dll2lib.sh ${{ env.dlltool_arch }} libpng16.dll
make install
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/pkgconfig
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/libpng*
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/bin/*png*
cp libpng16.dll libpng16.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libpng16.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
touch -r ../README $HOME/dependencies-win-${{ matrix.arch }}/include/png*
touch -r ../README $HOME/dependencies-win-${{ matrix.arch }}/include/libpng16/*
- name: Build FreeType bootstrap
run: |
cd src/freetype
mkdir build
cd build
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ 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=ON
make -j4
dll2lib.sh ${{ env.dlltool_arch }} libfreetype.dll
make install
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/cmake
cp libfreetype.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libfreetype.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/*.a
touch -r ../README $HOME/dependencies-win-${{ matrix.arch }}/include/freetype2/freetype/config/*
- name: Build HarfBuzz
run: |
cd src/harfbuzz
# Remove libwinpthread-1.dll dependency
sed -i '/add_definitions("-DHAVE_PTHREAD")/d' CMakeLists.txt
sed -i '/list(APPEND THIRD_PARTY_LIBS Threads::Threads)/d' CMakeLists.txt
mkdir build
cd build
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DHB_HAVE_CORETEXT=OFF -DHB_HAVE_FREETYPE=ON -DBUILD_SHARED_LIBS=ON \
-DHB_BUILD_SUBSET=OFF
make -j4
dll2lib.sh ${{ env.dlltool_arch }} libharfbuzz.dll
make install
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/cmake
cp libharfbuzz.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libharfbuzz.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/*.a
- name: Build FreeType
run: |
cd src/freetype
git reset --hard
rm -rf build
mkdir build
cd build
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ 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=ON
make -j4
# Don't make install again as the timestamp will be overwritten after git reset --hard
dll2lib.sh ${{ env.dlltool_arch }} libfreetype.dll
cp libfreetype.dll libfreetype.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libfreetype.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
- name: Build Ogg
run: |
cd src/libogg
mkdir build
cd build
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DINSTALL_DOCS=OFF \
-DINSTALL_PKG_CONFIG_MODULE=OFF -DINSTALL_CMAKE_PACKAGE_MODULE=OFF
make -j4
dll2lib.sh ${{ env.dlltool_arch }} libogg.dll
make install
cp libogg.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libogg.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/*.a
touch -r ../README.md $HOME/dependencies-win-${{ matrix.arch }}/include/ogg/*
- name: Build Vorbis
run: |
cd src/libvorbis
mkdir build
cd build
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DBUILD_SHARED_LIBS=ON -DINSTALL_CMAKE_PACKAGE_MODULE=OFF
make -j4
cd lib
dll2lib.sh ${{ env.dlltool_arch }} libvorbis.dll
dll2lib.sh ${{ env.dlltool_arch }} libvorbisenc.dll
dll2lib.sh ${{ env.dlltool_arch }} libvorbisfile.dll
cp libvorbis*.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libvorbis*.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
cd ..
make install
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/*.a
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/pkgconfig
- name: Build libjpeg-turbo
run: |
sudo apt install -y yasm
cd src/libjpeg
# Windows XP compatibility
sed -i 's/#ifndef NO_PUTENV/#define NO_PUTENV\n#ifndef NO_PUTENV/g' jinclude.h
mkdir build
cd build
# libjpeg install library to lib64 folder, override it
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DENABLE_SHARED=ON -DENABLE_STATIC=OFF -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib
make -j4
dll2lib.sh ${{ env.dlltool_arch }} libjpeg-62.dll
# CMake detects only libjpeg.lib
mv libjpeg-62.lib libjpeg.lib
dll2lib.sh ${{ env.dlltool_arch }} libturbojpeg.dll
make install
cp libturbojpeg.pdb libjpeg-62.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libturbojpeg.lib libjpeg.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
rm -f $HOME/dependencies-win-${{ matrix.arch }}/bin/*.exe
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/*.a
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/cmake
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/pkgconfig
touch -r ../README.md $HOME/dependencies-win-${{ matrix.arch }}/include/jconfig.h
- name: Build libvpx
run: |
# We use clang only for aarch64 because staticially linking winpthread
# leads to GetTickCount64 which only available in > vista
cd src/libvpx
patch -p1 <../../patches/libvpx-win-configure.patch
# Fix for clang
sed -i 's/-Wl,-no-undefined//g' build/make/configure.sh
mkdir build-vpx
cd build-vpx
unset EXTRA_CFLAGS
if [ ${{ matrix.arch }} = "i686" ]; then
_targetarch="x86-win32-gcc"
# Required for 32bit build, otherwise crash when using
EXTRA_CFLAGS="-mstackrealign"
#EXTRA_CFLAGS="-mstackrealign -gcodeview"
_runtimecpu="--enable-runtime-cpu-detect"
_compiler=/data/mxe/usr/bin/${{ matrix.arch }}-w64-mingw32.static.posix.dw2-
elif [ ${{ matrix.arch }} = "armv7" ]; then
_targetarch="armv7-win32-gcc"
EXTRA_CFLAGS="-gcodeview"
# Arm doesn't support runtime cpu detection
_runtimecpu="--disable-runtime-cpu-detect"
_compiler=$HOME/llvm-mingw/bin/${{ matrix.arch }}-w64-mingw32-
elif [ ${{ matrix.arch }} = "aarch64" ]; then
_targetarch="arm64-win64-gcc"
EXTRA_CFLAGS="-gcodeview"
# Arm doesn't support runtime cpu detection
_runtimecpu="--disable-runtime-cpu-detect"
_compiler=$HOME/llvm-mingw/bin/${{ matrix.arch }}-w64-mingw32-
else
_targetarch="x86_64-win64-gcc"
#EXTRA_CFLAGS="-gcodeview"
_runtimecpu="--enable-runtime-cpu-detect"
_compiler=/data/mxe/usr/bin/${{ matrix.arch }}-w64-mingw32.static.posix.seh-
fi
LDFLAGS="-static" \
CFLAGS="$EXTRA_CFLAGS -fno-asynchronous-unwind-tables" \
CROSS=${_compiler} ../configure \
--prefix=$HOME/dependencies-win-${{ matrix.arch }} \
--target=${_targetarch} \
--disable-docs \
--disable-install-docs \
--disable-install-srcs \
--enable-pic \
--enable-postproc \
${_runtimecpu} \
--enable-shared \
--enable-vp8 \
--enable-vp9 \
--enable-vp9-highbitdepth \
--enable-vp9-temporal-denoising
if [ ${{ matrix.arch }} = "armv7" ] || [ ${{ matrix.arch }} = "aarch64" ]; then
sed -i 's/-Wl,--no-undefined/-Wl,-undefined,error/g' Makefile
sed -i 's/-Wl,-soname,$$(SONAME)//g' Makefile
sed -i 's/-Wl,--version-script,$$(EXPORTS_FILE) /-Wl,-pdb=libvpx.pdb /g' Makefile
fi
make -j4
make install
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/libvpx*
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/pkgconfig
rm -f $HOME/dependencies-win-${{ matrix.arch }}/bin/vpx*
cp libvpx.dll $HOME/dependencies-win-${{ matrix.arch }}/bin
if [ ${{ matrix.arch }} = "i686" ] || [ ${{ matrix.arch }} = "x86_64" ]; then
strip $HOME/dependencies-win-${{ matrix.arch }}/bin/libvpx.dll
fi
# 2>/dev/null || : to ignore missing .pdb if not aarch64
cp libvpx.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin 2>/dev/null || :
VPXDEF=$(awk '!/:/' libvpx.ver | sed 's/;//g')
echo "EXPORTS" > libvpx.def
printf "${VPXDEF}" >> libvpx.def
$HOME/llvm-mingw/bin/llvm-dlltool -m ${{ env.dlltool_arch }} -d libvpx.def -D libvpx.dll -l libvpx.lib
cp libvpx.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
- name: Build SDL2
run: |
cd src/sdl2
# Windows XP compatibility
sed -i 's/defined(__WINRT__) || defined(__GDK__)/0/g' src/audio/wasapi/SDL_wasapi.c
mkdir build
cd build
# Sensor is causing problems in msvc debugger
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DBUILD_SHARED_LIBS=ON -DSDL_SENSOR=OFF
make -j4
dll2lib.sh ${{ env.dlltool_arch }} SDL2.dll
# Manually install the header for msvc usage
cp -rp ../include $HOME/dependencies-win-${{ matrix.arch }}/include/SDL2
cp SDL2.dll SDL2.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp SDL2.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/cmake
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/*.a
- name: Build OpenAL
run: |
cd src/openal
cd build
if [ ${{ matrix.arch }} = "i686" ]; then
# OpenAL fails to compile with only -DALSOFT_ENABLE_SSE2_CODEGEN
# Need to disable all SSE completely
cmake .. -DMXE_PREFIX=/data/mxe/usr \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-mxe-${{ matrix.arch }}.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DALSOFT_UTILS=OFF -DALSOFT_EXAMPLES=OFF -DALSOFT_NO_CONFIG_UTIL=ON \
-DALSOFT_CPUEXT_SSE=OFF -DALSOFT_CPUEXT_SSE2=OFF -DALSOFT_CPUEXT_SSE3=OFF \
-DALSOFT_CPUEXT_SSE4_1=OFF -DALSOFT_ENABLE_SSE_CODEGEN=OFF \
-DALSOFT_ENABLE_SSE2_CODEGEN=OFF -DCMAKE_DLLTOOL="" -DALSOFT_BACKEND_PIPEWIRE=OFF
elif [ ${{ matrix.arch }} = "armv7" ] || [ ${{ matrix.arch }} = "aarch64" ]; then
# Without -DCMAKE_DLLTOOL="": error: no target machine specified when llvm-dlltool
# We generate .lib ourselves later anyway
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DALSOFT_UTILS=OFF -DALSOFT_EXAMPLES=OFF -DALSOFT_NO_CONFIG_UTIL=ON \
-DCMAKE_DLLTOOL="" -DALSOFT_BACKEND_PIPEWIRE=OFF
else
cmake .. -DMXE_PREFIX=/data/mxe/usr \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-mxe-${{ matrix.arch }}.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DALSOFT_UTILS=OFF -DALSOFT_EXAMPLES=OFF -DALSOFT_NO_CONFIG_UTIL=ON \
-DCMAKE_DLLTOOL="" -DALSOFT_BACKEND_PIPEWIRE=OFF
fi
make -j4
if [ ${{ matrix.arch }} = "i686" ] || [ ${{ matrix.arch }} = "x86_64" ]; then
# Without stripping it's 2xMB when using GNU Mingw
strip OpenAL32.dll
fi
dll2lib.sh ${{ env.dlltool_arch }} OpenAL32.dll
make install
cp OpenAL32.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin 2>/dev/null || :
cp OpenAL32.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/cmake
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/pkgconfig
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/*.a
- name: Build libopenglrecorder
run: |
cd src/libopenglrecorder
mkdir dependencies-mingw
cd dependencies-mingw
cp -r $HOME/dependencies-win-${{ matrix.arch }}/* .
cd ..
if [ ${{ matrix.arch }} = "x86_64" ] || [ ${{ matrix.arch }} = "aarch64" ]; then
mv dependencies-mingw dependencies-mingw-64bit
fi
mkdir build
cd build
if [ ${{ matrix.arch }} = "i686" ] || [ ${{ matrix.arch }} = "x86_64" ]; then
_toolchain_file=../../../cmake/Toolchain-mxe-${{ matrix.arch }}.cmake
else
_toolchain_file=../../../cmake/Toolchain-llvm-mingw.cmake
fi
cmake .. -DMXE_PREFIX=/data/mxe/usr \
-DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=${_toolchain_file} \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }}
make -j4
if [ ${{ matrix.arch }} = "i686" ] || [ ${{ matrix.arch }} = "x86_64" ]; then
strip libopenglrecorder.dll
fi
# Use dll2lib.sh will export Unwind symbols which will conflict libc++.a
$HOME/llvm-mingw/bin/llvm-dlltool -m ${{ env.dlltool_arch }} -d ../openglrecorder.def -D libopenglrecorder.dll -l libopenglrecorder.lib
cp libopenglrecorder.dll $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libopenglrecorder.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin 2>/dev/null || :
cp libopenglrecorder.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
cp -p ../openglrecorder.h $HOME/dependencies-win-${{ matrix.arch }}/include
- name: Build libsamplerate
run: |
cd src/libsamplerate
mkdir build
cd build
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DLIBSAMPLERATE_EXAMPLES=OFF
make -j5
cd src
dll2lib.sh ${{ env.dlltool_arch }} libsamplerate-0.dll
mv libsamplerate-0.lib libsamplerate.lib
cd ..
make install
cp src/libsamplerate-0.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin
cp src/libsamplerate.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/pkgconfig
rm -rf $HOME/dependencies-win-${{ matrix.arch }}/lib/cmake
rm -f $HOME/dependencies-win-${{ matrix.arch }}/lib/libsamplerate.dll.a
- name: Build astc-encoder
run: |
cd src/astc-encoder
sed -i '/-Werror/d' Source/cmake_core.cmake
sed -i 's/${ASTCENC_TARGET}-shared/astcenc/g' Source/cmake_core.cmake
mkdir build
cd build
# We require SSE4.1 (x86) or NEON (arm*) for astc-encoder
if [ ${{ matrix.arch }} = "armv7" ]; then
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DASTCENC_ISA_NEON=OFF -DASTCENC_INVARIANCE=OFF -DASTCENC_CLI=OFF \
-DASTCENC_SHAREDLIB=ON
elif [ ${{ matrix.arch }} = "aarch64" ]; then
cmake .. -DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-llvm-mingw.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DASTCENC_ISA_NEON=ON -DASTCENC_INVARIANCE=OFF -DASTCENC_CLI=OFF \
-DASTCENC_SHAREDLIB=ON
else
if [ ${{ matrix.arch }} = "i686" ]; then
sed -i 's/_mm_popcnt_u64/__builtin_popcountll/g' ../Source/astcenc_vecmathlib_sse_4.h
fi
sed -i 's/_mm_round_ps(a.m, flags)/_mm_round_ps(a.m, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC)/g' ../Source/astcenc_vecmathlib_sse_4.h
cmake .. -DMXE_PREFIX=/data/mxe/usr \
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-mxe-${{ matrix.arch }}.cmake \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ matrix.arch }} \
-DASTCENC_ISA_SSE41=ON -DASTCENC_INVARIANCE=OFF -DASTCENC_CLI=OFF \
-DASTCENC_SHAREDLIB=ON -DCMAKE_C_FLAGS='-O2' -DCMAKE_CXX_FLAGS='-O2'
fi
make -j4
dll2lib.sh ${{ env.dlltool_arch }} Source/libastcenc.dll
cp Source/libastcenc.dll $HOME/dependencies-win-${{ matrix.arch }}/bin
cp Source/libastcenc.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin 2>/dev/null || :
cp Source/libastcenc.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
cp -p ../Source/astcenc.h $HOME/dependencies-win-${{ matrix.arch }}/include
- name: Build shaderc
run: |
cd src/shaderc
utils/git-sync-deps
if [ ${{ matrix.arch }} = "i686" ] || [ ${{ matrix.arch }} = "x86_64" ]; then
_toolchain_file=../../../cmake/Toolchain-mxe-${{ matrix.arch }}.cmake
sed -i 's/(defined(MINGW_HAS_SECURE_API) && MINGW_HAS_SECURE_API)/0/g' third_party/glslang/glslang/Include/Common.h
else
_toolchain_file=../../../cmake/Toolchain-llvm-mingw.cmake
fi
mkdir build
cd build
cmake .. -DMXE_PREFIX=/data/mxe/usr \
-DLLVM_ARCH=${{ matrix.arch }} -DLLVM_PREFIX=$HOME/llvm-mingw \
-DCMAKE_TOOLCHAIN_FILE=${_toolchain_file} \
-DCMAKE_INSTALL_PREFIX=$HOME/dependencies-win-${{ 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
make -j4
dll2lib.sh ${{ env.dlltool_arch }} libshaderc/libshaderc_shared.dll
cp libshaderc/libshaderc_shared.dll $HOME/dependencies-win-${{ matrix.arch }}/bin
cp libshaderc/libshaderc_shared.pdb $HOME/dependencies-win-${{ matrix.arch }}/bin 2>/dev/null || :
cp libshaderc/libshaderc_shared.lib $HOME/dependencies-win-${{ matrix.arch }}/lib
cp -ra ../libshaderc/include/shaderc $HOME/dependencies-win-${{ matrix.arch }}/include
- name: Archive
run: |
FOLDER=$(pwd)
cd
rm -rf dependencies-win-${{ matrix.arch }}/share
zip -r $FOLDER/dependencies-win-${{ matrix.arch }}.zip dependencies-win-${{ matrix.arch }}
- name: Upload windows deps
uses: ncipollo/release-action@v1.11.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "dependencies*.zip"
tag: ${{ env.release_name }}
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
allowUpdates: true
prerelease: ${{ env.release_pre }}