forked from m-ab-s/media-autobuild_suite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
media-autobuild_suite.bat
executable file
·1516 lines (1383 loc) · 58.8 KB
/
media-autobuild_suite.bat
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
::-------------------------------------------------------------------------------------
:: LICENSE -------------------------------------------------------------------------
::-------------------------------------------------------------------------------------
:: This Windows Batchscript is for setup a compiler environment for building ffmpeg and other media tools under Windows.
::
:: Copyright (C) 2013 jb_alvarado
::
:: This program is free software: you can redistribute it and/or modify
:: it under the terms of the GNU General Public License as published by
:: the Free Software Foundation, either version 3 of the License, or
:: (at your option) any later version.
::
:: This program is distributed in the hope that it will be useful,
:: but WITHOUT ANY WARRANTY; without even the implied warranty of
:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
:: GNU General Public License for more details.
::
:: You should have received a copy of the GNU General Public License
:: along with this program. If not, see <http://www.gnu.org/licenses/>.
::-------------------------------------------------------------------------------------
@echo off
color 80
title media-autobuild_suite
setlocal
set instdir=%CD%
set "ini=build\media-autobuild_suite.ini"
if not exist %instdir% (
echo -------------------------------------------------------------------------------
echo. You have probably run the script in a path with spaces.
echo. This is not supported.
echo. Please move the script to use a path without spaces. Example:
echo. Incorrect: C:\build suite\
echo. Correct: C:\build_suite\
pause
exit
)
if not ["%CD:~60,1%"]==[""] (
echo -------------------------------------------------------------------------------
echo. The total filepath to the suite seems too large (larger than 67 characters^):
echo. %CD%
echo. Some packages will fail building because of it.
echo. Please move the suite directory closer to the root of your drive and maybe
echo. rename the suite directory to a smaller name. Examples:
echo. Avoid: C:\Users\Administrator\Desktop\testing\media-autobuild_suite-master
echo. Prefer: C:\media-autobuild_suite
echo. Prefer: C:\ab-suite
pause
)
set _bitness=64
if %PROCESSOR_ARCHITECTURE%==x86 (
IF NOT DEFINED PROCESSOR_ARCHITEW6432 set _bitness=32
)
set build=%instdir%\build
if not exist %build% mkdir %build%
set msyspackages=asciidoc autoconf automake-wrapper autogen bison diffstat dos2unix help2man ^
intltool libtool patch python xmlto make zip unzip git subversion wget p7zip mercurial man-db ^
gperf winpty texinfo upx gyp-git
set mingwpackages=cmake dlfcn doxygen libpng gcc nasm pcre tools-git yasm ninja pkg-config lz4
set ffmpeg_options=--enable-avisynth --enable-gcrypt --enable-libmp3lame ^
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 ^
--enable-cuda --enable-cuvid --enable-schannel
set ffmpeg_options_zeranoe=--enable-decklink --enable-fontconfig ^
--enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b ^
--enable-libcaca --enable-libfreetype --enable-libfribidi ^
--enable-libgme --enable-libgsm --enable-libilbc --enable-libmfx --enable-libmodplug ^
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg ^
--enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex ^
--enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc ^
--enable-libwavpack --enable-libwebp --enable-libxavs --enable-libxvid --enable-libzimg ^
--enable-openssl --enable-libsnappy --enable-gpl
set ffmpeg_options_full=--enable-opencl --enable-opengl --enable-libcdio ^
--enable-libfdk-aac --enable-libkvazaar --enable-librubberband ^
--enable-libssh --enable-libtesseract --enable-libzvbi ^
--enable-chromaprint --enable-libopenh264 --enable-libopenmpt ^
--enable-netcdf --enable-libnpp --enable-sdl2
set mpv_options=--enable-dvdread --enable-dvdnav --enable-libbluray --enable-libass --enable-rubberband ^
--enable-lua --enable-uchardet --enable-libarchive --enable-lcms2 --disable-debug-build ^
--enable-vapoursynth --disable-libmpv-shared --enable-egl-angle-lib --enable-html-build ^
--enable-pdf-build --enable-manpage-build
set iniOptions=msys2Arch arch license2 vpx2 x2642 x2652 other265 flac fdkaac mediainfo soxB ffmpegB ffmpegUpdate ^
ffmpegChoice mp4box rtmpdump mplayer mpv cores deleteSource strip pack xpcomp logging bmx standalone updateSuite ^
aom daala faac ffmbc
set previousOptions=0
set msys2ArchINI=0
if exist %ini% GOTO checkINI
:selectmsys2Arch
set deleteIni=1
if %_bitness%==64 (
set msys2Arch=2
) else set msys2Arch=1
echo.[compiler list]>%ini%
echo.msys2Arch=^%msys2Arch%>>%ini%
if %previousOptions%==0 for %%a in (%iniOptions%) do set %%aINI=0
set msys2ArchINI=%msys2Arch%
GOTO systemVars
:checkINI
set deleteIni=0
for %%a in (%iniOptions%) do (
findstr %%a %ini% > nul
if errorlevel 1 set deleteIni=1 && set %%aINI=0
if errorlevel 0 for /F "tokens=2 delims==" %%b in ('findstr %%a %ini%') do (
set %%aINI=%%b
if %%b==0 set deleteIni=1
)
)
if %deleteINI%==1 (
del %ini%
set previousOptions=1
GOTO selectmsys2Arch
)
:systemVars
set msys2Arch=%msys2ArchINI%
if %msys2Arch%==1 set "msys2=msys32"
if %msys2Arch%==2 set "msys2=msys64"
:selectSystem
set "writeArch=no"
if %archINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Select the build target system:
echo. 1 = both [32 bit and 64 bit]
echo. 2 = 32 bit build system
echo. 3 = 64 bit build system
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildEnv="Build System: "
) else set buildEnv=%archINI%
if %deleteINI%==1 set "writeArch=yes"
if %buildEnv%==1 (
set "build32=yes"
set "build64=yes"
)
if %buildEnv%==2 (
set "build32=yes"
set "build64=no"
)
if %buildEnv%==3 (
set "build32=no"
set "build64=yes"
)
if %buildEnv% GTR 3 GOTO selectSystem
if %writeArch%==yes echo.arch=^%buildEnv%>>%ini%
:ffmpeglicense
set "writeLicense=no"
if %license2INI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FFmpeg/rtmpdump with which license?
echo. 1 = Non-free [unredistributable, but can include anything]
echo. 2 = GPLv3 [disables OpenSSL and FDK-AAC]
echo. 3 = GPLv2.1
echo. [Same disables as GPLv3 with addition of gmp, opencore codecs]
echo. 4 = LGPLv3
echo. [Disables x264, x265, XviD, GPL filters, etc.
echo. but reenables OpenSSL/FDK-AAC]
echo. 5 = LGPLv2.1 [same disables as LGPLv3 + GPLv2.1]
echo.
echo. If building for yourself, it's OK to choose non-free.
echo. If building to redistribute online, choose GPL or LGPL.
echo. If building to include in a GPLv2.1 binary, choose LGPLv2.1 or GPLv2.1.
echo. If you want to use FFmpeg together with closed source software, choose LGPL
echo. and follow instructions in https://www.ffmpeg.org/legal.html
echo.
echo. In the case of rtmpdump, since its binaries are GPL, it will be compiled
echo. with GnuTLS if LGPL is chosen, but if Non-free will use OpenSSL.
echo. If not building rtmpdump, but just librtmp ^(which is LGPL^) to use in FFmpeg,
echo. OpenSSL can be used.
echo.
echo. OpenSSL and FDK-AAC have licenses incompatible with GPL but compatible
echo. with LGPL, so they won't be disabled automatically if you choose LGPL.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P ffmpegLicense="FFmpeg license: "
) else set ffmpegLicense=%license2INI%
if %deleteINI%==1 set "writeLicense=yes"
if %ffmpegLicense%==1 set "license2=nonfree"
if %ffmpegLicense%==2 set "license2=gplv3"
if %ffmpegLicense%==3 set "license2=gpl"
if %ffmpegLicense%==4 set "license2=lgplv3"
if %ffmpegLicense%==5 set "license2=lgpl"
if %ffmpegLicense% GTR 5 GOTO ffmpeglicense
if %writeLicense%==yes echo.license2=^%ffmpegLicense%>>%ini%
:xpcomp
set "writexpcomp=no"
if %xpcompINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build libraries/binaries compatible with Windows XP when possible?
echo. 1 = Yes
echo. 2 = No [recommended]
echo.
echo. Examples: x265, disabled QuickSync and mpv, etc.
echo. This usually causes worse performance in all systems.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildxpcomp="Build with XP compatibility: "
) else set buildxpcomp=%xpcompINI%
if %deleteINI%==1 set "writexpcomp=yes"
if %buildxpcomp%==1 set "xpcomp=y"
if %buildxpcomp%==2 set "xpcomp=n"
if %buildxpcomp% GTR 2 GOTO xpcomp
if %writexpcomp%==yes echo.xpcomp=^%buildxpcomp%>>%ini%
:standalone
set "writestandalone=no"
if %standaloneINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build standalone binaries for libraries included in FFmpeg?
echo. eg. Compile opusenc.exe if --enable-libopus
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildstandalone="Build standalone binaries: "
) else set buildstandalone=%standaloneINI%
if %deleteINI%==1 set "writestandalone=yes"
if %buildstandalone%==1 set "standalone=y"
if %buildstandalone%==2 set "standalone=n"
if %buildstandalone% GTR 2 GOTO standalone
if %writestandalone%==yes echo.standalone=^%buildstandalone%>>%ini%
:vpx
set "writevpx=no"
if %vpx2INI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build vpx [VP8/VP9/VP10 encoder]?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binaries being built depends on "standalone=y"
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildvpx="Build vpx: "
) else set buildvpx=%vpx2INI%
if %deleteINI%==1 set "writevpx=yes"
if %buildvpx%==1 set "vpx2=y"
if %buildvpx%==2 set "vpx2=n"
if %buildvpx% GTR 2 GOTO vpx
if %writevpx%==yes echo.vpx2=^%buildvpx%>>%ini%
:aom
set "writeaom=no"
if %aomINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build aom [Alliance for Open Media codec]?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binaries being built depends on "standalone=y"
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildaom="Build aom: "
) else set buildaom=%aomINI%
if %deleteINI%==1 set "writeaom=yes"
if %buildaom%==1 set "aom=y"
if %buildaom%==2 set "aom=n"
if %buildaom% GTR 2 GOTO aom
if %writeaom%==yes echo.aom=^%buildaom%>>%ini%
:daala
set "writedaala=no"
if %daalaINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build daala [Daala codec]?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binaries being built depends on "standalone=y"
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P builddaala="Build daala: "
) else set builddaala=%daalaINI%
if %deleteINI%==1 set "writedaala=yes"
if %builddaala%==1 set "daala=y"
if %builddaala%==2 set "daala=n"
if %builddaala% GTR 2 GOTO daala
if %writedaala%==yes echo.daala=^%builddaala%>>%ini%
:x264
set "writex264=no"
if %x2642INI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build x264 [H.264 encoder]?
echo. 1 = 8-bit lib/binary and 10-bit binary
echo. 2 = No
echo. 3 = 10-bit lib/binary
echo. 4 = 8-bit lib/binary and 10-bit binary with libavformat and ffms2
echo.
echo. Binaries being built depends on "standalone=y"
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildx264="Build x264: "
) else set buildx264=%x2642INI%
if %deleteINI%==1 set "writex264=yes"
if %buildx264%==1 set "x2642=y"
if %buildx264%==2 set "x2642=n"
if %buildx264%==3 set "x2642=h"
if %buildx264%==4 set "x2642=f"
if %buildx264% GTR 4 GOTO x264
if %writex264%==yes echo.x2642=^%buildx264%>>%ini%
:x265
set "writex265=no"
if %x2652INI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build x265 [H.265 encoder]?
echo. 1 = Lib/binary with Main, Main10 and Main12
echo. 2 = No
echo. 3 = Lib/binary with Main10 only
echo. 4 = Lib/binary with Main only
echo. 5 = Lib/binary with Main, shared libs with Main10 and Main12
echo. 6 = Same as 1 with addition of non-XP compatible x265-numa.exe
echo. 7 = Lib/binary with Main12 only
echo.
echo. Binaries being built depends on "standalone=y"
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildx265="Build x265: "
) else set buildx265=%x2652INI%
if %deleteINI%==1 set "writex265=yes"
if %buildx265%==1 set "x2652=y"
if %buildx265%==2 set "x2652=n"
if %buildx265%==3 set "x2652=o10"
if %buildx265%==4 set "x2652=o8"
if %buildx265%==5 set "x2652=s"
if %buildx265%==6 set "x2652=d"
if %buildx265%==7 set "x2652=o12"
if %buildx265% GTR 7 GOTO x265
if %writex265%==yes echo.x2652=^%buildx265%>>%ini%
:other265
set "writeother265=no"
if %other265INI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build Kvazaar?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binary being built depends on "standalone=y"
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildother265="Build kvazaar: "
) else set buildother265=%other265INI%
if %deleteINI%==1 set "writeother265=yes"
if %buildother265%==1 set "other265=y"
if %buildother265%==2 set "other265=n"
if %buildother265% GTR 2 GOTO other265
if %writeother265%==yes echo.other265=^%buildother265%>>%ini%
:flac
set "writeflac=no"
if %flacINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FLAC? [Free Lossless Audio Codec]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildflac="Build flac: "
) else set buildflac=%flacINI%
if %deleteINI%==1 set "writeflac=yes"
if %buildflac%==1 set "flac=y"
if %buildflac%==2 set "flac=n"
if %buildflac% GTR 2 GOTO flac
if %writeflac%==yes echo.flac=^%buildflac%>>%ini%
:fdkaac
set "writefdkaac=no"
if %fdkaacINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FDK-AAC library and binary? [AAC-LC/HE/HEv2 codec]
echo. 1 = Yes
echo. 2 = No
echo.
echo. Note: FFmpeg's aac encoder is no longer experimental and considered equal or
echo. better in quality from 96kbps and above. It still doesn't support AAC-HE/HEv2
echo. so if you need that or want better quality at lower bitrates than 96kbps,
echo. use FDK-AAC.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildfdkaac="Build fdkaac: "
) else set buildfdkaac=%fdkaacINI%
if %deleteINI%==1 set "writefdkaac=yes"
if %buildfdkaac%==1 set "fdkaac=y"
if %buildfdkaac%==2 set "fdkaac=n"
if %buildfdkaac% GTR 2 GOTO fdkaac
if %writefdkaac%==yes echo.fdkaac=^%buildfdkaac%>>%ini%
:faac
set "writefaac=no"
if %faacINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FAAC library and binary? [old, low-quality and nonfree AAC-LC codec]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildfaac="Build faac: "
) else set buildfaac=%faacINI%
if %deleteINI%==1 set "writefaac=yes"
if %buildfaac%==1 set "faac=y"
if %buildfaac%==2 set "faac=n"
if %buildfaac% GTR 2 GOTO faac
if %writefaac%==yes echo.faac=^%buildfaac%>>%ini%
:mediainfo
set "writemediainfo=no"
if %mediainfoINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build mediainfo binaries [Multimedia file information tool]?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildmediainfo="Build mediainfo: "
) else set buildmediainfo=%mediainfoINI%
if %deleteINI%==1 set "writemediainfo=yes"
if %buildmediainfo%==1 set "mediainfo=y"
if %buildmediainfo%==2 set "mediainfo=n"
if %buildmediainfo% GTR 2 GOTO mediainfo
if %writemediainfo%==yes echo.mediainfo=^%buildmediainfo%>>%ini%
:sox
set "writesox=no"
if %soxBINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build sox binaries [Sound processing tool]?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildsox="Build sox: "
) else set buildsox=%soxBINI%
if %deleteINI%==1 set "writesox=yes"
if %buildsox%==1 set "sox=y"
if %buildsox%==2 set "sox=n"
if %buildsox% GTR 2 GOTO sox
if %writesox%==yes echo.soxB=^%buildsox%>>%ini%
:ffmpeg
set "writeFF=no"
if %ffmpegBINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FFmpeg binaries and libraries:
echo. 1 = Yes [static] [recommended]
echo. 2 = No
echo. 3 = Shared
echo. 4 = Both static and shared [shared goes to an isolated directory]
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildffmpeg="Build FFmpeg: "
) else set buildffmpeg=%ffmpegBINI%
if %deleteINI%==1 set "writeFF=yes"
if %buildffmpeg%==1 set "ffmpeg=static"
if %buildffmpeg%==2 set "ffmpeg=no"
if %buildffmpeg%==3 set "ffmpeg=shared"
if %buildffmpeg%==4 set "ffmpeg=both"
if %buildffmpeg% GTR 4 GOTO ffmpeg
if %writeFF%==yes echo.ffmpegB=^%buildffmpeg%>>%ini%
:ffmpegUp
set "writeFFU=no"
if %ffmpegUpdateINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Always build FFmpeg when libraries have been updated?
echo. 1 = Yes
echo. 2 = No
echo. 3 = Only build FFmpeg/mpv and missing dependencies
echo.
echo. FFmpeg is updated a lot so you only need to select this if you
echo. absolutely need updated external libraries in FFmpeg.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildffmpegUp="Build ffmpeg if lib is new: "
) else set buildffmpegUp=%ffmpegUpdateINI%
if %deleteINI%==1 set "writeFFU=yes"
if %buildffmpegUp%==1 set "ffmpegUpdate=y"
if %buildffmpegUp%==2 set "ffmpegUpdate=n"
if %buildffmpegUp%==3 set "ffmpegUpdate=onlyFFmpeg"
if %buildffmpegUp% GTR 3 GOTO ffmpegUp
if %writeFFU%==yes echo.ffmpegUpdate=^%buildffmpegUp%>>%ini%
:ffmpegChoice
set "writeFFC=no"
if %ffmpegChoiceINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Choose ffmpeg and mpv optional libraries?
echo. 1 = Yes
echo. 2 = No ^(Light build^)
echo. 3 = No ^(Mimic Zeranoe^)
echo. 4 = No ^(All available external libs^)
echo.
echo. If you select yes, we will create files with the default options
echo. we use with FFmpeg and mpv. You can remove any that you don't need or prefix
echo. them with #
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildffmpegChoice="Choose ffmpeg and mpv optional libs: "
) else set buildffmpegChoice=%ffmpegChoiceINI%
if %deleteINI%==1 set "writeFFC=yes"
if %buildffmpegChoice%==1 (
set "ffmpegChoice=y"
if not exist %build%\ffmpeg_options.txt (
(
echo.# Lines starting with this character are ignored
for %%i in (%ffmpeg_options%) do echo.%%i
echo.# Zeranoe
for %%i in (%ffmpeg_options_zeranoe%) do echo.#%%i
echo.# Full
for %%i in (%ffmpeg_options_full%) do echo.#%%i
)>>%build%\ffmpeg_options.txt
echo -------------------------------------------------------------------------------
echo. File with default FFmpeg options has been created in
echo. %build%\ffmpeg_options.txt
echo.
echo. Edit it now or leave it unedited to compile according to defaults.
echo -------------------------------------------------------------------------------
pause
)
if not exist %build%\mpv_options.txt (
for %%i in (%mpv_options%) do echo.%%i>>%build%\mpv_options.txt
echo -------------------------------------------------------------------------------
echo. File with default mpv options has been created in
echo. %build%\mpv_options.txt
echo.
echo. Edit it now or leave it unedited to compile according to defaults.
echo -------------------------------------------------------------------------------
pause
)
)
if %buildffmpegChoice%==2 set "ffmpegChoice=n"
if %buildffmpegChoice%==3 set "ffmpegChoice=z"
if %buildffmpegChoice%==4 set "ffmpegChoice=f"
if %buildffmpegChoice% GTR 4 GOTO ffmpegChoice
if %writeFFC%==yes echo.ffmpegChoice=^%buildffmpegChoice%>>%ini%
:mp4boxStatic
set "writeMP4Box=no"
if %mp4boxINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build static mp4box [mp4 muxer/toolbox] binary?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildMp4box="Build mp4box: "
) else set buildMp4box=%mp4boxINI%
if %deleteINI%==1 set "writeMP4Box=yes"
if %buildMp4box%==1 set "mp4box=y"
if %buildMp4box%==2 set "mp4box=n"
if %buildMp4box% GTR 2 GOTO mp4boxStatic
if %writeMP4Box%==yes echo.mp4box=^%buildMp4box%>>%ini%
:rtmpdump
set "writertmpdump=no"
if %rtmpdumpINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build static rtmpdump binaries [rtmp tools]?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildrtmpdump="Build rtmpdump: "
) else set buildrtmpdump=%rtmpdumpINI%
if %deleteINI%==1 set "writertmpdump=yes"
if %buildrtmpdump%==1 set "rtmpdump=y"
if %buildrtmpdump%==2 set "rtmpdump=n"
if %buildrtmpdump% GTR 2 GOTO rtmpdump
if %writertmpdump%==yes echo.rtmpdump=^%buildrtmpdump%>>%ini%
:mplayer
set "writeMPlayer=no"
if %mplayerINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build static mplayer/mencoder binary?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildmplayer="Build mplayer: "
) else set buildmplayer=%mplayerINI%
if %deleteINI%==1 set "writeMPlayer=yes"
if %buildmplayer%==1 set "mplayer=y"
if %buildmplayer%==2 set "mplayer=n"
if %buildmplayer% GTR 2 GOTO mplayer
if %writeMPlayer%==yes echo.mplayer=^%buildmplayer%>>%ini%
:mpv
set "writeMPV=no"
if %mpvINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build static mpv binary?
echo. 1 = Yes
echo. 2 = No
echo. 3 = compile with Vapoursynth, if installed [see Warning]
echo.
echo. Note: Requires at least Windows Vista.
echo. Warning: the third option isn't completely static. There's no way to include
echo. a library dependant on Python statically. All users of the compiled binary
echo. will need VapourSynth installed using the official package to even open mpv!
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildmpv="Build mpv: "
) else set buildmpv=%mpvINI%
if %deleteINI%==1 set "writeMPV=yes"
if %buildmpv%==1 set "mpv=y"
if %buildmpv%==2 set "mpv=n"
if %buildmpv%==3 set "mpv=v"
if %buildmpv% GTR 3 GOTO mpv
if %writeMPV%==yes echo.mpv=^%buildmpv%>>%ini%
:bmx
set "writeBmx=no"
if %bmxINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build static bmx tools?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildbmx="Build bmx: "
) else set buildbmx=%bmxINI%
if %deleteINI%==1 set "writeBmx=yes"
if %buildbmx%==1 set "bmx=y"
if %buildbmx%==2 set "bmx=n"
if %buildbmx% GTR 2 GOTO bmx
if %writeBmx%==yes echo.bmx=^%buildbmx%>>%ini%
:ffmbc
set "writeFFmbc=no"
if %ffmbcINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FFMedia Broadcast binary?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Note: this is a fork of FFmpeg 0.10. As such, it's very likely to fail
echo. to build, work, might burn your computer, kill your children, like mplayer.
echo. Only enable it if you absolutely need it. If it breaks, complain first to
echo. the author in #ffmbc in Freenode IRC.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildffmbc="Build ffmbc: "
) else set buildffmbc=%ffmbcINI%
if %deleteINI%==1 set "writeFFmbc=yes"
if %buildffmbc%==1 set "ffmbc=y"
if %buildffmbc%==2 set "ffmbc=n"
if %buildffmbc% GTR 2 GOTO ffmbc
if %writeFFmbc%==yes echo.ffmbc=^%buildffmbc%>>%ini%
:numCores
set "writeCores=no"
if %NUMBER_OF_PROCESSORS% GTR 1 set /a coreHalf=%NUMBER_OF_PROCESSORS%/2
if %coresINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Number of CPU Cores/Threads for compiling:
echo. [it is non-recommended to use all cores/threads!]
echo.
echo. Recommended: %coreHalf%
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P cpuCores="Core/Thread Count: "
) else set cpuCores=%coresINI%
for /l %%a in (1,1,%cpuCores%) do (
set cpuCount=%%a
)
if %deleteINI%==1 set "writeCores=yes"
if "%cpuCount%"=="" GOTO :numCores
if %writeCores%==yes echo.cores=^%cpuCount%>>%ini%
set "writeDel=no"
if %deleteSourceINI%==0 (
:delete
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Delete versioned source folders after compile is done?
echo. 1 = Yes [recommended]
echo. 2 = No
echo.
echo. This will save a bit of space for libraries not compiled from git/hg/svn.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P deleteS="Delete source: "
) else set deleteS=%deleteSourceINI%
if %deleteINI%==1 set "writeDel=yes"
if %deleteS%==1 set "deleteSource=y"
if %deleteS%==2 set "deleteSource=n"
if %deleteS% GTR 2 GOTO delete
if %writeDel%==yes echo.deleteSource=^%deleteS%>>%ini%
:stripEXE
set "writeStrip=no"
if %stripINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Strip compiled files binaries?
echo. 1 = Yes [recommended]
echo. 2 = No
echo.
echo. Makes binaries smaller at only a small time cost after compiling.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P stripF="Strip files: "
) else set stripF=%stripINI%
if %deleteINI%==1 set "writeStrip=yes"
if %stripF%==1 set "stripFile=y"
if %stripF%==2 set "stripFile=n"
if %stripF% GTR 2 GOTO stripEXE
if %writeStrip%==yes echo.strip=^%stripF%>>%ini%
:packEXE
set "writePack=no"
if %packINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Pack compiled files?
echo. 1 = Yes
echo. 2 = No [recommended]
echo.
echo. Attention: Some security applications may detect packed binaries as malware.
echo. Increases delay on runtime during which files need to be unpacked.
echo. Makes binaries smaller at a big time cost after compiling and on runtime.
echo.
echo. If distributing the files, consider packing them with 7-zip instead.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P packF="Pack files: "
) else set packF=%packINI%
if %deleteINI%==1 set "writePack=yes"
if %packF%==1 set "packFile=y"
if %packF%==2 set "packFile=n"
if %packF% GTR 2 GOTO packEXE
if %writePack%==yes echo.pack=^%packF%>>%ini%
:logging
set "writeLogging=no"
if %loggingINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Write logs of compilation commands?
echo. 1 = Yes [recommended]
echo. 2 = No
echo.
echo Note: Setting this to yes will also hide output from these commands.
echo On successful compilation, these logs are deleted since they aren't needed.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P loggingF="Write logs: "
) else set loggingF=%loggingINI%
if %deleteINI%==1 set "writeLogging=yes"
if %loggingF%==1 set "logging=y"
if %loggingF%==2 set "logging=n"
if %loggingF% GTR 2 GOTO logging
if %writeLogging%==yes echo.logging=^%loggingF%>>%ini%
:updateSuite
set "writeUpdateSuite=no"
if %updateSuiteINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Create script to update suite files automatically?
echo. 1 = Yes
echo. 2 = No
echo.
echo If you have made changes to the scripts, they will be reset but saved to a
echo .diff text file inside %build%
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P updateSuiteF="Create update script: "
) else set updateSuiteF=%updateSuiteINI%
if %deleteINI%==1 set "writeUpdateSuite=yes"
if %updateSuiteF%==1 set "updateSuite=y"
if %updateSuiteF%==2 set "updateSuite=n"
if %updateSuiteF% GTR 2 GOTO updateSuite
if %writeUpdateSuite%==yes echo.updateSuite=^%updateSuiteF%>>%ini%
::------------------------------------------------------------------
::download and install basic msys2 system:
::------------------------------------------------------------------
if exist "%instdir%\%msys2%\usr\bin\wget.exe" GOTO getMintty
echo -------------------------------------------------------------
echo.
echo - Download wget
echo.
echo -------------------------------------------------------------
if exist %build%\install-wget.js del %build%\install-wget.js
cd build
if exist %build%\msys2-base.tar.xz GOTO unpack
if exist %build%\wget.exe if exist %build%\7za.exe if exist %build%\grep.exe GOTO checkmsys2
if not exist %build%\wget.exe (
if exist wget-pack.exe del wget-pack.exe
(
echo./*from http://superuser.com/a/536400*/
echo.var r=new ActiveXObject("WinHttp.WinHttpRequest.5.1"^);
echo.r.Open("GET",WScript.Arguments(0^),false^);r.Send(^);
echo.b=new ActiveXObject("ADODB.Stream"^);
echo.b.Type=1;b.Open(^);b.Write(r.ResponseBody^);
echo.b.SaveToFile(WScript.Arguments(1^)^);
)>wget.js
cscript /nologo wget.js https://i.fsbn.eu/pub/wget-pack.exe wget-pack.exe
%build%\wget-pack.exe x
)
if not exist %build%\wget.exe (
echo -------------------------------------------------------------------------------
echo Script to download necessary components failed.
echo.
echo Download and extract this manually to inside "%build%":
echo https://i.fsbn.eu/pub/wget-pack.exe
echo -------------------------------------------------------------------------------
pause
exit
) else (
del wget.js wget-pack.exe 2>nul
)
:checkmsys2
if exist "%instdir%\%msys2%\msys2_shell.cmd" GOTO getMintty
echo -------------------------------------------------------------------------------
echo.
echo.- Download and install msys2 basic system
echo.
echo -------------------------------------------------------------------------------
if %msys2%==msys32 (
set "msysprefix=i686"
) else set "msysprefix=x86_64"
wget --tries=5 --retry-connrefused --waitretry=5 --continue -O msys2-base.tar.xz ^
"http://repo.msys2.org/distrib/msys2-%msysprefix%-latest.tar.xz"
:unpack
if exist %build%\msys2-base.tar.xz (
%build%\7za.exe x msys2-base.tar.xz -so | %build%\7za.exe x -aoa -si -ttar -o..
del %build%\msys2-base.tar.xz
)
if not exist %instdir%\%msys2%\usr\bin\msys-2.0.dll (
echo -------------------------------------------------------------------------------
echo.
echo.- Download msys2 basic system failed,
echo.- please download it manually from:
echo.- http://repo.msys2.org/distrib/
echo.- and copy the uncompressed folder to:
echo.- %build%
echo.- and start the batch script again!
echo.
echo -------------------------------------------------------------------------------
pause
GOTO unpack
)
:getMintty
set "mintty=start /I /WAIT %instdir%\%msys2%\usr\bin\mintty.exe -d -i /msys2.ico"
if not exist %instdir%\mintty.lnk (
if %msys2%==msys32 (
echo.-------------------------------------------------------------------------------
echo.rebase %msys2% system
echo.-------------------------------------------------------------------------------
call %instdir%\%msys2%\autorebase.bat
)
echo -------------------------------------------------------------------------------
echo.- make a first run
echo -------------------------------------------------------------------------------
if exist %build%\firstrun.log del %build%\firstrun.log
%mintty% --log 2>&1 %build%\firstrun.log /usr/bin/bash --login -c exit