forked from m-ab-s/media-autobuild_suite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
media-autobuild_suite.bat
1351 lines (1245 loc) · 50.3 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/>.
::-------------------------------------------------------------------------------------
::-------------------------------------------------------------------------------------
::
:: This is version 3.3
:: See HISTORY file for more information
::
::-------------------------------------------------------------------------------------
@echo off
color 80
title media-autobuild_suite
set instdir=%CD%
set "ini=media-autobuild_suite.ini"
set msyspackages=asciidoc autoconf autoconf2.13 automake-wrapper automake1.10 automake1.11 automake1.12 automake1.13 ^
automake1.14 automake1.6 automake1.7 automake1.8 automake1.9 autogen bison diffstat diffutils dos2unix help2man ^
intltool libtool patch python scons xmlto make tar zip unzip git subversion wget p7zip mercurial ruby man-db ^
pkg-config gperf winpty-git
set mingwpackages=boost cmake crt-git dlfcn doxygen gcc gcc-ada gcc-fortran gcc-libgfortran gcc-libs gcc-objc ^
gettext glew gmp gsm headers-git jasper lame lcms2 libcddb libcdio libgpg-error libiconv libjpeg-turbo libmodplug ^
libpng libtiff mpc nasm pcre ragel schroedinger sqlite3 tools-git winpthreads-git xvidcore yasm python2-lxml ninja
set ffmpeg_options=--enable-librtmp --enable-gnutls --enable-frei0r --enable-libbluray --enable-libcaca ^
--enable-libopenjpeg --enable-libass --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame ^
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger ^
--enable-libsoxr --enable-libtwolame --enable-libspeex --enable-libtheora --enable-libvorbis ^
--enable-libvo-aacenc --enable-libopus --enable-libvidstab --enable-libxavs --enable-libxvid ^
--enable-libzvbi --enable-libdcadec --enable-libbs2b --enable-libmfx --enable-libcdio --enable-libfreetype ^
--enable-fontconfig --enable-libfribidi --enable-opengl --enable-libvpx --enable-libx264 --enable-libx265 ^
--enable-libkvazaar ^
--enable-libwebp ^
--enable-decklink --enable-libutvideo --enable-libgme ^
--enable-nonfree --enable-nvenc --enable-libfdk-aac --enable-openssl
:selectmsys2Arch
if exist %ini% GOTO checkINI
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Select the msys2 system:
echo. 1 = 32 bit msys2
echo. 2 = 64 bit msys2 [recommended]
echo.
echo. Choose the same as your operating system.
echo.
echo. If you make a mistake, delete the media-autobuild_suite.ini file
echo. and re-run this file.
echo.
echo. These questions should only be asked once.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P msys2Arch="msys2 system: "
if %msys2Arch% GTR 2 GOTO selectmsys2Arch
echo.[compiler list]>%ini%
echo.msys2Arch=^%msys2Arch%>>%ini%
set msys2ArchINI=%msys2Arch%
set archINI=0
set freeINI=0
set vpxINI=0
set x264INI=0
set x265INI=0
set other265INI=0
set flacINI=0
set mediainfoINI=0
set soxINI=0
set ffmpegINI=0
set ffmpegUpdateINI=0
set ffmpegChoiceINI=0
set mp4boxINI=0
set mplayerINI=0
set mpvINI=0
set coresINI=0
set deleteSourceINI=0
set stripINI=0
set packINI=0
GOTO systemVars
:checkINI
findstr /i "msys2Arch" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "arch" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "free" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "vpx" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "x264" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "x265" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "other265" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "flac" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "mediainfo" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "soxB" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "ffmpegB" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "ffmpegUpdate" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "ffmpegChoice" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "mp4box" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "mplayer" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "mpv" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "cores" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "deleteSource" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "strip" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
findstr /i "pack" %ini% > nul
if ERRORLEVEL 1 del %ini% && GOTO selectmsys2Arch
:readINI
for /F "tokens=2 delims==" %%a in ('findstr /i "msys2Arch" %ini%') do set msys2ArchINI=%%a
for /F "tokens=2 delims==" %%j in ('findstr /i "arch" %ini%') do set archINI=%%j
for /F "tokens=2 delims==" %%b in ('findstr /i "free" %ini%') do set freeINI=%%b
for /F "tokens=2 delims==" %%f in ('findstr /i "vpx" %ini%') do set vpxINI=%%f
for /F "tokens=2 delims==" %%f in ('findstr /i "x264" %ini%') do set x264INI=%%f
for /F "tokens=2 delims==" %%f in ('findstr /i "x265" %ini%') do set x265INI=%%f
for /F "tokens=2 delims==" %%f in ('findstr /i "other265" %ini%') do set other265INI=%%f
for /F "tokens=2 delims==" %%f in ('findstr /i "flac" %ini%') do set flacINI=%%f
for /F "tokens=2 delims==" %%f in ('findstr /i "mediainfo" %ini%') do set mediainfoINI=%%f
for /F "tokens=2 delims==" %%f in ('findstr /i "soxB" %ini%') do set soxINI=%%f
for /F "tokens=2 delims==" %%f in ('findstr /i "ffmpegB" %ini%') do set ffmpegINI=%%f
for /F "tokens=2 delims==" %%c in ('findstr /i "ffmpegUpdate" %ini%') do set ffmpegUpdateINI=%%c
for /F "tokens=2 delims==" %%c in ('findstr /i "ffmpegChoice" %ini%') do set ffmpegChoiceINI=%%c
for /F "tokens=2 delims==" %%d in ('findstr /i "mp4box" %ini%') do set mp4boxINI=%%d
for /F "tokens=2 delims==" %%e in ('findstr /i "mplayer" %ini%') do set mplayerINI=%%e
for /F "tokens=2 delims==" %%l in ('findstr /i "mpv" %ini%') do set mpvINI=%%l
for /F "tokens=2 delims==" %%h in ('findstr /i "cores" %ini%') do set coresINI=%%h
for /F "tokens=2 delims==" %%i in ('findstr /i "deleteSource" %ini%') do set deleteSourceINI=%%i
for /F "tokens=2 delims==" %%k in ('findstr /i "strip" %ini%') do set stripINI=%%k
for /F "tokens=2 delims==" %%g in ('findstr /i "pack" %ini%') do set packINI=%%g
: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: "
set "writeArch=yes"
) else (
set buildEnv=%archINI%
)
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%
:selectNonFree
set "writeFree=no"
if %freeINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Include non-free libraries [like fdkaac and faac]?
echo. 1 = Yes
echo. 2 = No
echo. [you will not be able to redistribute binaries including these]
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P nonfree="Non-free binaries: "
set "writeFree=yes"
) else (
set nonfree=%freeINI%
)
if %nonfree%==1 (
set "binary=y"
)
if %nonfree%==2 (
set "binary=n"
)
if %nonfree% GTR 2 GOTO selectNonFree
if %writeFree%==yes echo.free=^%nonfree%>>%ini%
:vpx
set "writevpx=no"
if %vpxINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build vpx [VP8/VP9 encoder] binary?
echo. 1 = Yes [static]
echo. 2 = Build library only
echo. 3 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildvpx="Build vpx: "
set "writevpx=yes"
) else (
set buildvpx=%vpxINI%
)
if %buildvpx%==1 (
set "vpx=y"
)
if %buildvpx%==2 (
set "vpx=l"
)
if %buildvpx%==3 (
set "vpx=n"
)
if %buildvpx% GTR 3 GOTO vpx
if %writevpx%==yes echo.vpx=^%buildvpx%>>%ini%
:x264
set "writex264=no"
if %x264INI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build x264 [H.264 encoder] binary?
echo. 1 = Yes [static]
echo. 2 = Build library only
echo. 3 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildx264="Build x264: "
set "writex264=yes"
) else (
set buildx264=%x264INI%
)
if %buildx264%==1 (
set "x264=y"
)
if %buildx264%==2 (
set "x264=l"
)
if %buildx264%==3 (
set "x264=n"
)
if %buildx264% GTR 3 GOTO x264
if %writex264%==yes echo.x264=^%buildx264%>>%ini%
:x265
set "writex265=no"
if %x265INI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build x265 [H.265 encoder]?
echo. 1 = Static x265.exe and library with Main, Main10 and Main12 included
echo. 2 = Static library only with Main, Main10 and Main12 included
echo. 3 = No
echo. 4 = Static x265.exe [Main] and libx265_main10.dll
echo. 5 = Same as 1 with XP compatibility
echo. 6 = Same as 2 with XP compatibility
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildx265="Build x265: "
set "writex265=yes"
) else (
set buildx265=%x265INI%
)
if %buildx265%==1 (
set "x265=y"
)
if %buildx265%==2 (
set "x265=l"
)
if %buildx265%==3 (
set "x265=n"
)
if %buildx265%==4 (
set "x265=s"
)
if %buildx265%==5 (
set "x265=y"
set "xpcomp=y"
)
if %buildx265%==6 (
set "x265=l"
set "xpcomp=y"
)
if %buildx265% GTR 6 GOTO x265
if %writex265%==yes echo.x265=^%buildx265%>>%ini%
:other265
set "writeother265=no"
if %other265INI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build H.265 encoders other than x265?
echo. 1 = Yes [static]
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildother265="Build other265: "
set "writeother265=yes"
) else (
set buildother265=%other265INI%
)
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: "
set "writeflac=yes"
) else (
set buildflac=%flacINI%
)
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%
: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: "
set "writemediainfo=yes"
) else (
set buildmediainfo=%mediainfoINI%
)
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 %soxINI%==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: "
set "writesox=yes"
) else (
set buildsox=%soxINI%
)
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 %ffmpegINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FFmpeg binary:
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: "
set "writeFF=yes"
) else (
set buildffmpeg=%ffmpegINI%
)
if %buildffmpeg%==1 (
set "ffmpeg=y"
)
if %buildffmpeg%==2 (
set "ffmpeg=n"
)
if %buildffmpeg%==3 (
set "ffmpeg=s"
)
if %buildffmpeg%==4 (
set "ffmpeg=b"
)
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.
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: "
set "writeFFU=yes"
) else (
set buildffmpegUp=%ffmpegUpdateINI%
)
if %buildffmpegUp%==1 (
set "ffmpegUpdate=y"
)
if %buildffmpegUp%==2 (
set "ffmpegUpdate=n"
)
if %buildffmpegUp% GTR 2 GOTO ffmpegUp
if %writeFFU%==yes echo.ffmpegUpdate=^%buildffmpegUp%>>%ini%
:ffmpegChoice
set "writeFFC=no"
if %ffmpegChoiceINI%==0 (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Choose ffmpeg optional libraries?
echo. 1 = Yes
echo. 2 = No
echo.
echo. If you select yes, we will create a file with the default options
echo. we use with FFmpeg. You can remove any that you don't need.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildffmpegChoice="Choose ffmpeg optional libs: "
set "writeFFC=yes"
) else (
set buildffmpegChoice=%ffmpegChoiceINI%
)
if %buildffmpegChoice%==1 (
set "ffmpegChoice=y"
if not exist "%instdir%\build" ( mkdir "%instdir%/build" )
if not exist "%instdir%\build\ffmpeg_options.txt" (
for %%i in (%ffmpeg_options%) do echo.%%i>>"%instdir%\build\ffmpeg_options.txt"
echo -------------------------------------------------------------------------------
echo. File with default options has been created in
echo. %instdir%\build\ffmpeg_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 %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: "
set "writeMP4Box=yes"
) else (
set buildMp4box=%mp4boxINI%
)
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%
: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: "
set "writeMPlayer=yes"
) else (
set buildmplayer=%mplayerINI%
)
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.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildmpv="Build mpv: "
set "writeMPV=yes"
) else (
set buildmpv=%mpvINI%
)
if %buildmpv%==1 (
set "mpv=y"
)
if %buildmpv%==2 (
set "mpv=n"
)
if %buildmpv% GTR 2 GOTO mpv
if %writeMPV%==yes echo.mpv=^%buildmpv%>>%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: "
set "writeCores=yes"
) else (
set cpuCores=%coresINI%
)
for /l %%a in (1,1,%cpuCores%) do (
set cpuCount=%%a
)
if "%cpuCount%"=="" GOTO :numCores
if %writeCores%==yes echo.cores=^%cpuCount%>>%ini%
:delete
set "writeDel=no"
if %deleteSourceINI%==0 (
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: "
set "writeDel=yes"
) else (
set deleteS=%deleteSourceINI%
)
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: "
set "writeStrip=yes"
) else (
set stripF=%stripINI%
)
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. Makes binaries a lot smaller at a big time cost after compiling.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P packF="Pack files: "
set "writePack=yes"
) else (
set packF=%packINI%
)
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%
::------------------------------------------------------------------
::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 "%instdir%\build\install-wget.js" del "%instdir%\build\install-wget.js"
if not exist build mkdir build
cd build
if exist "%instdir%\build\msys2-base.tar.xz" GOTO unpack
echo.var wshell = new ActiveXObject("WScript.Shell"); var xmlhttp = new ActiveXObject("MSXML2.ServerXMLHTTP"); var adodb = new ActiveXObject("ADODB.Stream"); var FSO = new ActiveXObject("Scripting.FileSystemObject"); function http_get(url, is_binary) {xmlhttp.open("GET", url); xmlhttp.send(); WScript.echo("retrieving " + url); while (xmlhttp.readyState != 4); WScript.Sleep(10); if (xmlhttp.status != 200) {WScript.Echo("http get failed: " + xmlhttp.status); WScript.Quit(2)}; return is_binary ? xmlhttp.responseBody : xmlhttp.responseText}; function save_binary(path, data) {adodb.type = 1; adodb.open(); adodb.write(data); adodb.saveToFile(path, 2)}; function download_wget() {var base_url = "http://blog.pixelcrusher.de/downloads/media-autobuild_suite/wget.zip"; var filename = "wget.zip"; var installer_data = http_get(base_url, true); save_binary(filename, installer_data); return FSO.GetAbsolutePathName(filename)}; function extract_zip(zip_file, dstdir) {var shell = new ActiveXObject("shell.application"); var dst = shell.NameSpace(dstdir); var zipdir = shell.NameSpace(zip_file); dst.CopyHere(zipdir.items(), 0)}; function install_wget(zip_file) {var rootdir = wshell.CurrentDirectory; extract_zip(zip_file, rootdir)}; install_wget(download_wget())>>install-wget.js
cscript install-wget.js
del install-wget.js
del wget.zip
del 7zip-license.txt
del COPYING.txt
:checkmsys2
if %msys2%==msys32 (
if exist "%instdir%\%msys2%\msys2_shell.bat" GOTO getMintty
echo -------------------------------------------------------------------------------
echo.
echo.- Download and install msys2 basic system
echo.
echo -------------------------------------------------------------------------------
for /F %%b in ( '%instdir%\build\wget -qO- http://sourceforge.net/projects/msys2/files/Base/i686/ ^| %instdir%\build\grep -o -P "(?<=tr title=).*(?<=class=)" ^| %instdir%\build\grep -m 1 -o "msys2-base-i686-*.*tar.xz"' ) do %instdir%\build\wget --tries=20 --retry-connrefused --waitretry=2 -c -O msys2-base.tar.xz http://sourceforge.net/projects/msys2/files/Base/i686/%%b/download
)
if %msys2%==msys64 (
if exist "%instdir%\%msys2%\msys2_shell.bat" GOTO getMintty
echo -------------------------------------------------------------------------------
echo.
echo.- Download and install msys2 basic system
echo.
echo -------------------------------------------------------------------------------
for /F %%b in ( '%instdir%\build\wget -qO- http://sourceforge.net/projects/msys2/files/Base/x86_64/ ^| %instdir%\build\grep -o -P "(?<=tr title=).*(?<=class=)" ^| %instdir%\build\grep -m 1 -o "msys2-base-x86_64-*.*tar.xz"' ) do %instdir%\build\wget --tries=20 --retry-connrefused --waitretry=2 -c -O msys2-base.tar.xz http://sourceforge.net/projects/msys2/files/Base/x86_64/%%b/download
)
:unpack
if exist "%instdir%\build\msys2-base.tar.xz" (
%instdir%\build\7za.exe x msys2-base.tar.xz -so | %instdir%\build\7za.exe x -aoa -si -ttar -o..
del %instdir%\build\msys2-base.tar.xz
del %instdir%\build\grep.exe
del %instdir%\build\wget.exe
del %instdir%\build\7za.exe
)
if not exist %instdir%\%msys2%\usr\bin\msys-2.0.dll (
echo -------------------------------------------------------------------------------
echo.
echo.- Download msys2 basic system failed,
echo.- please download it manuel from:
echo.- http://downloads.sourceforge.net/project/msys2
echo.- and copy the uncompressed folder to:
echo.- %instdir%\build
echo.- and start the batch script again!
echo.
echo -------------------------------------------------------------------------------
pause
GOTO unpack
)
:getMintty
if not exist %instdir%\mintty.lnk (
echo -------------------------------------------------------------------------------
echo.
echo.- make a first run
echo.
echo -------------------------------------------------------------------------------
echo.sleep ^4>>firstrun.sh
echo.exit>>firstrun.sh
%instdir%\%msys2%\usr\bin\mintty.exe -i /msys2.ico /usr/bin/bash --login %instdir%\firstrun.sh
del firstrun.sh
echo.-------------------------------------------------------------------------------
echo.first update
echo.-------------------------------------------------------------------------------
if exist %instdir%\firstUpdate.sh del %instdir%\firstUpdate.sh
(
echo.echo -ne "\033]0;first msys2 update\007"
echo.pacman --noconfirm --force -Sy --asdeps pacman-mirrors
echo.sleep ^4
echo.exit
)>>%instdir%\firstUpdate.sh
%instdir%\%msys2%\usr\bin\mintty.exe -i /msys2.ico /usr/bin/bash --login %instdir%\firstUpdate.sh
del %instdir%\firstUpdate.sh
echo.-------------------------------------------------------------------------------
echo.second update
echo.-------------------------------------------------------------------------------
if exist %instdir%\secondUpdate.sh del %instdir%\secondUpdate.sh
(
echo.echo -ne "\033]0;second msys2 update\007"
echo.pacman --noconfirm -Syu --force --asdeps --ignoregroup base
echo.pacman --noconfirm -Su --force --asdeps
echo.exit
)>>%instdir%\secondUpdate.sh
%instdir%\%msys2%\usr\bin\mintty.exe -i /msys2.ico /usr/bin/bash --login %instdir%\secondUpdate.sh
cls
del %instdir%\secondUpdate.sh
(
echo.Set Shell = CreateObject^("WScript.Shell"^)
echo.Set link = Shell.CreateShortcut^("%instdir%\mintty.lnk"^)
echo.link.Arguments = "-i /msys2.ico /usr/bin/bash --login"
echo.link.Description = "msys2 shell console"
echo.link.TargetPath = "%instdir%\%msys2%\usr\bin\mintty.exe"
echo.link.WindowStyle = ^1
echo.link.IconLocation = "%instdir%\%msys2%\msys2.ico"
echo.link.WorkingDirectory = "%instdir%\%msys2%\usr\bin"
echo.link.Save
)>>%instdir%\setlink.vbs
cscript /nologo %instdir%\setlink.vbs
del %instdir%\setlink.vbs
)
if exist %instdir%\%msys2%\home\%USERNAME%\.minttyrc GOTO hgsettings
if not exist %instdir%\%msys2%\home\%USERNAME% mkdir %instdir%\%msys2%\home\%USERNAME%
(
echo.BoldAsFont=no
echo.BackgroundColour=57,57,57
echo.ForegroundColour=221,221,221
echo.Transparency=medium
echo.FontHeight=^9
echo.FontSmoothing=full
echo.AllowBlinking=yes
echo.Font=DejaVu Sans Mono
echo.Columns=120
echo.Rows=30
echo.Term=xterm-256color
echo.CursorType=block
echo.ClicksPlaceCursor=yes
echo.Black=38,39,41
echo.Red=249,38,113
echo.Green=166,226,46
echo.Yellow=253,151,31
echo.Blue=102,217,239
echo.Magenta=158,111,254
echo.Cyan=94,113,117
echo.White=248,248,242
echo.BoldBlack=85,68,68
echo.BoldRed=249,38,113
echo.BoldGreen=166,226,46
echo.BoldYellow=253,151,31
echo.BoldBlue=102,217,239
echo.BoldMagenta=158,111,254
echo.BoldCyan=163,186,191
echo.BoldWhite=248,248,242
)>>%instdir%\%msys2%\home\%USERNAME%\.minttyrc
:hgsettings
if exist %instdir%\%msys2%\home\%USERNAME%\.hgrc GOTO gitsettings
(
echo.[ui]
echo.username = %USERNAME%
echo.verbose = True
echo.editor = vim
echo.
echo.[web]
echo.cacerts=/usr/ssl/cert.pem
echo.
echo.[extensions]
echo.color =
echo.
echo.[color]
echo.status.modified = magenta bold
echo.status.added = green bold
echo.status.removed = red bold
echo.status.deleted = cyan bold
echo.status.unknown = blue bold
echo.status.ignored = black bold
)>>%instdir%\%msys2%\home\%USERNAME%\.hgrc
:gitsettings
if exist %instdir%\%msys2%\home\%USERNAME%\.gitconfig GOTO rebase
(
echo.[user]
echo.name = %USERNAME%
echo.email = %USERNAME%@%COMPUTERNAME%
echo.
echo.[color]
echo.ui = true
echo.
echo.[core]
echo.editor = vim
echo.autocrlf =
echo.
echo.[merge]
echo.tool = vimdiff
echo.
echo.[push]
echo.default = simple
)>>%instdir%\%msys2%\home\%USERNAME%\.gitconfig
:rebase
if %msys2%==msys32 (
echo.-------------------------------------------------------------------------------
echo.rebase msys32 system
echo.-------------------------------------------------------------------------------
call %instdir%\msys32\autorebase.bat
)
:installbase
if exist "%instdir%\%msys2%\etc\pac-base.pk" del "%instdir%\%msys2%\etc\pac-base.pk"
for %%i in (%msyspackages%) do echo.%%i>>%instdir%\%msys2%\etc\pac-base.pk
if exist %instdir%\%msys2%\usr\bin\make.exe GOTO sethgBat
echo.-------------------------------------------------------------------------------
echo.install msys2 base system
echo.-------------------------------------------------------------------------------
if exist %instdir%\pacman.sh del %instdir%\pacman.sh
(
echo.echo -ne "\033]0;install base system\007"
echo.pacman --noconfirm -S $(cat /etc/pac-base.pk ^| sed -e 's#\\##'^)
echo.sleep ^3
echo.exit
)>>%instdir%\pacman.sh
%instdir%\%msys2%\usr\bin\mintty.exe -i /msys2.ico /usr/bin/bash --login %instdir%\pacman.sh
del %instdir%\pacman.sh
for %%i in (%instdir%\%msys2%\usr\ssl\cert.pem) do (
if %%~zi==0 (
echo.update-ca-trust>>cert.sh
echo.sleep ^3>>cert.sh
echo.exit>>cert.sh
%instdir%\%msys2%\usr\bin\mintty.exe -i /msys2.ico /usr/bin/bash --login %instdir%\cert.sh
del cert.sh
)
)
:sethgBat
if exist %instdir%\%msys2%\usr\bin\hg.bat GOTO getmingw32
(
echo.@echo off
echo.
echo.setlocal
echo.set HG=^%%~f0
echo.
echo.set PYTHONHOME=
echo.set in=^%%*