forked from mpv-player/mpv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcrosscompile-mingw-tedious.txt
7348 lines (5774 loc) · 285 KB
/
crosscompile-mingw-tedious.txt
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
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///////////////
/// Preface
///////////////
# mpv can be cross-compiled for either 32-bit or 64-bit Windows from a Linux
# host by using MinGW-w64. MinGW-w64 is available from
# http://mingw-w64.sourceforge.net.
//////////////////////////////////////
/// Advanced (manual) instructions
//////////////////////////////////////
# This guide was written under Ubuntu (starting with 12.10), but realistically,
# any Debian-based system should work as far as the apt commands go, and/or any
# arbitrary Linux distribution could probably be used on the pure compilation
# stuffs.
# This guide assumes that you're running a 64-bit version of Ubuntu, and that
# the installed cross environment is multilib-enabled.
# Make sure you have a list of other necessary build system and source download
# components.
sudo apt-get install build-essential gcc-multilib g++-multilib checkinstall \
nasm yasm cvs git gperf subversion mercurial automake* autoconf* libtool* m4 \
bison flex p7zip-full lzip texinfo help2man tofrodos texi2html docutils-common \
cmake pkgconf bzr autopoint meson ninja-build gettext binfmt-support ruby \
doxygen gtk-doc-tools zlib1g-dev python-is-python3 python3-setuptools
# Any time \ is at the end of a line, it means the command spans multiple lines.
# Make sure to copy the entire command. To make this easier to see, such
# commands have been indented.
# Wine is helpful for testing binaries while still under Ubuntu, and for more
# rigorously making the compilation process assume it's being run on Windows.
# The preferred way to handle this is by installing from the official PPA, as
# Ubuntu 20.10 (and presumably going forward) seems to have issues surrounding
# a unified Wine32/Wine64 environment, and this will screw up trying to build
# 32-bit software on a 64-bit OS.
sudo dpkg --add-architecture i386 && \
sudo mkdir -pm755 /etc/apt/keyrings && \
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key && \
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/oracular/winehq-oracular.sources && \
sudo apt-get update && \
sudo apt-get install --install-recommends winehq-devel wine-binfmt && \
sudo update-binfmts --import wine
# You'll notice that there are certain cpu optimization flags used by the
# majority of steps in this guide (core2 for 64-bit, or pentium3 for 32-bit).
# These are simply due to what I feel are respectable baselines for each, so
# feel free to either omit them, or to use ones that match your setup. For the
# list of CPU types and SIMD flags, consult GCC's CPU optimization info at:
# http://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
//////////////////////////////////
/// MinGW-w64/GCC installation
//////////////////////////////////
# The first step to cross-compiling is to actually have a cross-compilation
# environment. Earlier versions of this guide used Zeranoe's build script as
# the method to generate this initial toolchain, but in the interest of
# flexibility I've opted to go with manually building these components as well.
# The instructions are based on what Zeranoe's build script used to do, as we're
# assuming the user will install this toolchain to the system as a replacement
# or alternative to the repository version.
# Any of the make steps can be executed in parallel by specifying the
# --jobs/-j parameter with the number of cores your CPU has. This guide
# makes this automatic by using -j$(nproc), which will detect the number
# of cores and use a corresponding number of jobs. This is only relevant
# for make, since ninja uses all cores by default.
# First, we need a staging area, so that all the packages don't clutter up your
# home directory:
mkdir ~/mingw-packages
# Additionally, all of these will be getting installed to non-system areas
# initially, since most of them actually don't get installed and are only needed
# during the build process, and the others need to be in a correct directory
# hierarchy before being installed.
+++++++++++++++++++++++++++++++++++++++++++++++++++
+ Building multilib cross-compilation environment
+++++++++++++++++++++++++++++++++++++++++++++++++++
Dependency: Binutils
====================
cd ~/mingw-packages && \
wget https://ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.xz -O - | tar -xJvf - && \
cd binutils-2.43.1 && \
CPPFLAGS="-march=native" ./configure --prefix=$HOME/mingw-build/mingw-w64-x86_64 \
--disable-shared --enable-static --disable-nls --enable-multilib \
--enable-targets=x86_64-w64-mingw32,i686-w64-mingw32 \
--target=x86_64-w64-mingw32 --with-sysroot=$HOME/mingw-build/mingw-w64-x86_64 \
--datarootdir=$HOME/mingw-build/mingw-w64-x86_64/share/gdb-mingw && \
make -j$(nproc) && \
make install
Dependency: MinGW-w64 headers
=============================
cd ~/mingw-packages && \
wget https://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v12.0.0.tar.bz2 -O - | tar -xjvf - && \
cd mingw-w64-v12.0.0/mingw-w64-headers && \
CPPFLAGS="-march=core2" \
./configure --prefix=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--enable-sdk=all --enable-secure-api --enable-silent-rules \
--host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
make install && \
cd $HOME/mingw-build/mingw-w64-x86_64 && \
ln -s x86_64-w64-mingw32 mingw
Dependency: GMP
===============
cd ~/mingw-packages && \
wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz -O - | tar -xJvf - && \
cd gmp-6.3.0 && \
CPPFLAGS="-march=native -fexceptions" \
./configure --prefix=$HOME/mingw-packages/gmp-6.3.0-x86_64 --enable-fat \
--disable-shared --enable-static --enable-cxx --enable-silent-rules && \
make -j$(nproc) && \
make install
Dependency: MPFR
================
cd ~/mingw-packages && \
wget http://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.xz -O - | tar -xJvf - && \
cd mpfr-4.2.1 && \
#wget http://www.mpfr.org/mpfr-4.2.1/allpatches && \
#patch -N -Z -p1 < allpatches && \
CPPFLAGS="-march=native" \
./configure --prefix=$HOME/mingw-packages/mpfr-4.2.1-x86_64 --disable-shared \
--enable-static --with-gmp=$HOME/mingw-packages/gmp-6.3.0-x86_64 \
--enable-silent-rules && \
make -j$(nproc) && \
make install
Dependency: MPC
===============
cd ~/mingw-packages && \
wget https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz -O - | tar -xzvf - && \
cd mpc-1.3.1 && \
CPPFLAGS="-march=native" \
./configure --prefix=$HOME/mingw-packages/mpc-1.3.1-x86_64 --disable-shared \
--enable-static --with-gmp=$HOME/mingw-packages/gmp-6.3.0-x86_64 \
--with-mpfr=$HOME/mingw-packages/mpfr-4.2.1-x86_64 --enable-silent-rules && \
make -j$(nproc) && \
make install
Dependency: ISL
===============
cd ~/mingw-packages && \
wget https://libisl.sourceforge.io/isl-0.27.tar.xz -O - | tar -xJvf - && \
cd isl-0.27 && \
CPPFLAGS="-march=native" \
./configure --prefix=$HOME/mingw-packages/isl-0.27-x86_64 --enable-static \
--with-gmp-prefix=$HOME/mingw-packages/gmp-6.3.0-x86_64 \
--disable-shared --with-clang=no && \
make -j$(nproc) && \
make install
GNU Compiler Collection (GCC)
=============================
cd ~/mingw-packages && \
wget https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz -O - | tar -xJvf - && \
# GCC requires an out-of-tree build, so we create another staging area
# specifically for GCC.
# To avoid a 'too many open file descriptors' error when linking FFmpeg,
# LTO must be disabled when building GCC.
mkdir gcc-build && \
cd gcc-build && \
# Now, the main build process.
CPPFLAGS="-march=native" ../gcc-14.2.0/configure \
--prefix=$HOME/mingw-build/mingw-w64-x86_64 --disable-shared \
--enable-static --disable-nls --enable-multilib \
--with-sysroot=$HOME/mingw-build/mingw-w64-x86_64 \
--with-mpc=$HOME/mingw-packages/mpc-1.3.1-x86_64 \
--with-mpfr=$HOME/mingw-packages/mpfr-4.2.1-x86_64 \
--with-gmp=$HOME/mingw-packages/gmp-6.3.0-x86_64 \
--with-isl=$HOME/mingw-packages/isl-0.27-x86_64 \
--with-host-libstdcxx=-lstdc++ --enable-languages=c,c++ \
--enable-threads=posix --enable-fully-dynamic-string \
--build=x86_64-pc-linux-gnu --target=x86_64-w64-mingw32 \
--enable-targets=all --disable-lto --enable-mingw-wildcard \
--with-system-zlib && \
make -j$(nproc) all-gcc && \
make install-gcc
# --with-system-zlib is necessary because the in-tree zlib
# doesn't seem to want to build with multilib enabled (and we'll
# be building our own zlib for MinGW later anyway).
MinGW-w64 Runtime
=================
cd ~/mingw-packages/mingw-w64-v12.0.0/mingw-w64-crt && \
export PATH=$PATH:$HOME/mingw-build/mingw-w64-x86_64/bin && \
CPPFLAGS="-march=core2 -D_FORTIFY_SOURCE=0" ./configure \
--prefix=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--with-sysroot=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--enable-lib32 --enable-wildcard --enable-silent-rules \
--host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
make install && \
Winpthreads
+++++++++++
# Enabling threads=posix in GCC requires building MinGW's winpthreads library
cd ~/mingw-packages/mingw-w64-v12.0.0/mingw-w64-libraries/winpthreads && \
CPPFLAGS="-march=core2" \
./configure --prefix=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--with-sysroot=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--disable-shared --enable-silent-rules --host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
make install && \
# The 32-bit version of winpthreads has to be built separately.
make distclean && \
cd ~/mingw-packages/mingw-w64-v12.0.0/mingw-w64-libraries/winpthreads && \
CPPFLAGS="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
RCFLAGS="-F pe-i386" \
./configure --prefix=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--libdir=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32/lib32 \
--with-sysroot=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--disable-shared --enable-silent-rules --host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
make install
LibGCC
======
cd ~/mingw-packages/gcc-build && \
make -j$(nproc) all-target-libgcc && \
make install-target-libgcc && \
make -j$(nproc) && \
make install-strip
libmangle
=========
# requires libgcc
cd ~/mingw-packages/mingw-w64-v12.0.0/mingw-w64-libraries/libmangle && \
CPPFLAGS="-march=core2" \
./configure --prefix=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--with-sysroot=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--disable-shared --enable-silent-rules --host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
make install && \
make distclean && \
cd ~/mingw-packages/mingw-w64-v12.0.0/mingw-w64-libraries/libmangle && \
CPPFLAGS="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
RCFLAGS="-F pe-i386" \
./configure --prefix=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--libdir=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32/lib32 \
--with-sysroot=$HOME/mingw-build/mingw-w64-x86_64/x86_64-w64-mingw32 \
--disable-shared --enable-silent-rules --host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
make install
Gendef
======
cd ~/mingw-packages/mingw-w64-v12.0.0/mingw-w64-tools/gendef && \
CPPFLAGS="-march=native" \
./configure --prefix=$HOME/mingw-build/mingw-w64-x86_64 \
--build=x86_64-pc-linux-gnu && \
make -j$(nproc) && \
make install && \
cd ~/mingw-build/mingw-w64-x86_64 && \
rm mingw && \
cp bin/gendef bin/x86_64-w64-mingw32-gendef
Cleaning up
===========
# This is as simple as deleting the staging area.
cd ~/ && \
sudo rm -R mingw-packages
Packaging Preparation
=====================
# Copy NASM and pkg-config into the bin directory of the toolchain so that they
# can easily be found when a prefixed copy of these tools are needed.
cd mingw-build/mingw-w64-x86_64 && \
cp /usr/bin/nasm bin/x86_64-w64-mingw32-nasm && \
cp /usr/bin/pkg-config bin/x86_64-w64-mingw32-pkg-config && \
# A few of these pieces require using CMake to build them. This is not as
# straight-forward as using autotools to cross-compile, and requires some setup:
cd x86_64-w64-mingw32 && \
wget https://fastapi.metacpan.org/source/TOKUHIROM/mRuby-0.06/vendor/mruby/cmake/Toolchain-Ubuntu-mingw32.cmake.sample -O toolchain-x86_64-w64-mingw32.cmake && \
sed -i -e 's/ ~\/crossdev\/w32//g' -e 's/i686/x86_64/g' toolchain-x86_64-w64-mingw32.cmake
# Setting up meson's cross-files:
cd ../ && \
mkdir -p share/meson/cross/ && \
wget "https://raw.githubusercontent.com/mesonbuild/meson/master/cross/linux-mingw-w64-64bit.txt" -O share/meson/cross/x86_64-w64-mingw32-multilib32 && \
wget "https://raw.githubusercontent.com/mesonbuild/meson/master/cross/linux-mingw-w64-64bit.txt" -O share/meson/cross/x86_64-w64-mingw32 && \
# Adjust the settings for x86_64:
sed -i -e '13,16d' -e "s/\[properties\]/\[built-in options\]/" share/meson/cross/x86_64-w64-mingw32 && \
sed -i -e "13ic_args = ['-I/usr/x86_64-w64-mingw32/include']\ncpp_args = ['-I/usr/x86_64-w64-mingw32/include']\nc_link_args = ['-L/usr/x86_64-w64-mingw32/lib']\ncpp_link_args = ['-L/usr/x86_64-w64-mingw32/lib']" \
share/meson/cross/x86_64-w64-mingw32
# Adjust the settings for x86:
sed -i -e "s/windres = .*/windres = [\'\/usr\/bin\/x86_64-w64-mingw32-windres\', \'-F\', \'pe-i386\']/" \
-e '13,16d' -e "s/\[properties\]/\[built-in options\]/" \
-e "s/'x86_64'/'x86'/g" share/meson/cross/x86_64-w64-mingw32-multilib32 && \
sed -i -e "13ic_args = ['-m32', '-I/usr/i686-w64-mingw32/include']\ncpp_args = ['-m32', '-I/usr/i686-w64-mingw32/include']\nc_link_args = ['-m32', '-L/usr/i686-w64-mingw32/lib']\ncpp_link_args = ['-m32', '-L/usr/i686-w64-mingw32/lib']" \
share/meson/cross/x86_64-w64-mingw32-multilib32
# Create i686-w64-mingw32 root and symlink lib32 into it.
mkdir -p i686-w64-mingw32/lib && \
cd i686-w64-mingw32/lib && \
ln -s ../../x86_64-w64-mingw32/lib32/* .
++++++++++++++++++++++++++++
+ Installing the toolchain
++++++++++++++++++++++++++++
cd ~/mingw-build/mingw-w64-x86_64 && \
sudo checkinstall --pkgname=mingw-w64-gcc \
--pkgversion="1:$(bin/x86_64-w64-mingw32-gcc --version | head -1 | \
cut -f3 -d ' ')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --stripso=yes --addso=yes --fstrans=no --default cp -R * /usr && \
mv *.deb ~/
///////////////////////////////
/// LLVM/MinGW installation
///////////////////////////////
# Unfortunately, GCC doesn't yet support building for Windows on ARM,
# but LLVM does. The target has already been added to GCC's git,
# for inclusion in GCC 15 (in 2025).
# If the process fails with an error related to cc1plus
# being terminated, reduce the number of jobs by using
# the CMAKE_BUILD_PARALLEL_LEVEL environment variable.
cd ~/mingw-packages && \
mkdir llvm-mingw-build && \
git clone https://github.com/mstorsjo/llvm-mingw && \
cd llvm-mingw && \
./build-all.sh ../llvm-mingw-build
Packaging Preparation
=====================
# Copy NASM and pkg-config into the bin directory of the toolchain so that they
# can easily be found when a prefixed copy of these tools are needed.
cd ../llvm-mingw-build && \
cp /usr/bin/pkg-config bin/aarch64-w64-mingw32-pkg-config && \
# A few of these pieces require using CMake to build them. This is not as
# straight-forward as using autotools to cross-compile, and requires some setup:
cd aarch64-w64-mingw32 && \
wget https://fastapi.metacpan.org/source/TOKUHIROM/mRuby-0.06/vendor/mruby/cmake/Toolchain-Ubuntu-mingw32.cmake.sample -O toolchain-aarch64-w64-mingw32.cmake && \
sed -i -e 's/ ~\/crossdev\/w32//g' -e 's/i686/aarch64/g' -e 's/usr/usr\/llvm-mingw/g' toolchain-aarch64-w64-mingw32.cmake
# Setting up meson's cross-files:
cd ../ && \
mkdir -p share/meson/cross/ && \
wget "https://raw.githubusercontent.com/mesonbuild/meson/master/cross/linux-mingw-w64-64bit.txt" -O share/meson/cross/aarch64-w64-mingw32 && \
sed -i -e 's/usr\/bin\/x86_64/usr\/llvm-mingw\/bin\/aarch64/g' -e 's/x86_64/aarch64/g' \
-e 's/wine64//g' -e 's/wine//g' \
-e '13,16d' -e "s/\[properties\]/\[built-in options\]/" \
share/meson/cross/aarch64-w64-mingw32
sed -i -e "13ic_args = ['-I/usr/aarch64-w64-mingw32/include']\ncpp_args = ['-I/usr/aarch64-w64-mingw32/include']\nc_link_args = ['-L/usr/aarch64-w64-mingw32/lib']\ncpp_link_args = ['-L/usr/aarch64-w64-mingw32/lib']" \
share/meson/cross/aarch64-w64-mingw32
++++++++++++++++++++++++++++
+ Installing the toolchain
++++++++++++++++++++++++++++
cd ~/mingw-packages && \
sudo checkinstall --pkgname=llvm-mingw \
--pkgversion="1:$(llvm-mingw-build/bin/x86_64-w64-mingw32-clang --version | head -1 | \
cut -f3 -d ' ')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --stripso=yes --addso=yes --fstrans=no --default cp -R llvm-mingw-build /usr/llvm-mingw && \
mv *.deb ~/
+++++++++++++++++++++++++++++++++
+ Adding LLVM/MinGW to the PATH
+++++++++++++++++++++++++++++++++
# To try and avoid a collision between MinGW/GCC and LLVM/MinGW,
# LLVM/MinGW should be added to the *end* of the $PATH. Since it
# will be the only thing providing -mingw32 prefixes for clang and aarch64,
# and the only source of clang-cl, those will go through correctly,
# otherwise, the PATH ordering will prefer real GCC to the symlinks
# that LLVM/MinGW creates.
echo "export PATH=\$PATH:/usr/llvm-mingw/bin" >> ~/.bashrc
# In order to use checkinstall with llvm-mingw, you'll also need
# to add the PATH epxort to the root user's .bashrc.
echo "export PATH=\$PATH:/usr/llvm-mingw/bin" | sudo tee -a /root/.bashrc
# Close and re-open the Terminal. `source ~/.bashrc` might also work, but
# whether it also works for the root user, I don't know.
# There is an issue with attempting to use some of the aarch64-w64-mingw32
# tools when checkinstall gets involved, and errors out saying that the aarch64
# binaries can't be found, even though due to the two above commands,
# they are on the $PATH. This could be resolved by the user elevating
# to root with `sudo su` and then running checkinstall, but a slightly
# less cumbersome approach is to just simply symlink the tools into
# /usr/bin.
sudo ln -s /usr/llvm-mingw/bin/aarch64-w64-mingw32-ranlib /usr/bin/aarch64-w64-mingw32-ranlib && \
sudo mkdir -p /usr/share/meson/cross && \
sudo ln -s /usr/llvm-mingw/share/meson/cross/aarch64-w64-mingw32 /usr/share/meson/cross/aarch64-w64-mingw32
//////////////////////////////
/// Rust environment setup
//////////////////////////////
# Two pieces of software in this guide are written in Rust: libdovi and rav1e.
# For static GCC toolchains, libgcc.a needs to be symlinked
# to a duplicate libgcc_eh.a
sudo ln -s /usr/lib/gcc/x86_64-w64-mingw32/14.2.0/libgcc.a /usr/lib/gcc/x86_64-w64-mingw32/14.2.0/libgcc_eh.a && \
# Set up Rust:
sudo apt-get install libssl-dev rustc cargo && \
cargo install cargo-c && \
# Ensure Cargo is available on the $PATH:
echo "export PATH=\$PATH:~/.cargo/bin" >> ~/.bashrc && \
# Install the correct toolchains for cross-compilation
# Step One: Add the target
sudo apt-get install rustup && \
rustup target add x86_64-pc-windows-gnu && \
rustup target add i686-pc-windows-gnu && \
rustup target add aarch64-pc-windows-gnullvm && \
# Step Two: Download the toolchains themselves
rustup default stable-x86_64-pc-windows-gnu && \
rustup default stable-i686-pc-windows-gnu && \
# Not currently provided
#rustup default stable-aarch64-pc-windows-gnullvm && \
# Jump back to the main toolchain
rustup default stable
///////////////////
/// Final notes
///////////////////
# Many commands have, after running make, an 'rm <filename>.spec' command.
# These .spec files are intended for - from what I can tell - RPM distributions,
# maybe sometimes DEB, and they provide the package information to be used as
# metadata in the package. checkinstall has severe problems with this, as it
# will try to automatically use the .spec file rather than the user-provided
# metadata that gets passed to it normally. The end result is that - in the best
# case - the resulting package gets the wrong metadata attached to it (and has
# no -mingw identifying label). At worst, the metadata is extremely malformatted,
# and may even cause packaging errors.
# So if a set of instructions has one of these spec-removal commands, ALWAYS
# remember to run it.
# The '&& \' at the end of each instruction is to allow running the
# entire piece at once. This is for convenience, and should just work.
# If there are errors, run each instruction one at a time and adjust
# accordingly.
# Finally, we'll be keeping most of the source directories for the dependencies
# in a subdirectory so that it doesn't clog your $HOME with a bunch of stuff
# that only needs to be built occasionally. The *.deb files that checkinstall
# spits out will also be moved to their own directory for archival purposes.
mkdir -p ~/mpv-build-deps ~/mingw_debs/{i686,amd64,aarch64}
//////////////////////////
/// Basic dependencies
//////////////////////////
# These are dependencies that are best installed first, so that multiple other
# components can use them.
Dependency: zlib
================
# zlib-ng is an alternative, detailed below
cd ~/mpv-build-deps && \
wget http://zlib.net/zlib-1.3.1.tar.gz -O - | tar -xzvf - && \
mkdir -p zlib-1.3.1/zlib-build/{i686,amd64,aarch64} && \
amd64
+++++
cd ~/mpv-build-deps/zlib-1.3.1/zlib-build/amd64 && \
CFLAGS="-march=core2" \
CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar \
RANLIB=x86_64-w64-mingw32-ranlib \
../../configure --prefix=/usr/x86_64-w64-mingw32 --static && \
make -j$(nproc) && \
sudo checkinstall --pkgname=zlib-mingw-amd64 --pkgversion="$(grep Version zlib.pc | \
sed 's/Version: //g')-$(date --rfc-3339=date | sed 's/-//g')" --backup=no \
--deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/amd64
aarch64
+++++++
cd ~/mpv-build-deps/zlib-1.3.1/zlib-build/aarch64 && \
CC=aarch64-w64-mingw32-gcc AR=aarch64-w64-mingw32-ar \
RANLIB=aarch64-w64-mingw32-ranlib \
../../configure --prefix=/usr/aarch64-w64-mingw32 --static && \
make -j$(nproc) && \
sudo checkinstall --pkgname=zlib-mingw-aarch64 --pkgversion="$(grep Version zlib.pc | \
sed 's/Version: //g')-$(date --rfc-3339=date | sed 's/-//g')" --backup=no \
--deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/aarch64
i686
++++
cd ~/mpv-build-deps/zlib-1.3.1/zlib-build/i686 && \
CFLAGS="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar \
RANLIB=x86_64-w64-mingw32-ranlib \
../../configure --prefix=/usr/i686-w64-mingw32 --static && \
make -j$(nproc) && \
sudo checkinstall --pkgname=zlib-mingw-i686 --pkgversion="$(grep Version zlib.pc | \
sed 's/Version: //g')-$(date --rfc-3339=date | sed 's/-//g')" --backup=no \
--deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/i686
Dependency: zlib-ng
===================
# -DPKGCONFIG_INSTALL_DIR is necessary because otherwise it will
# install to root.
cd ~/mpv-build-deps && \
git clone https://github.com/zlib-ng/zlib-ng && \
mkdir -p zlib-ng/zlib-ng-build/{i686,amd64,aarch64} && \
amd64
+++++
cd ~/mpv-build-deps/zlib-ng/zlib-ng-build/amd64 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/x86_64-w64-mingw32/toolchain-x86_64-w64-mingw32.cmake" \
-DCMAKE_C_FLAGS="-march=core2" -DBUILD_SHARED_LIBS:bool=off -DZLIB_COMPAT:bool=on \
-DZLIB_ENABLE_TESTS:bool=off -DPKGCONFIG_INSTALL_DIR=/usr/x86_64-w64-mingw32/lib/pkgconfig && \
ninja && \
sudo checkinstall --pkgname=zlib-mingw-amd64 --pkgversion="$(git describe \
--tags)-$(date --rfc-3339=date | sed 's/-//g')-git" --backup=no \
--deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default \
ninja install && \
mv *.deb ~/mingw_debs/amd64
aarch64
+++++++
cd ~/mpv-build-deps/zlib-ng/zlib-ng-build/aarch64 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/aarch64-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/llvm-mingw/aarch64-w64-mingw32/toolchain-aarch64-w64-mingw32.cmake" \
-DBUILD_SHARED_LIBS:bool=off -DZLIB_COMPAT:bool=on -DZLIB_ENABLE_TESTS:bool=off \
-DCMAKE_SYSTEM_PROCESSOR=aarch64 -DPKGCONFIG_INSTALL_DIR=/usr/aarch64-w64-mingw32/lib/pkgconfig && \
ninja && \
sudo checkinstall --pkgname=zlib-mingw-aarch64 --pkgversion="$(git describe \
--tags)-$(date --rfc-3339=date | sed 's/-//g')-git" --backup=no \
--deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default \
ninja install && \
mv *.deb ~/mingw_debs/aarch64
i686
++++
cd ~/mpv-build-deps/zlib-ng/zlib-ng-build/i686 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/x86_64-w64-mingw32/toolchain-x86_64-w64-mingw32.cmake" \
-DCMAKE_C_FLAGS="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
-DBUILD_SHARED_LIBS:bool=off -DZLIB_COMPAT:bool=on -DZLIB_ENABLE_TESTS:bool=off \
-DWITH_SSE2:bool=off -DCMAKE_RC_FLAGS="--target=pe-i386" \
-DPKGCONFIG_INSTALL_DIR=/usr/i686-w64-mingw32/lib/pkgconfig && \
ninja && \
sudo checkinstall --pkgname=zlib-mingw-i686 --pkgversion="$(git describe \
--tags)-$(date --rfc-3339=date | sed 's/-//g')-git" --backup=no \
--deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default \
ninja install && \
mv *.deb ~/mingw_debs/i686
Dependency: bzip2
=================
# sed is necessary to correct MinGW libbz2_static.a -> libbz2.a
cd ~/mpv-build-deps && \
git clone https://gitlab.com/bzip2/bzip2.git && \
mkdir -p bzip2/bzip2-build/{i686,amd64,aarch64} && \
sed -i -e '339iif\(MSVC)\n\ set(STATICLIB_BASENAME bz2_static)\nelse()\n\ set(STATICLIB_BASENAME bz2)\nendif()\n' \
-e 's/ARCHIVE_OUTPUT_NAME bz2_static/ARCHIVE_OUTPUT_NAME ${STATICLIB_BASENAME}/' bzip2/CMakeLists.txt && \
amd64
+++++
cd ~/mpv-build-deps/bzip2/bzip2-build/amd64 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/x86_64-w64-mingw32/toolchain-x86_64-w64-mingw32.cmake" \
-DCMAKE_C_FLAGS="-march=core2" -DENABLE_SHARED_LIB:bool=off -DENABLE_STATIC_LIB:bool=on \
-DENABLE_TESTS:bool=off -DENABLE_DOCS:bool=off && \
ninja && \
sudo checkinstall --pkgname=bzip2-mingw-amd64 --pkgversion="$(grep Version \
bzip2.pc | sed 's/Version: //g')-$(date --rfc-3339=date | sed 's/-//g')" \
--backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes \
--fstrans=no --default ninja install && \
mv *.deb ~/mingw_debs/amd64
aarch64
+++++++
cd ~/mpv-build-deps/bzip2/bzip2-build/aarch64 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/aarch64-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/llvm-mingw/aarch64-w64-mingw32/toolchain-aarch64-w64-mingw32.cmake" \
-DENABLE_SHARED_LIB:bool=off -DENABLE_STATIC_LIB:bool=on -DENABLE_TESTS:bool=off \
-DENABLE_DOCS:bool=off && \
ninja && \
sudo checkinstall --pkgname=bzip2-mingw-aarch64 --pkgversion="$(grep Version \
bzip2.pc | sed 's/Version: //g')-$(date --rfc-3339=date | sed 's/-//g')" \
--backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes \
--fstrans=no --default ninja install && \
mv *.deb ~/mingw_debs/aarch64
i686
++++
cd ~/mpv-build-deps/bzip2/bzip2-build/i686 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/x86_64-w64-mingw32/toolchain-x86_64-w64-mingw32.cmake" \
-DCMAKE_C_FLAGS="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
-DENABLE_SHARED_LIB:bool=off -DENABLE_STATIC_LIB:bool=on -DENABLE_TESTS:bool=off \
-DENABLE_DOCS:bool=off && \
ninja && \
sudo checkinstall --pkgname=bzip2-mingw-i686 --pkgversion="$(grep Version \
bzip2.pc | sed 's/Version: //g')-$(date --rfc-3339=date | sed 's/-//g')" \
--backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes \
--fstrans=no --default ninja install && \
mv *.deb ~/mingw_debs/i686
Dependency: xz-tools
====================
cd ~/mpv-build-deps && \
wget http://tukaani.org/xz/xz-5.6.3.tar.gz -O - | tar -xzvf - && \
mkdir -p xz-5.6.3/xz-build/{i686,amd64,aarch64} && \
amd64
+++++
cd ~/mpv-build-deps/xz-5.6.3/xz-build/amd64 && \
CFLAGS="-march=core2" \
../../configure --prefix=/usr/x86_64-w64-mingw32 --disable-shared \
--disable-nls --enable-silent-rules --host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
sudo checkinstall --pkgname=xz-tools-mingw-amd64 --pkgversion="$(grep Version \
src/liblzma/liblzma.pc | sed 's/Version: //g')-$(date --rfc-3339=date | \
sed 's/-//g')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/amd64
aarch64
+++++++
cd ~/mpv-build-deps/xz-5.6.3/xz-build/aarch64 && \
../../configure --prefix=/usr/aarch64-w64-mingw32 --disable-shared \
--disable-nls --enable-silent-rules --host=aarch64-w64-mingw32 && \
make -j$(nproc) && \
sudo checkinstall --pkgname=xz-tools-mingw-aarch64 --pkgversion="$(grep Version \
src/liblzma/liblzma.pc | sed 's/Version: //g')-$(date --rfc-3339=date | \
sed 's/-//g')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/aarch64
i686
++++
cd ~/mpv-build-deps/xz-5.6.3/xz-build/i686 && \
CFLAGS+="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
LDFLAGS+="-m32" RC="x86_64-w64-mingw32-windres -F pe-i386" \
../../configure --prefix=/usr/i686-w64-mingw32 --disable-shared \
--disable-nls --enable-silent-rules --host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
sudo checkinstall --pkgname=xz-tools-mingw-i686 --pkgversion="$(grep Version \
src/liblzma/liblzma.pc | sed 's/Version: //g')-$(date --rfc-3339=date | \
sed 's/-//g')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/i686
Dependency: lzo2
================
# optional dependency of libsnappy
cd ~/mpv-build-deps && \
wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz -O - | tar -xzvf - && \
mkdir -p lzo-2.10/lzo-build/{i686,amd64,aarch64} && \
amd64
+++++
cd ~/mpv-build-deps/lzo-2.10/lzo-build/amd64 && \
CPPFLAGS="-march=core2" \
../../configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
sudo checkinstall --pkgname=lzo-mingw-amd64 --pkgversion="$(grep \
PACKAGE_VERSION config.h | cut -f2 -d "\"")-$(date --rfc-3339=date | \
sed 's/-//g')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/amd64
aarch64
+++++++
cd ~/mpv-build-deps/lzo-2.10/lzo-build/aarch64 && \
../../configure --prefix=/usr/aarch64-w64-mingw32 --host=aarch64-w64-mingw32 && \
make -j$(nproc) && \
sudo checkinstall --pkgname=lzo-mingw-aarch64 --pkgversion="$(grep \
PACKAGE_VERSION config.h | cut -f2 -d "\"")-$(date --rfc-3339=date | \
sed 's/-//g')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/aarch64
i686
++++
cd ~/mpv-build-deps/lzo-2.10/lzo-build/i686 && \
CPPFLAGS="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
LDFLAGS="-m32 -L/usr/i686-w64-mingw32/lib" \
../../configure --prefix=/usr/i686-w64-mingw32 --host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
sudo checkinstall --pkgname=lzo-mingw-i686 --pkgversion="$(grep \
PACKAGE_VERSION config.h | cut -f2 -d "\"")-$(date --rfc-3339=date | \
sed 's/-//g')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/i686
Dependency: liblzf
==================
# optional dependency of libsnappy
# copying lzf.h to the build dirs is necessary for out-of-tree
# adding stdint.h and switching to uint64_t is necessary for 64-bit,
# doesn't harm 32-bit build.
cd ~/mpv-build-deps && \
wget http://dist.schmorp.de/liblzf/liblzf-3.6.tar.gz -O - | tar -xzvf - && \
cd liblzf-3.6 && \
sed -i -e '12iEXEEXT = @EXEEXT@' -e 's/m 755 lzf/m 755 lzf$(EXEEXT)/g' Makefile.in && \
sed -i -e '38i#include <stdint.h>' -e 's/unsigned _int64/uint64_t/g' lzf_c.c && \
mkdir -p liblzf-build/{i686,amd64,aarch64} && \
cp lzf.h liblzf-build/i686 && \
cp lzf.h liblzf-build/amd64 && \
cp lzf.h liblzf-build/aarch64 && \
amd64
+++++
cd ~/mpv-build-deps/liblzf-3.6/liblzf-build/amd64 && \
CPPFLAGS="-march=core2" ../../configure --prefix=/usr/x86_64-w64-mingw32 \
--host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
sudo checkinstall --pkgname=liblzf-mingw-amd64 --pkgversion="$(grep \
"VERSION = " Makefile | awk '{print $NF}')-$(date --rfc-3339=date | \
sed 's/-//g')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/amd64
aarch64
+++++++
# Installing to a temporary directory is necessary to avoid errors when
# using checkinstall.
cd ~/mpv-build-deps/liblzf-3.6/liblzf-build/aarch64 && \
../../configure --prefix=$HOME/mpv-build-deps/lzf_tempinstall --host=aarch64-w64-mingw32 && \
make -j$(nproc) && \
make install && \
cd ~/mpv-build-deps/lzf_tempinstall && \
sudo checkinstall --pkgname=liblzf-mingw-aarch64 --pkgversion="$(grep \
"VERSION = " ../liblzf-3.6/liblzf-build/aarch64/Makefile | awk '{print $NF}')-$(date \
--rfc-3339=date | sed 's/-//g')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default cp -R * /usr/aarch64-w64-mingw32 && \
mv *.deb ~/mingw_debs/aarch64
i686
++++
cd ~/mpv-build-deps/liblzf-3.6/liblzf-build/i686 && \
CPPFLAGS="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
LDFLAGS="-m32 -L/usr/i686-w64-mingw32/lib" \
../../configure --prefix=/usr/i686-w64-mingw32 --host=x86_64-w64-mingw32 && \
make -j$(nproc) && \
sudo checkinstall --pkgname=liblzf-mingw-i686 --pkgversion="$(grep \
"VERSION = " Makefile | awk '{print $NF}')-$(date --rfc-3339=date | \
sed 's/-//g')" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default && \
mv *.deb ~/mingw_debs/i686
Dependency: libsnappy
=====================
# libsnappy is required by the Hap encoder
cd ~/mpv-build-deps && \
git clone https://github.com/google/snappy && \
mkdir -p snappy/snappy-build/{i686,amd64,aarch64} && \
amd64
+++++
cd ~/mpv-build-deps/snappy/snappy-build/amd64 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/x86_64-w64-mingw32/toolchain-x86_64-w64-mingw32.cmake" \
-DCMAKE_C_FLAGS="-march=core2" -DCMAKE_CXX_FLAGS="-march=core2" \
-DSNAPPY_BUILD_TESTS:bool=off -DSNAPPY_BUILD_BENCHMARKS:bool=off && \
ninja && \
sudo checkinstall --pkgname=snappy-mingw-amd64 --pkgversion="$(grep \
PACKAGE_VERSION cmake/SnappyConfigVersion.cmake | grep "set(" | head -1 | \
cut -f2 -d "\"")-$(date --rfc-3339=date | sed 's/-//g')-git" --backup=no \
--deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default \
ninja install && \
mv *.deb ~/mingw_debs/amd64
aarch64
+++++++
cd ~/mpv-build-deps/snappy/snappy-build/aarch64 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/aarch64-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/llvm-mingw/aarch64-w64-mingw32/toolchain-aarch64-w64-mingw32.cmake" \
-DCMAKE_SYSTEM_PROCESSOR=aarch64 -DSNAPPY_BUILD_TESTS:bool=off -DSNAPPY_BUILD_BENCHMARKS:bool=off && \
ninja && \
sudo checkinstall --pkgname=snappy-mingw-aarch64 --pkgversion="$(grep \
PACKAGE_VERSION cmake/SnappyConfigVersion.cmake | grep "set(" | head -1 | \
cut -f2 -d "\"")-$(date --rfc-3339=date | sed 's/-//g')-git" --backup=no \
--deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default \
ninja install && \
mv *.deb ~/mingw_debs/aarch64
i686
++++
cd ~/mpv-build-deps/snappy/snappy-build/i686 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/x86_64-w64-mingw32/toolchain-x86_64-w64-mingw32.cmake" \
-DCMAKE_C_FLAGS="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
-DCMAKE_CXX_FLAGS="-m32 -mfpmath=sse -march=pentium3 -msse -mtune=pentium3" \
-DCMAKE_EXE_LINKER_FLAGS="-m32 -L/usr/i686-w64-mingw32/lib" \
-DCMAKE_SYSROOT=/usr/i686-w64-mingw32 -DSNAPPY_BUILD_TESTS:bool=off \
-DSNAPPY_BUILD_BENCHMARKS:bool=off && \
ninja && \
sudo checkinstall --pkgname=snappy-mingw-i686 --pkgversion="$(grep \
PACKAGE_VERSION cmake/SnappyConfigVersion.cmake | grep "set(" | head -1 | \
cut -f2 -d "\"")-$(date --rfc-3339=date | sed 's/-//g')-git" --backup=no \
--deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default \
ninja install && \
mv *.deb ~/mingw_debs/i686
Dependency: deflate
===================
cd ~/mpv-build-deps && \
git clone https://github.com/ebiggers/libdeflate && \
mkdir -p libdeflate/libdeflate-build/{i686,amd64,aarch64} && \
amd64
+++++
cd ~/mpv-build-deps/libdeflate/libdeflate-build/amd64 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/x86_64-w64-mingw32/toolchain-x86_64-w64-mingw32.cmake" \
-DCMAKE_C_FLAGS="-march=core2" -DLIBDEFLATE_BUILD_SHARED_LIB:bool=off && \
ninja && \
sudo checkinstall --pkgname=libdeflate-mingw-amd64 --pkgversion="$(grep -r \
Version libdeflate.pc | cut -f2 -d " ")-$(date --rfc-3339=date | \
sed 's/-//g')-git" --backup=no --deldoc=yes --delspec=yes --deldesc=yes \
--strip=yes --fstrans=no --default ninja install && \
mv *.deb ~/mingw_debs/amd64
aarch64
+++++++
cd ~/mpv-build-deps/libdeflate/libdeflate-build/aarch64 && \
cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/aarch64-w64-mingw32 \
-DCMAKE_TOOLCHAIN_FILE="/usr/llvm-mingw/aarch64-w64-mingw32/toolchain-aarch64-w64-mingw32.cmake" \
-DLIBDEFLATE_BUILD_SHARED_LIB:bool=off && \
ninja && \