forked from m-ab-s/media-autobuild_suite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
media-suite_compile.sh
3085 lines (2829 loc) · 130 KB
/
media-suite_compile.sh
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
#!/bin/bash
# shellcheck disable=SC2034,SC1090,SC1117,SC1091,SC2119
shopt -s extglob
if [[ -z $LOCALBUILDDIR ]]; then
printf '%s\n' \
"Something went wrong." \
"MSYSTEM: $MSYSTEM" \
"pwd: $(cygpath -w "$(pwd)")" \
"fstab: " \
"$(cat /etc/fstab)" \
"Create a new issue and upload all logs you can find, especially compile.log"
read -r -p "Enter to continue" ret
exit 1
fi
FFMPEG_BASE_OPTS=("--pkg-config=pkgconf" --pkg-config-flags="--keep-system-libs --keep-system-cflags --static" "--cc=$CC" "--cxx=$CXX" "--ld=$CXX" "--extra-cxxflags=-fpermissive" "--extra-cflags=-Wno-int-conversion")
printf '\nBuild start: %(%F %T %z)T\n' -1 >> "$LOCALBUILDDIR/newchangelog"
printf '#!/bin/bash\nbash %s %s\n' "$LOCALBUILDDIR/media-suite_compile.sh" "$*" > "$LOCALBUILDDIR/last_run"
while true; do
case $1 in
--cpuCount=* ) cpuCount=${1#*=} && shift ;;
--build32=* ) build32=${1#*=} && shift ;;
--build64=* ) build64=${1#*=} && shift ;;
--mp4box=* ) mp4box=${1#*=} && shift ;;
--rtmpdump=* ) rtmpdump=${1#*=} && shift ;;
--vpx=* ) vpx=${1#*=} && shift ;;
--x264=* ) x264=${1#*=} && shift ;;
--x265=* ) x265=${1#*=} && shift ;;
--other265=* ) other265=${1#*=} && shift ;;
--flac=* ) flac=${1#*=} && shift ;;
--fdkaac=* ) fdkaac=${1#*=} && shift ;;
--mediainfo=* ) mediainfo=${1#*=} && shift ;;
--sox=* ) sox=${1#*=} && shift ;;
--ffmpeg=* ) ffmpeg=${1#*=} && shift ;;
--ffmpegUpdate=* ) ffmpegUpdate=${1#*=} && shift ;;
--ffmpegPath=* ) ffmpegPath="${1#*=}"; shift ;;
--ffmpegChoice=* ) ffmpegChoice=${1#*=} && shift ;;
--mplayer=* ) mplayer=${1#*=} && shift ;;
--mpv=* ) mpv=${1#*=} && shift ;;
--deleteSource=* ) deleteSource=${1#*=} && shift ;;
--license=* ) license=${1#*=} && shift ;;
--standalone=* ) standalone=${1#*=} && shift ;;
--stripping* ) stripping=${1#*=} && shift ;;
--packing* ) packing=${1#*=} && shift ;;
--logging=* ) logging=${1#*=} && shift ;;
--bmx=* ) bmx=${1#*=} && shift ;;
--aom=* ) aom=${1#*=} && shift ;;
--faac=* ) faac=${1#*=} && shift ;;
--exhale=* ) exhale=${1#*=} && shift ;;
--ffmbc=* ) ffmbc=${1#*=} && shift ;;
--curl=* ) curl=${1#*=} && shift ;;
--cyanrip=* ) cyanrip=${1#*=} && shift ;;
--ripgrep=* ) ripgrep=${1#*=} && shift ;;
--rav1e=* ) rav1e=${1#*=} && shift ;;
--dav1d=* ) dav1d=${1#*=} && shift ;;
--libavif=* ) libavif=${1#*=} && shift ;;
--jpegxl=* ) jpegxl=${1#*=} && shift ;;
--vvc=* ) vvc=${1#*=} && shift ;;
--uvg266=* ) uvg266=${1#*=} && shift ;;
--vvenc=* ) vvenc=${1#*=} && shift ;;
--vvdec=* ) vvdec=${1#*=} && shift ;;
--jq=* ) jq=${1#*=} && shift ;;
--jo=* ) jo=${1#*=} && shift ;;
--dssim=* ) dssim=${1#*=} && shift ;;
--avs2=* ) avs2=${1#*=} && shift ;;
--dovitool=* ) dovitool=${1#*=} && shift ;;
--hdr10plustool=* ) hdr10plustool=${1#*=} && shift ;;
--timeStamp=* ) timeStamp=${1#*=} && shift ;;
--noMintty=* ) noMintty=${1#*=} && shift ;;
--ccache=* ) ccache=${1#*=} && shift ;;
--svthevc=* ) svthevc=${1#*=} && shift ;;
--svtav1=* ) svtav1=${1#*=} && shift ;;
--svtvp9=* ) svtvp9=${1#*=} && shift ;;
--xvc=* ) xvc=${1#*=} && shift ;;
--vlc=* ) vlc=${1#*=} && shift ;;
--exitearly=* ) exitearly=${1#*=} && shift ;;
# --autouploadlogs=* ) autouploadlogs=${1#*=} && shift ;;
-- ) shift && break ;;
-* ) echo "Error, unknown option: '$1'." && exit 1 ;;
* ) break ;;
esac
done
[[ $ccache != y ]] && export CCACHE_DISABLE=1
# shellcheck source=media-suite_deps.sh
source "$LOCALBUILDDIR"/media-suite_deps.sh
# shellcheck source=media-suite_helper.sh
source "$LOCALBUILDDIR"/media-suite_helper.sh
if [[ $exitearly = EE1 ]]; then
do_simple_print -p '\n\t'"${orange}Exit due to env var MABS_EXIT_EARLY set to EE1"
exit 0
fi
do_simple_print -p "${orange}Warning: We will not accept any issues lacking any form of logs or logs.zip!$reset"
buildProcess() {
set_title
do_simple_print -p '\n\t'"${orange}Starting $bits compilation of all tools$reset"
[[ -f $HOME/custom_build_options ]] &&
echo "Imported custom build options (unsupported)" &&
source "$HOME"/custom_build_options
cd_safe "$LOCALBUILDDIR"
do_getFFmpegConfig "$license"
do_getMpvConfig
# in case the root was moved, this fixes windows abspaths
mkdir -p "$LOCALDESTDIR/lib/pkgconfig"
# pkgconfig keys to find the wrong abspaths from
local _keys="(prefix|exec_prefix|libdir|includedir)"
# current abspath root
local _root
_root=$(cygpath -m "$LOCALDESTDIR")
# find .pc files with Windows abspaths
grep -ElZR "${_keys}=[^/$].*" "$LOCALDESTDIR"/lib/pkgconfig | \
# find those with a different abspath than the current
xargs -0r grep -LZ "$_root" | \
# replace with current abspath
xargs -0r sed -ri "s;${_keys}=.*$LOCALDESTDIR;\1=$_root;g"
unset _keys _root
_clean_old_builds=(j{config,error,morecfg,peglib}.h
lib{jpeg,nettle,gnurx,regex}.{,l}a
lib{opencore-amr{nb,wb},twolame,theora{,enc,dec},caca,magic,uchardet}.{l,}a
libSDL{,main}.{l,}a libopen{jpwl,mj2,jp2}.{a,pc}
include/{nettle,opencore-amr{nb,wb},theora,cdio,SDL,openjpeg-2.{1,2},luajit-2.0,uchardet,wels}
regex.h magic.h
{nettle,vo-aacenc,sdl,uchardet}.pc
{opencore-amr{nb,wb},twolame,theora{,enc,dec},caca,dcadec,libEGL,openh264}.pc
libcdio_{cdda,paranoia}.{{l,}a,pc}
twolame.h bin-audio/{twolame,cd-paranoia}.exe
bin-global/{{file,uchardet}.exe,sdl-config,luajit-2.0.4.exe}
libebur128.a ebur128.h
libopenh264.a
liburiparser.{{,l}a,pc}
libchromaprint.{a,pc} chromaprint.h
bin-global/libgcrypt-config libgcrypt.a gcrypt.h
lib/libgcrypt.def bin-global/{dumpsexp,hmac256,mpicalc}.exe
crossc.{h,pc} libcrossc.a
include/onig{uruma,gnu,posix}.h libonig.a oniguruma.pc
)
do_uninstall q all "${_clean_old_builds[@]}"
unset _clean_old_builds
# In case a build was interrupted before reversing hide_conflicting_libs
[[ -d $LOCALDESTDIR/opt/cyanffmpeg ]] &&
hide_conflicting_libs -R "$LOCALDESTDIR/opt/cyanffmpeg"
hide_conflicting_libs -R
do_hide_all_sharedlibs
create_ab_pkgconfig
create_cmake_toolchain
create_ab_ccache
pacman -S --noconfirm "$MINGW_PACKAGE_PREFIX-cmake" > /dev/null 2>&1
# Global header fixups
grep_and_sed '__declspec(__dllimport__)' "$MINGW_PREFIX"/include/gmp.h \
's|__declspec\(__dllimport__\)||g' "$MINGW_PREFIX"/include/gmp.h
$CC -E -P -include pthread.h - < /dev/null | grep -q MemoryBarrier ||
grep_and_sed MemoryBarrier "$MINGW_PREFIX/include/pthread.h" 's/MemoryBarrier/__sync_synchronize/g'
set_title "compiling global tools"
do_simple_print -p '\n\t'"${orange}Starting $bits compilation of global tools${reset}"
if [[ $packing = y &&
! "$(/opt/bin/upx -V 2> /dev/null | head -1)" = "upx 4.2.2" ]] &&
do_wget -h 141e7cd8d009b827590662b482f1ae2f1dda17cf446a5651078235efb1429c59 \
"https://github.com/upx/upx/releases/download/v4.2.2/upx-4.2.2-win32.zip"; then
do_install upx.exe /opt/bin/upx.exe
fi
if [[ "$ripgrep|$rav1e|$dssim|$libavif|$dovitool|$hdr10plustool" = *y* ]] || enabled librav1e; then
do_pacman_install rust
fi
_check=(bin-global/rg.exe)
if [[ $ripgrep = y ]] &&
do_vcs "https://github.com/BurntSushi/ripgrep.git"; then
do_uninstall "${_check[@]}"
do_rust
do_install "target/$CARCH-pc-windows-gnu/release/rg.exe" bin-global/
do_checkIfExist
fi
_check=(bin-global/jo.exe)
if [[ $jo = y ]] &&
do_vcs "https://github.com/jpmens/jo.git"; then
do_mesoninstall global
do_checkIfExist
fi
_deps=("$MINGW_PREFIX"/lib/pkgconfig/oniguruma.pc)
_check=(bin-global/jq.exe)
if [[ $jq = y ]] &&
do_vcs "https://github.com/jqlang/jq.git"; then
do_pacman_install oniguruma
do_uninstall "${_check[@]}"
do_autoreconf
CFLAGS+=' -D_POSIX_C_SOURCE' YFLAGS='--warnings=no-yacc' \
do_separate_conf global --enable-{all-static,pthread-tls,maintainer-mode} --disable-docs
do_make && do_install jq.exe bin-global/
do_checkIfExist
fi
_check=(bin-global/dssim.exe)
if [[ $dssim = y ]] &&
do_vcs "https://github.com/kornelski/dssim.git"; then
do_uninstall "${_check[@]}"
CFLAGS+=" -fno-PIC" do_rust
do_install "target/$CARCH-pc-windows-gnu/release/dssim.exe" bin-global/
do_checkIfExist
fi
_check=(libxml2.a libxml2/libxml/xmlIO.h libxml-2.0.pc)
if { enabled_any libxml2 libbluray || [[ $cyanrip = y ]] || ! mpv_disabled libbluray; } &&
do_vcs "$SOURCE_REPO_LIBXML2"; then
do_uninstall include/libxml2/libxml "${_check[@]}"
extracommands=("-DLIBXML2_WITH_PYTHON=OFF" "-DLIBXML2_WITH_TESTS=OFF")
[[ $standalone = y ]] || extracommands+=("-DLIBXML2_WITH_PROGRAMS=OFF")
do_cmakeinstall "${extracommands[@]}"
do_checkIfExist
fi
# Fixes an issue with ordering with libbluray libxml2 and libz and liblzma
# Probably caused by https://gitlab.gnome.org/GNOME/libxml2/-/commit/93e8bb2a402012858500b608b4146cd5c756e34d
grep_or_sed Requires.private "$LOCALDESTDIR/lib/pkgconfig/libxml-2.0.pc" 's/Requires:/Requires.private:/'
if [[ $ffmpeg != no ]] && enabled libaribb24; then
_check=(libpng.{pc,{,l}a} libpng16.{pc,{,l}a} libpng16/png.h)
if do_vcs "$SOURCE_REPO_LIBPNG"; then
do_uninstall include/libpng16 "${_check[@]}"
do_autoupdate
do_separate_confmakeinstall --with-pic
do_checkIfExist
fi
_deps=(libpng.{pc,a} libpng16.{pc,a})
_check=(aribb24.pc libaribb24.{,l}a)
if do_vcs "$SOURCE_REPO_ARRIB24"; then
do_patch "https://raw.githubusercontent.com/BtbN/FFmpeg-Builds/master/patches/aribb24/12.patch"
do_patch "https://raw.githubusercontent.com/BtbN/FFmpeg-Builds/master/patches/aribb24/13.patch"
do_patch "https://raw.githubusercontent.com/BtbN/FFmpeg-Builds/master/patches/aribb24/17.patch"
do_uninstall include/aribb24 "${_check[@]}"
do_autoreconf
do_separate_confmakeinstall --with-pic
do_checkIfExist
fi
fi
if [[ $mplayer = y || $mpv = y ]] ||
{ [[ $ffmpeg != no ]] && enabled_any libass libfreetype {lib,}fontconfig libfribidi; }; then
do_pacman_remove freetype fontconfig harfbuzz fribidi
_check=(libfreetype.a freetype2.pc)
[[ $ffmpeg = sharedlibs ]] && _check+=(bin-video/libfreetype-6.dll libfreetype.dll.a)
if do_vcs "$SOURCE_REPO_FREETYPE"; then
do_uninstall include/freetype2 bin-global/freetype-config \
bin{,-video}/libfreetype-6.dll libfreetype.dll.a "${_check[@]}"
extracommands=(-D{harfbuzz,png,bzip2,brotli,zlib,tests}"=disabled")
[[ $ffmpeg = sharedlibs ]] && extracommands+=(--default-library=both)
do_mesoninstall global "${extracommands[@]}"
[[ $ffmpeg = sharedlibs ]] && do_install "$LOCALDESTDIR"/bin/libfreetype-6.dll bin-video/
do_checkIfExist
fi
_deps=(libfreetype.a)
_check=(libfontconfig.a fontconfig.pc)
[[ $ffmpeg = sharedlibs ]] && enabled_any {lib,}fontconfig &&
do_removeOption "--enable-(lib|)fontconfig"
if enabled_any {lib,}fontconfig &&
do_vcs "$SOURCE_REPO_FONTCONFIG"; then
do_uninstall include/fontconfig "${_check[@]}"
do_pacman_install gperf
extracommands=()
[[ $standalone = y ]] || extracommands+=(-Dtools=disabled)
do_mesoninstall global -Ddoc=disabled -Dtests=disabled "${extracommands[@]}"
do_checkIfExist
fi
_deps=(libfreetype.a)
_check=(libharfbuzz.a harfbuzz.pc)
[[ $ffmpeg = sharedlibs ]] && _check+=(libharfbuzz.dll.a bin-video/libharfbuzz-{subset-,}0.dll)
if do_vcs "$SOURCE_REPO_HARFBUZZ"; then
do_pacman_install ragel
do_uninstall include/harfbuzz "${_check[@]}" libharfbuzz{-subset,}.la
extracommands=(-D{glib,gobject,cairo,icu,tests,introspection,docs,benchmark}"=disabled")
[[ $ffmpeg = sharedlibs ]] && extracommands+=(--default-library=both)
do_mesoninstall global "${extracommands[@]}"
# directwrite shaper doesn't work with mingw headers, maybe too old
[[ $ffmpeg = sharedlibs ]] && do_install "$LOCALDESTDIR"/bin-global/libharfbuzz-{subset-,}0.dll bin-video/
do_checkIfExist
fi
_check=(libfribidi.a fribidi.pc)
[[ $standalone = y ]] && _check+=(bin-video/fribidi.exe)
[[ $ffmpeg = sharedlibs ]] && _check+=(bin-video/libfribidi-0.dll libfribidi.dll.a)
if do_vcs "$SOURCE_REPO_FRIBIDI"; then
extracommands=("-Ddocs=false" "-Dtests=false")
[[ $standalone = n ]] && extracommands+=("-Dbin=false")
[[ $ffmpeg = sharedlibs ]] && extracommands+=(--default-library=both)
do_mesoninstall video "${extracommands[@]}"
do_checkIfExist
fi
_check=(ass/ass{,_types}.h libass.{{,l}a,pc})
_deps=(lib{freetype,fontconfig,harfbuzz,fribidi}.a)
[[ $ffmpeg = sharedlibs ]] && _check+=(bin-video/libass-9.dll libass.dll.a)
if do_vcs "$SOURCE_REPO_LIBASS"; then
do_autoreconf
do_uninstall bin{,-video}/libass-9.dll libass.dll.a include/ass "${_check[@]}"
extracommands=()
enabled_any {lib,}fontconfig || extracommands+=(--disable-fontconfig)
[[ $ffmpeg = sharedlibs ]] && extracommands+=(--disable-fontconfig --enable-shared)
do_separate_confmakeinstall video "${extracommands[@]}"
do_checkIfExist
fi
if [[ $ffmpeg != sharedlibs && $ffmpeg != shared ]]; then
_libs=(lib{freetype,harfbuzz{-subset,},fribidi,ass}.dll.a
libav{codec,device,filter,format,util,resample}.dll.a
lib{sw{scale,resample},postproc}.dll.a)
for _lib in "${_libs[@]}"; do
rm -f "$LOCALDESTDIR/lib/$_lib"
done
unset _lib _libs
fi
fi
[[ $ffmpeg != no ]] && enabled gcrypt && do_pacman_install libgcrypt
if [[ $curl = y ]]; then
enabled libtls && curl=libressl
enabled openssl && curl=openssl
enabled gnutls && curl=gnutls
enabled mbedtls && curl=mbedtls
[[ $curl = y ]] && curl=schannel
fi
if enabled_any gnutls librtmp || [[ $rtmpdump = y || $curl = gnutls ]]; then
do_pacman_install nettle
_check=(libgnutls.{,l}a gnutls.pc)
_gnutls_ver=3.8.5
_gnutls_hash=66269a2cfe0e1c2dabec87bdbbd8ab656f396edd9a40dd006978e003cfa52bfc
if do_pkgConfig "gnutls = $_gnutls_ver" && do_wget -h $_gnutls_hash \
"https://www.gnupg.org/ftp/gcrypt/gnutls/v${_gnutls_ver%.*}/gnutls-${_gnutls_ver}.tar.xz"; then
do_uninstall include/gnutls "${_check[@]}"
grep_or_sed crypt32 lib/gnutls.pc.in 's/Libs.private.*/& -lcrypt32/'
CFLAGS="-Wno-int-conversion" \
do_separate_confmakeinstall \
--disable-{cxx,doc,tools,tests,nls,rpath,libdane,guile,gcc-warnings} \
--without-{p11-kit,idn,tpm} --enable-local-libopts \
--with-included-unistring --disable-code-coverage \
LDFLAGS="$LDFLAGS -L${LOCALDESTDIR}/lib -L${MINGW_PREFIX}/lib"
do_checkIfExist
fi
fi
if [[ $curl = openssl ]] || { [[ $ffmpeg != no ]] && enabled openssl; }; then
do_pacman_install openssl
fi
hide_libressl -R
if [[ $curl = libressl ]] || { [[ $ffmpeg != no ]] && enabled libtls; }; then
_check=(tls.h lib{crypto,ssl,tls}.{pc,{,l}a} openssl.pc)
[[ $standalone = y ]] && _check+=(bin-global/openssl.exe)
if do_vcs "$SOURCE_REPO_LIBRESSL" libressl; then
do_uninstall etc/ssl include/openssl "${_check[@]}"
_sed="man"
[[ $standalone = y ]] || _sed="apps tests $_sed"
sed -ri "s;(^SUBDIRS .*) $_sed;\1;" Makefile.am
do_autogen
do_separate_confmakeinstall global
do_checkIfExist
unset _sed
fi
fi
{ enabled mbedtls || [[ $curl = mbedtls ]]; } && do_pacman_install mbedtls
if [[ $mediainfo = y || $bmx = y || $curl != n ]]; then
do_pacman_install libunistring
grep_and_sed dllimport "$MINGW_PREFIX"/include/unistring/woe32dll.h \
's|__declspec \(dllimport\)||g' "$MINGW_PREFIX"/include/unistring/woe32dll.h
_deps=("$MINGW_PREFIX/lib/libunistring.a")
_check=(libidn2.{{,l}a,pc} idn2.h)
[[ $standalone == y ]] && _check+=(bin-global/idn2.exe)
if do_pkgConfig "libidn2 = 2.3.0" &&
do_wget -h e1cb1db3d2e249a6a3eb6f0946777c2e892d5c5dc7bd91c74394fc3a01cab8b5 \
"https://ftp.gnu.org/gnu/libidn/libidn2-2.3.0.tar.gz"; then
do_uninstall "${_check[@]}"
[[ $standalone == y ]] || sed -ri 's|(bin_PROGRAMS = ).*|\1|g' src/Makefile.am
# unistring also depends on iconv
grep_or_sed '@LTLIBUNISTRING@ @LTLIBICONV@' libidn2.pc.in \
's|(@LTLIBICONV@) (@LTLIBUNISTRING@)|\2 \1|'
do_autoreconf
do_separate_confmakeinstall global --disable-{doc,rpath,nls}
do_checkIfExist
fi
_deps=(libidn2.a)
_check=(libpsl.{{,l}a,h,pc})
[[ $standalone == y ]] && _check+=(bin-global/psl.exe)
if do_pkgConfig "libpsl = 0.21.0" &&
do_wget -h 41bd1c75a375b85c337b59783f5deb93dbb443fb0a52d257f403df7bd653ee12 \
"https://github.com/rockdaboot/libpsl/releases/download/libpsl-0.21.0/libpsl-0.21.0.tar.gz"; then
do_uninstall "${_check[@]}"
[[ $standalone == y ]] || sed -ri 's|(bin_PROGRAMS = ).*|\1|g' tools/Makefile.in
grep_or_sed "Requires.private" libpsl.pc.in "/Libs:/ i\Requires.private: libidn2"
CFLAGS+=" -DPSL_STATIC" do_separate_confmakeinstall global --disable-{nls,rpath,gtk-doc-html,man,runtime}
do_checkIfExist
fi
fi
if [[ $mediainfo = y || $bmx = y || $curl != n || $cyanrip = y ]]; then
do_pacman_install brotli nghttp2
_check=(curl/curl.h libcurl.{{,l}a,pc})
case $curl in
libressl) _deps=(libssl.a) ;;
openssl) _deps=("$MINGW_PREFIX/lib/libssl.a") ;;
gnutls) _deps=(libgnutls.a) ;;
mbedtls) _deps=("$MINGW_PREFIX/lib/libmbedtls.a") ;;
*) _deps=() ;;
esac
[[ $standalone = y || $curl != n ]] && _check+=(bin-global/curl.exe)
if do_vcs "$SOURCE_REPO_CURL"; then
do_uninstall include/curl bin-global/curl-config "${_check[@]}"
[[ $standalone = y || $curl != n ]] ||
sed -ri "s;(^SUBDIRS = lib) src (include) scripts;\1 \2;" Makefile.in
extra_opts=()
case $curl in
libressl|openssl)
extra_opts+=(--with-{nghttp2,openssl} --without-{gnutls,mbedtls})
;;
mbedtls) extra_opts+=(--with-{mbedtls,nghttp2} --without-openssl) ;;
gnutls) extra_opts+=(--with-gnutls --without-{nghttp2,mbedtls,openssl}) ;;
*) extra_opts+=(--with-{schannel,winidn,nghttp2} --without-{gnutls,mbedtls,openssl});;
esac
[[ ! -f configure || configure.ac -nt configure ]] &&
do_autoreconf
[[ $curl = openssl ]] && hide_libressl
hide_conflicting_libs
CPPFLAGS+=" -DGNUTLS_INTERNAL_BUILD -DNGHTTP2_STATICLIB -DPSL_STATIC" \
do_separate_confmakeinstall global "${extra_opts[@]}" \
--without-{libssh2,random,ca-bundle,ca-path,librtmp} \
--with-brotli --enable-sspi --disable-debug
hide_conflicting_libs -R
[[ $curl = openssl ]] && hide_libressl -R
if [[ $curl != schannel ]]; then
_notrequired=true
cd_safe "build-$bits"
PATH=/usr/bin log ca-bundle make ca-bundle
unset _notrequired
[[ -f lib/ca-bundle.crt ]] &&
cp -f lib/ca-bundle.crt "$LOCALDESTDIR"/bin-global/curl-ca-bundle.crt
cd_safe ..
fi
do_checkIfExist
fi
fi
if [[ $exitearly = EE2 ]]; then
do_simple_print -p '\n\t'"${orange}Exit due to env var MABS_EXIT_EARLY set to EE2"
return
fi
if { { [[ $ffmpeg != no || $standalone = y ]] && enabled libtesseract; } ||
{ [[ $standalone = y ]] && enabled libwebp; }; }; then
_check=(libglut.a glut.pc)
if do_vcs "$SOURCE_REPO_LIBGLUT" freeglut; then
do_uninstall lib/cmake/FreeGLUT include/GL "${_check[@]}"
do_cmakeinstall -D{UNIX,FREEGLUT_BUILD_DEMOS,FREEGLUT_BUILD_SHARED_LIBS}=OFF -DFREEGLUT_REPLACE_GLUT=ON
do_checkIfExist
fi
do_pacman_install libjpeg-turbo xz zlib zstd libdeflate
_deps=(libglut.a)
_check=(libtiff{.a,-4.pc})
[[ $standalone = y ]] && _check+=(bin-global/tiff{cp,dump,info,set,split}.exe)
if do_vcs "$SOURCE_REPO_LIBTIFF"; then
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/libtiff/0001-tiffgt-Link-winmm-if-windows.patch" am
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/libtiff/0002-tiffgt-link-gl-after-glut.patch" am
do_uninstall lib/cmake/tiff "${_check[@]}"
extracommands=("-Dtiff-tests=OFF" "-Dtiff-docs=OFF")
if [[ $standalone = y ]]; then
extracommands+=("-Dtiff-tools=ON")
else
extracommands+=("-Dtiff-tools=OFF")
fi
grep_or_sed 'Requires.private' libtiff-4.pc.in \
'/Libs:/ a\Requires.private: libjpeg liblzma zlib libzstd glut'
CFLAGS+=" -DFREEGLUT_STATIC" \
do_cmakeinstall global -D{webp,jbig,lerc}=OFF "${extracommands[@]}"
do_checkIfExist
fi
fi
file_installed -s libtiff-4.pc &&
grep_or_sed '-ldeflate' "$(file_installed libtiff-4.pc)" \
's/Libs.private:.*/& -ldeflate/'
if [[ $ffmpeg != no || $standalone = y ]] && enabled libwebp; then
do_pacman_install giflib
_check=(libwebp{,mux}.{a,pc})
[[ $standalone = y ]] && _check+=(libwebp{demux,decoder}.{a,pc}
bin-global/{{c,d}webp,webpmux,img2webp}.exe)
if do_vcs "$SOURCE_REPO_LIBWEBP"; then
do_uninstall include/webp bin-global/gif2webp.exe "${_check[@]}"
extracommands=("-DWEBP_BUILD_EXTRAS=OFF" "-DWEBP_BUILD_VWEBP=OFF")
if [[ $standalone = y ]]; then
extracommands+=(-DWEBP_BUILD_{{C,D,GIF2,IMG2}WEBP,ANIM_UTILS,WEBPMUX}"=ON")
else
extracommands+=(-DWEBP_BUILD_{{C,D,GIF2,IMG2,V}WEBP,ANIM_UTILS,WEBPMUX}"=OFF")
fi
CFLAGS+=" -DFREEGLUT_STATIC" \
do_cmakeinstall global -DWEBP_ENABLE_SWAP_16BIT_CSP=ON "${extracommands[@]}"
do_checkIfExist
fi
fi
if [[ $jpegxl = y ]] || { [[ $ffmpeg != no ]] && enabled libjxl; }; then
_check=(bin/gflags_completions.sh gflags.pc gflags/gflags.h libgflags{,_nothreads}.a)
if do_vcs "$SOURCE_REPO_GFLAGS"; then
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/gflags/0001-cmake-chop-off-.lib-extension-from-shlwapi.patch" am
do_uninstall "${_check[@]}" lib/cmake/gflags include/gflags
do_cmakeinstall -D{BUILD,INSTALL}_STATIC_LIBS=ON -DBUILD_gflags_LIB=ON -DINSTALL_HEADERS=ON \
-DREGISTER_{BUILD_DIR,INSTALL_PREFIX}=OFF
do_checkIfExist
fi
do_pacman_install brotli lcms2
_deps=(libgflags.a)
_check=(libjxl{{,_threads}.a,.pc} jxl/decode.h)
[[ $jpegxl = y ]] && _check+=(bin-global/{{c,d}jxl,cjpegli,jxlinfo}.exe)
if do_vcs "$SOURCE_REPO_LIBJXL"; then
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/libjxl/0001-brotli-add-ldflags.patch" am
do_uninstall "${_check[@]}" include/jxl
do_pacman_install asciidoc
extracommands=()
log -q "git.submodule" git submodule update --init --recursive
[[ $jpegxl = y ]] || extracommands=("-DJPEGXL_ENABLE_TOOLS=OFF")
CXXFLAGS+=" -DJXL_CMS_STATIC_DEFINE -DJXL_STATIC_DEFINE -DJXL_THREADS_STATIC_DEFINE" \
do_cmakeinstall global -D{BUILD_TESTING,JPEGXL_ENABLE_{BENCHMARK,DOXYGEN,MANPAGES,OPENEXR,SKCMS,EXAMPLES}}=OFF \
-DJPEGXL_{FORCE_SYSTEM_{BROTLI,LCMS2},STATIC}=ON "${extracommands[@]}"
do_checkIfExist
unset extracommands
fi
fi
if files_exist bin-video/OpenCL.dll; then
opencldll=$LOCALDESTDIR/bin-video/OpenCL.dll
else
syspath=$(cygpath -S)
[[ $bits = 32bit && -d $syspath/../SysWOW64 ]] && syspath+=/../SysWOW64
opencldll=$syspath/OpenCL.dll
unset syspath
fi
if [[ $ffmpeg != no && -f $opencldll ]] && enabled opencl; then
do_simple_print "${orange}FFmpeg and related apps will depend on OpenCL.dll$reset"
do_pacman_remove opencl-headers
_check=(CL/cl.h)
if do_vcs "$SOURCE_REPO_OPENCLHEADERS"; then
do_uninstall include/CL
do_install CL/*.h include/CL/
do_checkIfExist
fi
_check=(libOpenCL.a)
if test_newer installed "$opencldll" "${_check[@]}"; then
cd_safe "$LOCALBUILDDIR"
[[ -d opencl ]] && rm -rf opencl
mkdir -p opencl && cd_safe opencl
create_build_dir
gendef "$opencldll" >/dev/null 2>&1
[[ -f OpenCL.def ]] && do_dlltool libOpenCL.a OpenCL.def
[[ -f libOpenCL.a ]] && do_install libOpenCL.a
do_checkIfExist
fi
else
do_removeOption --enable-opencl
fi
unset opencldll
if [[ $ffmpeg != no || $standalone = y ]] && enabled libtesseract; then
do_pacman_remove tesseract-ocr
_check=(libleptonica.{,l}a lept.pc)
if do_vcs "$SOURCE_REPO_LEPT"; then
do_uninstall include/leptonica "${_check[@]}"
[[ -f configure ]] || do_autogen
do_separate_confmakeinstall --disable-programs --without-{lib{openjpeg,webp},giflib}
do_checkIfExist
fi
do_pacman_install libarchive pango asciidoc
_check=(libtesseract.{,l}a tesseract.pc)
if do_vcs "$SOURCE_REPO_TESSERACT"; then
do_pacman_install docbook-xsl omp
do_autogen
_check+=(bin-global/tesseract.exe)
do_uninstall include/tesseract "${_check[@]}"
sed -i 's|Requires.private.*|& libarchive iconv libtiff-4|' tesseract.pc.in
grep_or_sed ws2_32 "$MINGW_PREFIX/lib/pkgconfig/libarchive.pc" 's;Libs.private:.*;& -lws2_32;g'
case $CC in
*gcc) sed -i -e 's|Libs.private.*|& -fopenmp -lgomp|' tesseract.pc.in ;;
*clang) sed -i -e 's|Libs.private.*|& -fopenmp=libomp|' tesseract.pc.in ;;
esac
do_separate_confmakeinstall global --disable-{graphics,tessdata-prefix} \
--without-curl \
LIBLEPT_HEADERSDIR="$LOCALDESTDIR/include" \
LIBS="$($PKG_CONFIG --libs iconv lept libtiff-4)" --datadir="$LOCALDESTDIR/bin-global"
if [[ ! -f $LOCALDESTDIR/bin-global/tessdata/eng.traineddata ]]; then
do_pacman_install tesseract-data-eng
mkdir -p "$LOCALDESTDIR"/bin-global/tessdata
do_install "$MINGW_PREFIX/share/tessdata/eng.traineddata" bin-global/tessdata/
printf '%s\n' \
"You can get more language data here:" \
"https://github.com/tesseract-ocr/tessdata" \
"Just download <lang you want>.traineddata and copy it to this directory." \
> "$LOCALDESTDIR"/bin-global/tessdata/need_more_languages.txt
fi
do_checkIfExist
fi
fi
_check=(librubberband.a rubberband.pc rubberband/{rubberband-c,RubberBandStretcher}.h)
if { { [[ $ffmpeg != no ]] && enabled librubberband; } ||
! mpv_disabled rubberband; } &&
do_vcs "$SOURCE_REPO_RUBBERBAND"; then
do_uninstall "${_check[@]}"
log "distclean" make distclean
do_make PREFIX="$LOCALDESTDIR" install-static
do_checkIfExist
fi
_check=(zimg{.h,++.hpp} libzimg.{,l}a zimg.pc)
if [[ $ffmpeg != no ]] && enabled libzimg &&
do_vcs "$SOURCE_REPO_ZIMG"; then
log -q "git.submodule" git submodule update --init --recursive
do_uninstall "${_check[@]}"
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/zimg/0001-libm_wrapper-define-__CRT__NO_INLINE-before-math.h.patch" am
do_autoreconf
do_separate_confmakeinstall
do_checkIfExist
fi
if [[ $exitearly = EE3 ]]; then
do_simple_print -p '\n\t'"${orange}Exit due to env var MABS_EXIT_EARLY set to EE3"
return
fi
set_title "compiling audio tools"
do_simple_print -p '\n\t'"${orange}Starting $bits compilation of audio tools${reset}"
if [[ $ffmpeg != no || $sox = y ]]; then
do_pacman_install wavpack
enabled_any libopencore-amr{wb,nb} && do_pacman_install opencore-amr
if enabled libtwolame; then
do_pacman_install twolame
do_addOption --extra-cflags=-DLIBTWOLAME_STATIC
fi
enabled libmp3lame && do_pacman_install lame
fi
_check=(ilbc.h libilbc.{a,pc})
if [[ $ffmpeg != no ]] && enabled libilbc &&
do_vcs "$SOURCE_REPO_LIBILBC"; then
do_uninstall "${_check[@]}"
log -q "git.submodule" git submodule update --init --recursive
do_cmakeinstall -DUNIX=OFF
do_checkIfExist
fi
_check=(libogg.{l,}a ogg/ogg.h ogg.pc)
if { [[ $flac = y ]] || enabled libvorbis; } &&
do_vcs "$SOURCE_REPO_LIBOGG"; then
do_uninstall include/ogg "${_check[@]}"
do_autogen
do_separate_confmakeinstall audio
do_checkIfExist
fi
_check=(libvorbis{,enc,file}.{,l}a vorbis{,enc,file}.pc vorbis/vorbisenc.h)
if enabled libvorbis && do_vcs "$SOURCE_REPO_LIBVORBIS"; then
do_uninstall include/vorbis "${_check[@]}"
do_autogen
do_separate_confmakeinstall audio --disable-docs
do_checkIfExist
fi
_check=(libspeex.{l,}a speex.pc speex/speex.h)
[[ $standalone = y ]] && _check+=(bin-audio/speex{enc,dec}.exe)
if enabled libspeex && do_vcs "$SOURCE_REPO_SPEEX"; then
do_pacman_remove speex
do_uninstall include/speex "${_check[@]}"
do_autogen
extracommands=()
[[ $standalone = y ]] || extracommands+=(--disable-binaries)
do_separate_confmakeinstall audio --enable-vorbis-psy "${extracommands[@]}"
do_checkIfExist
fi
_check=(libFLAC{,++}.a flac{,++}.pc)
[[ $standalone = y ]] && _check+=(bin-audio/flac.exe)
if [[ $flac = y ]]; then
if do_vcs "$SOURCE_REPO_FLAC"; then
if [[ $standalone = y ]]; then
_check+=(bin-audio/metaflac.exe)
fi
do_uninstall include/FLAC{,++} share/aclocal/libFLAC{,++}.m4 "${_check[@]}"
do_cmakeinstall audio -DBUILD_{DOCS,DOXYGEN,EXAMPLES,TESTING}=OFF -DINSTALL_MANPAGES=OFF
do_checkIfExist
fi
elif [[ $sox = y ]] || { [[ $standalone = y ]] && enabled_any libvorbis libopus; }; then
do_pacman_install flac
grep_and_sed dllimport "$MINGW_PREFIX"/include/FLAC++/export.h \
's|__declspec\(dllimport\)||g' "$MINGW_PREFIX"/include/FLAC{,++}/export.h
fi
grep_and_sed dllimport "$LOCALDESTDIR"/include/FLAC++/export.h \
's|__declspec\(dllimport\)||g' "$LOCALDESTDIR"/include/FLAC{,++}/export.h
grep_or_sed pthread "$LOCALDESTDIR/lib/pkgconfig/flac.pc" 's/Libs.private: /&-pthread /;s/Cflags: .*/& -pthread/'
_check=(libvo-amrwbenc.{l,}a vo-amrwbenc.pc)
if [[ $ffmpeg != no ]] && enabled libvo-amrwbenc &&
do_pkgConfig "vo-amrwbenc = 0.1.3" &&
do_wget_sf -h f63bb92bde0b1583cb3cb344c12922e0 \
"opencore-amr/vo-amrwbenc/vo-amrwbenc-0.1.3.tar.gz"; then
do_uninstall include/vo-amrwbenc "${_check[@]}"
do_separate_confmakeinstall
do_checkIfExist
fi
if { [[ $ffmpeg != no ]] && enabled libfdk-aac; } || [[ $fdkaac = y ]]; then
_check=(libfdk-aac.{l,}a fdk-aac.pc)
if do_vcs "$SOURCE_REPO_FDKAAC"; then
do_autoreconf
do_uninstall include/fdk-aac "${_check[@]}"
CXXFLAGS+=" -fno-exceptions -fno-rtti" do_separate_confmakeinstall
do_checkIfExist
fi
_check=(bin-audio/fdkaac.exe)
_deps=(libfdk-aac.a)
if [[ $standalone = y ]] &&
do_vcs "$SOURCE_REPO_FDKAACEXE" bin-fdk-aac; then
do_autoreconf
do_uninstall "${_check[@]}"
CFLAGS+=" $($PKG_CONFIG --cflags fdk-aac)" \
LDFLAGS+=" $($PKG_CONFIG --cflags --libs fdk-aac)" \
do_separate_confmakeinstall audio
do_checkIfExist
fi
fi
if [[ $faac = y ]]; then
_check=(bin-audio/faac.exe)
if [[ $standalone = y ]]; then
do_pacman_install faac
elif do_vcs "$SOURCE_REPO_FAAC"; then
do_pacman_remove faac
do_uninstall libfaac.a faac{,cfg}.h "${_check[@]}"
log bootstrap ./bootstrap
do_separate_confmakeinstall audio
do_checkIfExist
fi
fi
_check=(bin-audio/exhale.exe)
if [[ $exhale = y ]] &&
do_vcs "$SOURCE_REPO_EXHALE"; then
do_uninstall "${_check[@]}"
_notrequired=true
do_cmakeinstall audio
do_checkIfExist
unset _notrequired
fi
_check=(bin-audio/ogg{enc,dec}.exe)
_deps=(ogg.pc vorbis.pc)
if [[ $standalone = y ]] && enabled libvorbis &&
do_vcs "$SOURCE_REPO_VORBIS_TOOLS"; then
do_patch "https://github.com/xiph/vorbis-tools/pull/39.patch" am
do_autoreconf
do_uninstall "${_check[@]}"
extracommands=()
enabled libspeex || extracommands+=(--without-speex)
do_separate_conf --disable-{ogg123,vorbiscomment,vcut,ogginfo} \
--with-lib{iconv,intl}-prefix="$MINGW_PREFIX" "${extracommands[@]}"
do_make
do_install oggenc/oggenc.exe oggdec/oggdec.exe bin-audio/
do_checkIfExist
fi
_check=(libopus.{,l}a opus.pc opus/opus.h)
if enabled libopus && do_vcs "$SOURCE_REPO_OPUS"; then
do_pacman_remove opus
do_uninstall include/opus "${_check[@]}"
(
sha=$(grep dnn/download_model.sh autogen.sh | awk -F'"' '{print $2}')
model=opus_data-${sha}.tar.gz
pushd . > /dev/null
[ -f "/build/$model" ] || do_wget -r -q -n "https://media.xiph.org/opus/models/$model"
popd > /dev/null || return 1
ln -s "$LOCALBUILDDIR/$model" .
)
do_autogen
do_separate_confmakeinstall --disable-{stack-protector,doc,extra-programs}
do_checkIfExist
fi
if [[ $standalone = y ]] && enabled libopus; then
do_pacman_install openssl
hide_libressl
do_pacman_remove opusfile
_check=(opus/opusfile.h libopus{file,url}.{,l}a opus{file,url}.pc)
_deps=(ogg.pc opus.pc "$MINGW_PREFIX"/lib/pkgconfig/libssl.pc)
if do_vcs "$SOURCE_REPO_OPUSFILE"; then
do_uninstall "${_check[@]}"
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/opusfile/0001-Disable-cert-store-integration-if-OPENSSL_VERSION_NU.patch" am
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/opusfile/0002-configure-Only-add-std-c89-if-not-mingw-because-of-c.patch" am
do_autogen
do_separate_confmakeinstall --disable-{examples,doc}
do_checkIfExist
fi
_check=(opus/opusenc.h libopusenc.{pc,{,l}a})
_deps=(opus.pc)
if do_vcs "$SOURCE_REPO_LIBOPUSENC"; then
do_uninstall "${_check[@]}"
do_autogen
do_separate_confmakeinstall --disable-{examples,doc}
do_checkIfExist
fi
_check=(bin-audio/opusenc.exe)
_deps=(opusfile.pc libopusenc.pc)
if do_vcs "$SOURCE_REPO_OPUSEXE"; then
_check+=(bin-audio/opus{dec,info}.exe)
do_uninstall "${_check[@]}"
do_autogen
do_separate_confmakeinstall audio
do_checkIfExist
fi
hide_libressl -R
fi
_check=(soxr.h libsoxr.a)
if [[ $ffmpeg != no ]] && enabled libsoxr &&
do_vcs "$SOURCE_REPO_LIBSOXR"; then
do_uninstall "${_check[@]}"
do_cmakeinstall -D{WITH_LSR_BINDINGS,BUILD_TESTS,WITH_OPENMP}=off
do_checkIfExist
fi
_check=(libcodec2.a codec2.pc codec2/codec2.h)
if [[ $ffmpeg != no ]] && enabled libcodec2; then
if do_vcs "$SOURCE_REPO_CODEC2"; then
do_uninstall all include/codec2 "${_check[@]}"
sed -i 's|if(WIN32)|if(FALSE)|g' CMakeLists.txt
if enabled libspeex; then
# rename same-named symbols copied from speex
grep -ERl "\b(lsp|lpc)_to_(lpc|lsp)" --include="*.[ch]" | \
xargs -r sed -ri "s;((lsp|lpc)_to_(lpc|lsp));c2_\1;g"
fi
do_cmakeinstall -D{UNITTEST,INSTALL_EXAMPLES}=off \
-DCMAKE_INSTALL_BINDIR="$(pwd)/build-$bits/_bin"
do_checkIfExist
fi
fi
if [[ $standalone = y ]] && enabled libmp3lame; then
_check=(bin-audio/lame.exe)
if files_exist "${_check[@]}" &&
grep -q "3.100" "$LOCALDESTDIR/bin-audio/lame.exe"; then
do_print_status "lame 3.100" "$green" "Up-to-date"
elif do_wget_sf \
-h ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e \
"lame/lame/3.100/lame-3.100.tar.gz"; then
do_uninstall include/lame libmp3lame.{l,}a "${_check[@]}"
_mingw_patches_lame="https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-lame"
do_patch "$_mingw_patches_lame/0005-no-gtk.all.patch"
do_patch "$_mingw_patches_lame/0006-dont-use-outdated-symbol-list.patch"
do_patch "$_mingw_patches_lame/0007-revert-posix-code.patch"
do_patch "$_mingw_patches_lame/0008-skip-termcap.patch"
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/lame/0001-libmp3lame-vector-Makefile.am-Add-msse-to-fix-i686-c.patch"
do_autoreconf
do_separate_conf --enable-nasm
do_make
do_install frontend/lame.exe bin-audio/
do_checkIfExist
unset _mingw_patches_lame
fi
fi
_check=(libgme.{a,pc})
if [[ $ffmpeg != no ]] && enabled libgme && do_pkgConfig "libgme = 0.6.3" &&
do_wget -h aba34e53ef0ec6a34b58b84e28bf8cfbccee6585cebca25333604c35db3e051d \
"https://bitbucket.org/mpyne/game-music-emu/downloads/game-music-emu-0.6.3.tar.xz"; then
do_uninstall include/gme "${_check[@]}"
do_cmakeinstall -DENABLE_UBSAN=OFF
do_checkIfExist
fi
_check=(libbs2b.{{l,}a,pc})
if [[ $ffmpeg != no ]] && enabled libbs2b && do_pkgConfig "libbs2b = 3.1.0" &&
do_wget_sf -h c1486531d9e23cf34a1892ec8d8bfc06 "bs2b/libbs2b/3.1.0/libbs2b-3.1.0.tar.bz2"; then
do_uninstall include/bs2b "${_check[@]}"
# sndfile check is disabled since we don't compile binaries anyway
/usr/bin/grep -q sndfile configure && sed -i '20119,20133d' configure
sed -i "s|bin_PROGRAMS = .*||" src/Makefile.in
do_separate_confmakeinstall
do_checkIfExist
fi
_check=(libsndfile.a sndfile.{h,pc})
if [[ $sox = y ]] && do_vcs "$SOURCE_REPO_SNDFILE" sndfile; then
do_uninstall include/sndfile.hh "${_check[@]}"
do_cmakeinstall -DBUILD_EXAMPLES=off -DBUILD_TESTING=off -DBUILD_PROGRAMS=OFF
do_checkIfExist
fi
_check=(bin-audio/sox.exe sox.pc)
_deps=(libsndfile.a opus.pc "$MINGW_PREFIX"/lib/libmp3lame.a)
if [[ $sox = y ]]; then
do_pacman_install libmad
extracommands=()
if enabled libopus; then
[[ $standalone = y ]] || do_pacman_install opusfile
else
extracommands+=(--without-opus)
fi
if do_vcs "$SOURCE_REPO_SOX" sox; then
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/sox/0001-sox_version-fold-function-into-sox_version_info.patch" am
do_patch "https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-sox/0001-ucrt-no-rewind-pipe.patch"
do_uninstall sox.{pc,h} bin-audio/{soxi,play,rec}.exe libsox.{l,}a "${_check[@]}"
do_autoreconf
extralibs=(-lshlwapi -lz)
enabled libmp3lame || extracommands+=(--without-lame)
enabled_any libopencore-amr{wb,nb} &&
extralibs+=(-lvo-amrwbenc) ||
extracommands+=(--without-amr{wb,nb})
enabled libtwolame &&
extracommands+=(CFLAGS="$CFLAGS -DLIBTWOLAME_STATIC") ||
extracommands+=(--without-twolame)
enabled libvorbis || extracommands+=(--without-oggvorbis)
hide_conflicting_libs
sed -i 's|found_libgsm=yes|found_libgsm=no|g' configure
do_separate_conf --disable-symlinks LIBS="-L$LOCALDESTDIR/lib ${extralibs[*]}" "${extracommands[@]}"
do_make
do_install src/sox.exe bin-audio/
do_install sox.pc
hide_conflicting_libs -R
do_checkIfExist
unset extralibs
fi
unset extracommands
fi
unset _deps
_check=(libopenmpt.{a,pc})
if [[ $ffmpeg != no ]] && enabled libopenmpt &&
do_vcs "$SOURCE_REPO_LIBOPENMPT"; then
do_uninstall include/libopenmpt "${_check[@]}"
mkdir bin 2> /dev/null
extracommands=("CONFIG=mingw64-win${bits%bit}" "AR=ar" "STATIC_LIB=1" "EXAMPLES=0" "OPENMPT123=0"
"TEST=0" "OS=" "CC=$CC" "CXX=$CXX" "MINGW_COMPILER=${CC##* }")
log clean make clean "${extracommands[@]}"
do_makeinstall PREFIX="$LOCALDESTDIR" "${extracommands[@]}"
sed -i 's/Libs.private.*/& -lrpcrt4/' "$LOCALDESTDIR/lib/pkgconfig/libopenmpt.pc"
do_checkIfExist
fi
_check=(libmysofa.{a,pc} mysofa.h)
if [[ $ffmpeg != no ]] && enabled libmysofa &&
do_vcs "$SOURCE_REPO_LIBMYSOFA"; then
do_uninstall "${_check[@]}"
do_cmakeinstall -DBUILD_TESTS=no -DCODE_COVERAGE=OFF
do_checkIfExist
fi
_check=(libflite.a flite/flite.h)
if enabled libflite && do_vcs "$SOURCE_REPO_FLITE"; then
do_patch "https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/flite/0001-tools-find_sts_main.c-Include-windows.h-before-defin.patch" am
do_uninstall libflite_cmu_{grapheme,indic}_{lang,lex}.a \
libflite_cmu_us_{awb,kal,kal16,rms,slt}.a \
libflite_{cmulex,usenglish,cmu_time_awb}.a "${_check[@]}" include/flite
log clean make clean
do_configure --bindir="$LOCALDESTDIR"/bin-audio --disable-shared \
--with-audio=none
do_make && do_makeinstall
do_checkIfExist
fi
_check=(shine/layer3.h libshine.{,l}a shine.pc)
[[ $standalone = y ]] && _check+=(bin-audio/shineenc.exe)
if enabled libshine && do_pkgConfig "shine = 3.1.1" &&
do_wget -h 58e61e70128cf73f88635db495bfc17f0dde3ce9c9ac070d505a0cd75b93d384 \
"https://github.com/toots/shine/releases/download/3.1.1/shine-3.1.1.tar.gz"; then
do_uninstall "${_check[@]}"
[[ $standalone = n ]] && sed -i '/bin_PROGRAMS/,+4d' Makefile.am