media-autobuild_suite.bat 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868
  1. @echo off
  2. rem -----------------------------------------------------------------------------
  3. rem LICENSE --------------------------------------------------------------------
  4. rem -----------------------------------------------------------------------------
  5. rem This Windows Batchscript is for setup a compiler environment for building
  6. rem ffmpeg and other media tools under Windows.
  7. rem
  8. rem Copyright (C) 2013 jb_alvarado
  9. rem
  10. rem This program is free software: you can redistribute it and/or modify
  11. rem it under the terms of the GNU General Public License as published by
  12. rem the Free Software Foundation, either version 3 of the License, or
  13. rem (at your option) any later version.
  14. rem
  15. rem This program is distributed in the hope that it will be useful,
  16. rem but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. rem GNU General Public License for more details.
  19. rem
  20. rem You should have received a copy of the GNU General Public License
  21. rem along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. rem -----------------------------------------------------------------------------
  23. color 70
  24. title media-autobuild_suite
  25. setlocal
  26. chcp 65001 >nul 2>&1
  27. cd /d "%~dp0"
  28. set "TERM=xterm-256color"
  29. setlocal
  30. set instdir=%CD%
  31. if %PROCESSOR_ARCHITECTURE%==x86 if NOT DEFINED PROCESSOR_ARCHITEW6432 (
  32. echo ----------------------------------------------------------------------
  33. echo. 32-bit host machine and OS are no longer supported by the suite
  34. echo. nor upstream for building.
  35. echo. Please consider either moving to a 64-bit machine and OS or use
  36. echo. a 64-bit machine to compile the binaries you need.
  37. pause
  38. exit
  39. )
  40. if not exist %instdir% (
  41. echo ----------------------------------------------------------------------
  42. echo. You have probably run the script in a path with spaces.
  43. echo. This is not supported.
  44. echo. Please move the script to use a path without spaces. Example:
  45. echo. Incorrect: C:\build suite\
  46. echo. Correct: C:\build_suite\
  47. pause
  48. exit
  49. )
  50. if not ["%instdir:~32,1%"]==[""] (
  51. echo -------------------------------------------------------------------------------
  52. echo. The total filepath to the suite seems too large (larger than 32 characters^):
  53. echo. %instdir%
  54. echo. Some packages might fail building because of it.
  55. echo. Please move the suite directory closer to the root of your drive and maybe
  56. echo. rename the suite directory to a smaller name. Examples:
  57. echo. Avoid: C:\Users\Administrator\Desktop\testing\media-autobuild_suite-master
  58. echo. Prefer: C:\media-autobuild_suite
  59. echo. Prefer: C:\ab-suite
  60. pause
  61. )
  62. for /f "usebackq tokens=*" %%f in (`powershell -noprofile -command $PSVersionTable.PSVersion.Major`) ^
  63. do if %%f lss 4 (
  64. echo ----------------------------------------------------------------------
  65. echo. You do not have a powershell version greater than 4.
  66. echo. This is not supported.
  67. echo. Please upgrade your powershell either through downloading and installing WMF 5.1
  68. echo. https://docs.microsoft.com/en-us/powershell/wmf/5.1/install-configure
  69. echo. or by upgrading your OS.
  70. echo. This is not Powershell Core. That is separate.
  71. pause
  72. exit
  73. )
  74. (
  75. where lib.exe || ^
  76. where cl.exe || ^
  77. if DEFINED VSINSTALLDIR cd .
  78. ) >nul 2>&1 && (
  79. rem MSVCINSTALLED
  80. echo ----------------------------------------------------------------------
  81. echo. You are running in a MSVC environment (cl.exe or lib.exe detected^)
  82. echo. This is not supported.
  83. echo. Please run the script through a normal cmd.exe some other way.
  84. echo.
  85. echo. Detected Paths:
  86. where lib.exe 2>nul
  87. where cl.exe 2>nul
  88. echo %VSINSTALLDIR%
  89. pause
  90. exit
  91. )
  92. set build=%instdir%\build
  93. if not exist %build% mkdir %build%
  94. set msyspackages=asciidoc autoconf automake-wrapper autogen base bison diffstat dos2unix filesystem help2man ^
  95. intltool libtool patch python xmlto make zip unzip git subversion wget p7zip man-db ^
  96. gperf winpty texinfo gyp-git doxygen autoconf-archive itstool ruby mintty flex
  97. set mingwpackages=cmake dlfcn libpng gcc nasm pcre tools-git yasm ninja pkg-config meson ccache jq ^
  98. clang
  99. :: built-ins
  100. set ffmpeg_options_builtin=--disable-autodetect amf bzlib cuda cuvid d3d11va dxva2 ^
  101. iconv lzma nvenc schannel zlib sdl2 ffnvcodec nvdec cuda-llvm
  102. :: common external libs
  103. set ffmpeg_options_basic=gmp libmp3lame libopus libvorbis libvpx libx264 libx265 ^
  104. libdav1d libaom --disable-debug libfdk-aac
  105. :: options used in zeranoe builds and not present above
  106. set ffmpeg_options_zeranoe=fontconfig gnutls libass libbluray libfreetype ^
  107. libmfx libmysofa libopencore-amrnb libopencore-amrwb libopenjpeg libsnappy ^
  108. libsoxr libspeex libtheora libtwolame libvidstab libvo-amrwbenc ^
  109. libwebp libxml2 libzimg libshine gpl openssl libtls avisynth mbedtls libxvid ^
  110. libopenmpt version3 librav1e libsrt libgsm libvmaf libsvtav1
  111. :: options also available with the suite
  112. set ffmpeg_options_full=chromaprint decklink frei0r libbs2b libcaca ^
  113. libcdio libflite libfribidi libgme libilbc libsvthevc ^
  114. libsvtvp9 libkvazaar libmodplug librtmp librubberband #libssh libtesseract libxavs ^
  115. libzmq libzvbi openal libcodec2 ladspa #vapoursynth #liblensfun ^
  116. libglslang vulkan libdavs2 libxavs2 libuavs3d
  117. :: options also available with the suite that add shared dependencies
  118. set ffmpeg_options_full_shared=opencl opengl cuda-nvcc libnpp libopenh264
  119. :: built-ins
  120. set mpv_options_builtin=#cplayer #manpage-build #lua #javascript ^
  121. #libbluray #uchardet #rubberband #lcms2 #libarchive #libavdevice ^
  122. #shaderc #spirv-cross #d3d11 #jpeg #vapoursynth #vulkan #libplacebo
  123. :: overriden defaults
  124. set mpv_options_basic=--disable-debug-build "--lua=luajit"
  125. :: all supported options
  126. set mpv_options_full=dvdnav cdda #egl-angle #html-build ^
  127. #pdf-build libmpv-shared openal sdl2 #sdl2-gamepad #sdl2-audio #sdl2-video
  128. set iniOptions=arch license2 vpx2 x2643 x2652 other265 flac fdkaac mediainfo ^
  129. soxB ffmpegB2 ffmpegUpdate ffmpegChoice mp4box rtmpdump mplayer2 mpv cores deleteSource ^
  130. strip pack logging bmx standalone updateSuite aom faac exhale ffmbc curl cyanrip2 redshift ^
  131. rav1e ripgrep dav1d libavif vvc jq dssim avs2 timeStamp noMintty ccache svthevc svtav1 svtvp9 xvc ^
  132. jo vlc CC jpegxl
  133. set deleteIni=0
  134. set ini=%build%\media-autobuild_suite.ini
  135. rem Set all INI options to 0
  136. for %%a in (%iniOptions%) do set %%aINI=0
  137. if exist %ini% (
  138. rem Set INI options to what's found in the inifile
  139. for %%a in (%iniOptions%) do for /F "tokens=2 delims==" %%b in ('findstr %%a %ini%') do set %%aINI=%%b
  140. ) else set deleteIni=1
  141. setlocal EnableDelayedExpansion
  142. rem Check if any of the *INI options are still unset (0)
  143. for %%a in (%iniOptions%) do if [!%%aINI!]==[0] set deleteIni=1 && goto :endINIcheck
  144. :endINIcheck
  145. endlocal & set deleteIni=%deleteIni%
  146. if %deleteINI%==1 echo.[compiler list] >"%ini%"
  147. :selectSystem
  148. if %archINI%==0 (
  149. echo -------------------------------------------------------------------------------
  150. echo -------------------------------------------------------------------------------
  151. echo.
  152. echo. Select the build target system:
  153. echo. 1 = both [32 bit and 64 bit]
  154. echo. 2 = 32 bit build system
  155. echo. 3 = 64 bit build system
  156. echo.
  157. echo -------------------------------------------------------------------------------
  158. echo -------------------------------------------------------------------------------
  159. set /P buildEnv="Build System: "
  160. ) else set buildEnv=%archINI%
  161. if "%buildEnv%"=="" GOTO selectSystem
  162. if %buildEnv%==1 set "build32=yes" && set "build64=yes"
  163. if %buildEnv%==2 set "build32=yes" && set "build64=no"
  164. if %buildEnv%==3 set "build32=no" && set "build64=yes"
  165. if %buildEnv% GTR 3 GOTO selectSystem
  166. if %deleteINI%==1 echo.arch=^%buildEnv%>>%ini%
  167. :ffmpeglicense
  168. if %license2INI%==0 (
  169. echo -------------------------------------------------------------------------------
  170. echo -------------------------------------------------------------------------------
  171. echo.
  172. echo. Build FFmpeg with which license?
  173. echo. 1 = Non-free [unredistributable, but can include anything]
  174. echo. 2 = GPLv3 [disables OpenSSL and FDK-AAC]
  175. echo. 3 = GPLv2.1
  176. echo. [Same disables as GPLv3 with addition of gmp, opencore codecs]
  177. echo. 4 = LGPLv3
  178. echo. [Disables x264, x265, XviD, GPL filters, etc.
  179. echo. but reenables OpenSSL/FDK-AAC]
  180. echo. 5 = LGPLv2.1 [same disables as LGPLv3 + GPLv2.1]
  181. echo.
  182. echo. If building for yourself, it's OK to choose non-free.
  183. echo. If building to redistribute online, choose GPL or LGPL.
  184. echo. If building to include in a GPLv2.1 binary, choose LGPLv2.1 or GPLv2.1.
  185. echo. If you want to use FFmpeg together with closed source software, choose LGPL
  186. echo. and follow instructions in https://www.ffmpeg.org/legal.html
  187. echo.
  188. echo. OpenSSL and FDK-AAC have licenses incompatible with GPL but compatible
  189. echo. with LGPL, so they won't be disabled automatically if you choose LGPL.
  190. echo.
  191. echo -------------------------------------------------------------------------------
  192. echo -------------------------------------------------------------------------------
  193. set /P ffmpegLicense="FFmpeg license: "
  194. ) else set ffmpegLicense=%license2INI%
  195. if "%ffmpegLicense%"=="" GOTO ffmpeglicense
  196. if %ffmpegLicense%==1 set "license2=nonfree"
  197. if %ffmpegLicense%==2 set "license2=gplv3"
  198. if %ffmpegLicense%==3 set "license2=gpl"
  199. if %ffmpegLicense%==4 set "license2=lgplv3"
  200. if %ffmpegLicense%==5 set "license2=lgpl"
  201. if %ffmpegLicense% GTR 5 GOTO ffmpeglicense
  202. if %deleteINI%==1 echo.license2=^%ffmpegLicense%>>%ini%
  203. :standalone
  204. if %standaloneINI%==0 (
  205. echo -------------------------------------------------------------------------------
  206. echo -------------------------------------------------------------------------------
  207. echo.
  208. echo. Build standalone binaries for libraries included in FFmpeg?
  209. echo. eg. Compile opusenc.exe if --enable-libopus
  210. echo. 1 = Yes
  211. echo. 2 = No
  212. echo.
  213. echo -------------------------------------------------------------------------------
  214. echo -------------------------------------------------------------------------------
  215. set /P buildstandalone="Build standalone binaries: "
  216. ) else set buildstandalone=%standaloneINI%
  217. if "%buildstandalone%"=="" GOTO standalone
  218. if %buildstandalone%==1 set "standalone=y"
  219. if %buildstandalone%==2 set "standalone=n"
  220. if %buildstandalone% GTR 2 GOTO standalone
  221. if %deleteINI%==1 echo.standalone=^%buildstandalone%>>%ini%
  222. :vpx
  223. if %vpx2INI%==0 (
  224. echo -------------------------------------------------------------------------------
  225. echo -------------------------------------------------------------------------------
  226. echo.
  227. echo. Build vpx [VP8/VP9 encoder]?
  228. echo. 1 = Yes
  229. echo. 2 = No
  230. echo.
  231. echo. Binaries being built depends on "standalone=y"
  232. echo.
  233. echo -------------------------------------------------------------------------------
  234. echo -------------------------------------------------------------------------------
  235. set /P buildvpx="Build vpx: "
  236. ) else set buildvpx=%vpx2INI%
  237. if "%buildvpx%"=="" GOTO vpx
  238. if %buildvpx%==1 set "vpx2=y"
  239. if %buildvpx%==2 set "vpx2=n"
  240. if %buildvpx% GTR 2 GOTO vpx
  241. if %deleteINI%==1 echo.vpx2=^%buildvpx%>>%ini%
  242. :aom
  243. if %aomINI%==0 (
  244. echo -------------------------------------------------------------------------------
  245. echo -------------------------------------------------------------------------------
  246. echo.
  247. echo. Build aom [Alliance for Open Media codec]?
  248. echo. 1 = Yes
  249. echo. 2 = No
  250. echo.
  251. echo. Binaries being built depends on "standalone=y"
  252. echo.
  253. echo -------------------------------------------------------------------------------
  254. echo -------------------------------------------------------------------------------
  255. set /P buildaom="Build aom: "
  256. ) else set buildaom=%aomINI%
  257. if "%buildaom%"=="" GOTO aom
  258. if %buildaom%==1 set "aom=y"
  259. if %buildaom%==2 set "aom=n"
  260. if %buildaom% GTR 2 GOTO aom
  261. if %deleteINI%==1 echo.aom=^%buildaom%>>%ini%
  262. :rav1e
  263. if %rav1eINI%==0 (
  264. echo -------------------------------------------------------------------------------
  265. echo -------------------------------------------------------------------------------
  266. echo.
  267. echo. Build rav1e [Alternative, faster AV1 standalone encoder]?
  268. echo. 1 = Yes
  269. echo. 2 = No
  270. echo.
  271. echo -------------------------------------------------------------------------------
  272. echo -------------------------------------------------------------------------------
  273. set /P buildrav1e="Build rav1e: "
  274. ) else set buildrav1e=%rav1eINI%
  275. if "%buildrav1e%"=="" GOTO rav1e
  276. if %buildrav1e%==1 set "rav1e=y"
  277. if %buildrav1e%==2 set "rav1e=n"
  278. if %buildrav1e% GTR 2 GOTO rav1e
  279. if %deleteINI%==1 echo.rav1e=^%buildrav1e%>>%ini%
  280. :dav1d
  281. if %dav1dINI%==0 (
  282. echo -------------------------------------------------------------------------------
  283. echo -------------------------------------------------------------------------------
  284. echo.
  285. echo. Build dav1d [Alternative, faster AV1 decoder]?
  286. echo. 1 = Yes
  287. echo. 2 = No
  288. echo.
  289. echo. Binaries being built depends on "standalone=y" and are always static.
  290. echo.
  291. echo -------------------------------------------------------------------------------
  292. echo -------------------------------------------------------------------------------
  293. set /P builddav1d="Build dav1d: "
  294. ) else set builddav1d=%dav1dINI%
  295. if "%builddav1d%"=="" GOTO dav1d
  296. if %builddav1d%==1 set "dav1d=y"
  297. if %builddav1d%==2 set "dav1d=n"
  298. if %builddav1d% GTR 2 GOTO dav1d
  299. if %deleteINI%==1 echo.dav1d=^%builddav1d%>>%ini%
  300. :libavif
  301. if %libavifINI%==0 (
  302. echo -------------------------------------------------------------------------------
  303. echo -------------------------------------------------------------------------------
  304. echo.
  305. echo. Build libavif [AV1 image format encoder and decoder]?
  306. echo. 1 = Yes
  307. echo. 2 = No
  308. echo.
  309. echo. Binaries being built depends on "standalone=y" and are always static.
  310. echo. Will build aom, dav1d, and rav1e if not already previously enabled
  311. echo.
  312. echo -------------------------------------------------------------------------------
  313. echo -------------------------------------------------------------------------------
  314. set /P buildlibavif="Build libavif: "
  315. ) else set buildlibavif=%libavifINI%
  316. if "%buildlibavif%"=="" GOTO libavif
  317. if %buildlibavif%==1 set "libavif=y"
  318. if %buildlibavif%==2 set "libavif=n"
  319. if %buildlibavif% GTR 2 GOTO libavif
  320. if %deleteINI%==1 echo.libavif=^%buildlibavif%>>%ini%
  321. :jpegxl
  322. if %jpegxlINI%==0 (
  323. echo -------------------------------------------------------------------------------
  324. echo -------------------------------------------------------------------------------
  325. echo.
  326. echo. Build jpeg-xl tools [JPEG XL image format encoder and decoder]?
  327. echo. 1 = Yes
  328. echo. 2 = No
  329. echo.
  330. echo -------------------------------------------------------------------------------
  331. echo -------------------------------------------------------------------------------
  332. set /P buildjpegxl="Build jpegxl: "
  333. ) else set buildjpegxl=%jpegxlINI%
  334. if "%buildjpegxl%"=="" GOTO jpegxl
  335. if %buildjpegxl%==1 set "jpegxl=y"
  336. if %buildjpegxl%==2 set "jpegxl=n"
  337. if %buildjpegxl% GTR 2 GOTO jpegxl
  338. if %deleteINI%==1 echo.jpegxl=^%buildjpegxl%>>%ini%
  339. :x264
  340. if %x2643INI%==0 (
  341. echo -------------------------------------------------------------------------------
  342. echo -------------------------------------------------------------------------------
  343. echo.
  344. echo. Build x264 [H.264 encoder]?
  345. echo. 1 = Lib/binary with 8 and 10-bit
  346. echo. 2 = No
  347. echo. 3 = Lib/binary with only 10-bit
  348. echo. 4 = Lib/binary with 8 and 10-bit, and libavformat and ffms2
  349. echo. 5 = Shared lib/binary with 8 and 10-bit
  350. echo. 6 = Same as 4 with video codecs only (can reduce size by ~3MB^)
  351. echo. 7 = Lib/binary with only 8-bit
  352. echo.
  353. echo. Binaries being built depends on "standalone=y" and are always static.
  354. echo.
  355. echo -------------------------------------------------------------------------------
  356. echo -------------------------------------------------------------------------------
  357. set /P buildx264="Build x264: "
  358. ) else set buildx264=%x2643INI%
  359. if "%buildx264%"=="" GOTO x264
  360. if %buildx264%==1 set "x2643=yes"
  361. if %buildx264%==2 set "x2643=no"
  362. if %buildx264%==3 set "x2643=high"
  363. if %buildx264%==4 set "x2643=full"
  364. if %buildx264%==5 set "x2643=shared"
  365. if %buildx264%==6 set "x2643=fullv"
  366. if %buildx264%==7 set "x2643=o8"
  367. if %buildx264% GTR 7 GOTO x264
  368. if %deleteINI%==1 echo.x2643=^%buildx264%>>%ini%
  369. :x265
  370. if %x2652INI%==0 (
  371. echo -------------------------------------------------------------------------------
  372. echo -------------------------------------------------------------------------------
  373. echo.
  374. echo. Build x265 [H.265 encoder]?
  375. echo. 1 = Lib/binary with Main, Main10 and Main12
  376. echo. 2 = No
  377. echo. 3 = Lib/binary with Main10 only
  378. echo. 4 = Lib/binary with Main only
  379. echo. 5 = Lib/binary with Main, shared libs with Main10 and Main12
  380. echo. 6 = Same as 1 with XP support and non-XP compatible x265-numa.exe
  381. echo. 7 = Lib/binary with Main12 only
  382. echo.
  383. echo. Binaries being built depends on "standalone=y"
  384. echo.
  385. echo -------------------------------------------------------------------------------
  386. echo -------------------------------------------------------------------------------
  387. set /P buildx265="Build x265: "
  388. ) else set buildx265=%x2652INI%
  389. if "%buildx265%"=="" GOTO x265
  390. if %buildx265%==1 set "x2652=y"
  391. if %buildx265%==2 set "x2652=n"
  392. if %buildx265%==3 set "x2652=o10"
  393. if %buildx265%==4 set "x2652=o8"
  394. if %buildx265%==5 set "x2652=s"
  395. if %buildx265%==6 set "x2652=d"
  396. if %buildx265%==7 set "x2652=o12"
  397. if %buildx265% GTR 7 GOTO x265
  398. if %deleteINI%==1 echo.x2652=^%buildx265%>>%ini%
  399. :other265
  400. if %other265INI%==0 (
  401. echo -------------------------------------------------------------------------------
  402. echo -------------------------------------------------------------------------------
  403. echo.
  404. echo. Build Kvazaar? [H.265 encoder]
  405. echo. 1 = Yes
  406. echo. 2 = No
  407. echo.
  408. echo -------------------------------------------------------------------------------
  409. echo -------------------------------------------------------------------------------
  410. set /P buildother265="Build kvazaar: "
  411. ) else set buildother265=%other265INI%
  412. if "%buildother265%"=="" GOTO other265
  413. if %buildother265%==1 set "other265=y"
  414. if %buildother265%==2 set "other265=n"
  415. if %buildother265% GTR 2 GOTO other265
  416. if %deleteINI%==1 echo.other265=^%buildother265%>>%ini%
  417. :svthevc
  418. if %svthevcINI%==0 (
  419. echo -------------------------------------------------------------------------------
  420. echo -------------------------------------------------------------------------------
  421. echo.
  422. echo. Build SVT-HEVC? [H.265 encoder]
  423. echo. 1 = Yes
  424. echo. 2 = No
  425. echo.
  426. echo -------------------------------------------------------------------------------
  427. echo -------------------------------------------------------------------------------
  428. set /P buildsvthevc="Build SVT-HEVC: "
  429. ) else set buildsvthevc=%svthevcINI%
  430. if "%buildsvthevc%"=="" GOTO svthevc
  431. if %buildsvthevc%==1 set "svthevc=y"
  432. if %buildsvthevc%==2 set "svthevc=n"
  433. if %buildsvthevc% GTR 2 GOTO svthevc
  434. if %deleteINI%==1 echo.svthevc=^%buildsvthevc%>>%ini%
  435. :xvc
  436. if %xvcINI%==0 (
  437. echo -------------------------------------------------------------------------------
  438. echo -------------------------------------------------------------------------------
  439. echo.
  440. echo. Build xvc? [HEVC and AV1 competitor]
  441. echo. 1 = Yes
  442. echo. 2 = No
  443. echo.
  444. echo. Any issues with this will be considered low-priority due to lack of
  445. echo. potential stability
  446. echo -------------------------------------------------------------------------------
  447. echo -------------------------------------------------------------------------------
  448. set /P buildxvc="Build xvc: "
  449. ) else set buildxvc=%xvcINI%
  450. if "%buildxvc%"=="" GOTO xvc
  451. if %buildxvc%==1 set "xvc=y"
  452. if %buildxvc%==2 set "xvc=n"
  453. if %buildxvc% GTR 2 GOTO xvc
  454. if %deleteINI%==1 echo.xvc=^%buildxvc%>>%ini%
  455. :vvc
  456. if %vvcINI%==0 (
  457. echo -------------------------------------------------------------------------------
  458. echo -------------------------------------------------------------------------------
  459. echo.
  460. echo. Build Fraunhofer VVC? [H.265 successor enc/decoder]
  461. echo. 1 = Yes
  462. echo. 2 = No
  463. echo.
  464. echo -------------------------------------------------------------------------------
  465. echo -------------------------------------------------------------------------------
  466. set /P buildvvc="Build vvc: "
  467. ) else set buildvvc=%vvcINI%
  468. if "%buildvvc%"=="" GOTO vvc
  469. if %buildvvc%==1 set "vvc=y"
  470. if %buildvvc%==2 set "vvc=n"
  471. if %buildvvc% GTR 2 GOTO vvc
  472. if %deleteINI%==1 echo.vvc=^%buildvvc%>>%ini%
  473. :svtav1
  474. if %svtav1INI%==0 (
  475. echo -------------------------------------------------------------------------------
  476. echo -------------------------------------------------------------------------------
  477. echo.
  478. echo. Build SVT-AV1? [AV1 encoder]
  479. echo. 1 = Yes
  480. echo. 2 = No
  481. echo.
  482. echo. Look at the link for hardware requirements
  483. echo. https://github.com/OpenVisualCloud/SVT-AV1/blob/master/README.md#Hardware
  484. echo.
  485. echo -------------------------------------------------------------------------------
  486. echo -------------------------------------------------------------------------------
  487. set /P buildsvtav1="Build SVT-AV1: "
  488. ) else set buildsvtav1=%svtav1INI%
  489. if "%buildsvtav1%"=="" GOTO svtav1
  490. if %buildsvtav1%==1 set "svtav1=y"
  491. if %buildsvtav1%==2 set "svtav1=n"
  492. if %buildsvtav1% GTR 2 GOTO svtav1
  493. if %deleteINI%==1 echo.svtav1=^%buildsvtav1%>>%ini%
  494. :svtvp9
  495. if %svtvp9INI%==0 (
  496. echo -------------------------------------------------------------------------------
  497. echo -------------------------------------------------------------------------------
  498. echo.
  499. echo. Build SVT-VP9? [VP9 encoder]
  500. echo. 1 = Yes
  501. echo. 2 = No
  502. echo.
  503. echo. Look at the link for hardware requirements
  504. echo. https://github.com/OpenVisualCloud/SVT-VP9#Hardware
  505. echo.
  506. echo -------------------------------------------------------------------------------
  507. echo -------------------------------------------------------------------------------
  508. set /P buildsvtvp9="Build SVT-VP9: "
  509. ) else set buildsvtvp9=%svtvp9INI%
  510. if "%buildsvtvp9%"=="" GOTO svtvp9
  511. if %buildsvtvp9%==1 set "svtvp9=y"
  512. if %buildsvtvp9%==2 set "svtvp9=n"
  513. if %buildsvtvp9% GTR 2 GOTO svtvp9
  514. if %deleteINI%==1 echo.svtvp9=^%buildsvtvp9%>>%ini%
  515. :flac
  516. if %flacINI%==0 (
  517. echo -------------------------------------------------------------------------------
  518. echo -------------------------------------------------------------------------------
  519. echo.
  520. echo. Build FLAC? [Free Lossless Audio Codec]
  521. echo. 1 = Yes
  522. echo. 2 = No
  523. echo.
  524. echo -------------------------------------------------------------------------------
  525. echo -------------------------------------------------------------------------------
  526. set /P buildflac="Build flac: "
  527. ) else set buildflac=%flacINI%
  528. if "%buildflac%"=="" GOTO flac
  529. if %buildflac%==1 set "flac=y"
  530. if %buildflac%==2 set "flac=n"
  531. if %buildflac% GTR 2 GOTO flac
  532. if %deleteINI%==1 echo.flac=^%buildflac%>>%ini%
  533. :fdkaac
  534. if %fdkaacINI%==0 (
  535. echo -------------------------------------------------------------------------------
  536. echo -------------------------------------------------------------------------------
  537. echo.
  538. echo. Build FDK-AAC library and binary? [AAC-LC/HE/HEv2 codec]
  539. echo. 1 = Yes
  540. echo. 2 = No
  541. echo.
  542. echo. Note: FFmpeg's aac encoder is no longer experimental and considered equal or
  543. echo. better in quality from 96kbps and above. It still doesn't support AAC-HE/HEv2
  544. echo. so if you need that or want better quality at lower bitrates than 96kbps,
  545. echo. use FDK-AAC.
  546. echo.
  547. echo -------------------------------------------------------------------------------
  548. echo -------------------------------------------------------------------------------
  549. set /P buildfdkaac="Build fdkaac: "
  550. ) else set buildfdkaac=%fdkaacINI%
  551. if "%buildfdkaac%"=="" GOTO fdkaac
  552. if %buildfdkaac%==1 set "fdkaac=y"
  553. if %buildfdkaac%==2 set "fdkaac=n"
  554. if %buildfdkaac% GTR 2 GOTO fdkaac
  555. if %deleteINI%==1 echo.fdkaac=^%buildfdkaac%>>%ini%
  556. :faac
  557. if %faacINI%==0 (
  558. echo -------------------------------------------------------------------------------
  559. echo -------------------------------------------------------------------------------
  560. echo.
  561. echo. Build FAAC library and binary? [old, low-quality and nonfree AAC-LC codec]
  562. echo. 1 = Yes
  563. echo. 2 = No
  564. echo.
  565. echo -------------------------------------------------------------------------------
  566. echo -------------------------------------------------------------------------------
  567. set /P buildfaac="Build faac: "
  568. ) else set buildfaac=%faacINI%
  569. if "%buildfaac%"=="" GOTO faac
  570. if %buildfaac%==1 set "faac=y"
  571. if %buildfaac%==2 set "faac=n"
  572. if %buildfaac% GTR 2 GOTO faac
  573. if %deleteINI%==1 echo.faac=^%buildfaac%>>%ini%
  574. :exhale
  575. if %exhaleINI%==0 (
  576. echo -------------------------------------------------------------------------------
  577. echo -------------------------------------------------------------------------------
  578. echo.
  579. echo. Build exhale binary? [open-source ISO/IEC 23003-3 USAC, xHE-AAC encoder]
  580. echo. 1 = Yes
  581. echo. 2 = No
  582. echo.
  583. echo. Binaries being built do not depend on "standalone=y"
  584. echo.
  585. echo -------------------------------------------------------------------------------
  586. echo -------------------------------------------------------------------------------
  587. set /P buildexhale="Build exhale: "
  588. ) else set buildexhale=%exhaleINI%
  589. if "%buildexhale%"=="" GOTO exhale
  590. if %buildexhale%==1 set "exhale=y"
  591. if %buildexhale%==2 set "exhale=n"
  592. if %buildexhale% GTR 2 GOTO exhale
  593. if %deleteINI%==1 echo.exhale=^%buildexhale%>>%ini%
  594. :mediainfo
  595. if %mediainfoINI%==0 (
  596. echo -------------------------------------------------------------------------------
  597. echo -------------------------------------------------------------------------------
  598. echo.
  599. echo. Build mediainfo binaries [Multimedia file information tool]?
  600. echo. 1 = Yes
  601. echo. 2 = No
  602. echo.
  603. echo -------------------------------------------------------------------------------
  604. echo -------------------------------------------------------------------------------
  605. set /P buildmediainfo="Build mediainfo: "
  606. ) else set buildmediainfo=%mediainfoINI%
  607. if "%buildmediainfo%"=="" GOTO mediainfo
  608. if %buildmediainfo%==1 set "mediainfo=y"
  609. if %buildmediainfo%==2 set "mediainfo=n"
  610. if %buildmediainfo% GTR 2 GOTO mediainfo
  611. if %deleteINI%==1 echo.mediainfo=^%buildmediainfo%>>%ini%
  612. :sox
  613. if %soxBINI%==0 (
  614. echo -------------------------------------------------------------------------------
  615. echo -------------------------------------------------------------------------------
  616. echo.
  617. echo. Build sox binaries [Sound processing tool]?
  618. echo. 1 = Yes
  619. echo. 2 = No
  620. echo.
  621. echo -------------------------------------------------------------------------------
  622. echo -------------------------------------------------------------------------------
  623. set /P buildsox="Build sox: "
  624. ) else set buildsox=%soxBINI%
  625. if "%buildsox%"=="" GOTO sox
  626. if %buildsox%==1 set "sox=y"
  627. if %buildsox%==2 set "sox=n"
  628. if %buildsox% GTR 2 GOTO sox
  629. if %deleteINI%==1 echo.soxB=^%buildsox%>>%ini%
  630. :ffmpeg
  631. if %ffmpegB2INI%==0 (
  632. echo -------------------------------------------------------------------------------
  633. echo -------------------------------------------------------------------------------
  634. echo.
  635. echo. Build FFmpeg binaries and libraries:
  636. echo. 1 = Yes [static] [recommended]
  637. echo. 2 = No
  638. echo. 3 = Shared
  639. echo. 4 = Both static and shared [shared goes to an isolated directory]
  640. echo. 5 = Shared-only with some shared dependencies (libass, freetype and fribidi^)
  641. echo. 6 = Same as 4, but static compilation ignores shared dependencies
  642. echo.
  643. echo. Note: Option 5 differs from 3 in that libass, freetype and fribidi are
  644. echo. compiled shared so they take less space. Currently broken if libass or libass
  645. echo. dependees are enabled.
  646. echo. Option 6 produces static and shared ffmpeg and ffmpeg libs where the static
  647. echo. one includes only strictly static dependencies (opencl, opengl, cuda-nvcc,
  648. echo. libnpp, libopenh264 are hard disabled.^)
  649. echo.
  650. echo -------------------------------------------------------------------------------
  651. echo -------------------------------------------------------------------------------
  652. set /P buildffmpeg="Build FFmpeg: "
  653. ) else set buildffmpeg=%ffmpegB2INI%
  654. if "%buildffmpeg%"=="" GOTO ffmpeg
  655. if %buildffmpeg%==1 set "ffmpeg=static"
  656. if %buildffmpeg%==2 set "ffmpeg=no"
  657. if %buildffmpeg%==3 set "ffmpeg=shared"
  658. if %buildffmpeg%==4 set "ffmpeg=both"
  659. if %buildffmpeg%==5 set "ffmpeg=sharedlibs"
  660. if %buildffmpeg%==6 set "ffmpeg=bothstatic"
  661. if %buildffmpeg% GTR 6 GOTO ffmpeg
  662. if %deleteINI%==1 echo.ffmpegB2=^%buildffmpeg%>>%ini%
  663. :ffmpegUp
  664. if %ffmpegUpdateINI%==0 (
  665. echo -------------------------------------------------------------------------------
  666. echo -------------------------------------------------------------------------------
  667. echo.
  668. echo. Always build FFmpeg when libraries have been updated?
  669. echo. 1 = Yes
  670. echo. 2 = No
  671. echo. 3 = Only build FFmpeg/mpv and missing dependencies
  672. echo.
  673. echo. FFmpeg is updated a lot so you only need to select this if you
  674. echo. absolutely need updated external libraries in FFmpeg.
  675. echo.
  676. echo -------------------------------------------------------------------------------
  677. echo -------------------------------------------------------------------------------
  678. set /P buildffmpegUp="Build ffmpeg if lib is new: "
  679. ) else set buildffmpegUp=%ffmpegUpdateINI%
  680. if "%buildffmpegUp%"=="" GOTO ffmpegUp
  681. if %buildffmpegUp%==1 set "ffmpegUpdate=y"
  682. if %buildffmpegUp%==2 set "ffmpegUpdate=n"
  683. if %buildffmpegUp%==3 set "ffmpegUpdate=onlyFFmpeg"
  684. if %buildffmpegUp% GTR 3 GOTO ffmpegUp
  685. if %deleteINI%==1 echo.ffmpegUpdate=^%buildffmpegUp%>>%ini%
  686. :ffmpegChoice
  687. if %ffmpegChoiceINI%==0 (
  688. echo -------------------------------------------------------------------------------
  689. echo -------------------------------------------------------------------------------
  690. echo.
  691. echo. Choose ffmpeg and mpv optional libraries?
  692. echo. 1 = Yes
  693. echo. 2 = No (Light build^)
  694. echo. 3 = No (Mimic Zeranoe^)
  695. echo. 4 = No (All available external libs^)
  696. echo.
  697. echo. Avoid the last two unless you really want useless libraries you'll never use.
  698. echo. Just because you can include a shitty codec no one uses doesn't mean you should.
  699. echo.
  700. echo. If you select yes, we will create files with the default options
  701. echo. we use with FFmpeg and mpv. You can remove any that you don't need or prefix
  702. echo. them with #
  703. echo.
  704. echo -------------------------------------------------------------------------------
  705. echo -------------------------------------------------------------------------------
  706. set /P buildffmpegChoice="Choose ffmpeg and mpv optional libs: "
  707. ) else set buildffmpegChoice=%ffmpegChoiceINI%
  708. if "%buildffmpegChoice%"=="" GOTO ffmpegChoice
  709. if %buildffmpegChoice%==1 (
  710. set "ffmpegChoice=y"
  711. if not exist %build%\ffmpeg_options.txt (
  712. (
  713. echo.# Lines starting with this character are ignored
  714. echo.# To override some options specifically for the shared build, create a ffmpeg_options_shared.txt file.
  715. echo.
  716. echo.# Basic built-in options, can be removed if you delete "--disable-autodetect"
  717. call :writeOption %ffmpeg_options_builtin%
  718. echo.
  719. echo.# Common options
  720. call :writeOption %ffmpeg_options_basic%
  721. echo.
  722. echo.# Zeranoe
  723. call :writeOption %ffmpeg_options_zeranoe%
  724. echo.
  725. echo.# Full
  726. call :writeOption %ffmpeg_options_full%
  727. echo.
  728. echo.# Full plus options that add shared dependencies
  729. call :writeOption %ffmpeg_options_full_shared%
  730. )>%build%\ffmpeg_options.txt
  731. echo -------------------------------------------------------------------------------
  732. echo. File with default FFmpeg options has been created in
  733. echo. %build%\ffmpeg_options.txt
  734. echo.
  735. echo. Edit it now or leave it unedited to compile according to defaults.
  736. echo -------------------------------------------------------------------------------
  737. pause
  738. )
  739. if not exist %build%\mpv_options.txt (
  740. (
  741. echo.# Lines starting with this character are ignored
  742. echo.
  743. echo.# Built-in options, use --disable- to disable them
  744. call :writeOption %mpv_options_builtin%
  745. echo.
  746. echo.# Common options or overriden defaults
  747. call :writeOption %mpv_options_basic%
  748. echo.
  749. echo.# Full
  750. call :writeOption %mpv_options_full%
  751. )>%build%\mpv_options.txt
  752. echo -------------------------------------------------------------------------------
  753. echo. File with default mpv options has been created in
  754. echo. %build%\mpv_options.txt
  755. echo.
  756. echo. Edit it now or leave it unedited to compile according to defaults.
  757. echo -------------------------------------------------------------------------------
  758. pause
  759. )
  760. )
  761. if %buildffmpegChoice%==2 set "ffmpegChoice=n"
  762. if %buildffmpegChoice%==3 set "ffmpegChoice=z"
  763. if %buildffmpegChoice%==4 set "ffmpegChoice=f"
  764. if %buildffmpegChoice% GTR 4 GOTO ffmpegChoice
  765. if %deleteINI%==1 echo.ffmpegChoice=^%buildffmpegChoice%>>%ini%
  766. :mp4boxStatic
  767. if %mp4boxINI%==0 (
  768. echo -------------------------------------------------------------------------------
  769. echo -------------------------------------------------------------------------------
  770. echo.
  771. echo. Build static mp4box [mp4 muxer/toolbox] binary?
  772. echo. 1 = Yes
  773. echo. 2 = No
  774. echo.
  775. echo -------------------------------------------------------------------------------
  776. echo -------------------------------------------------------------------------------
  777. set /P buildMp4box="Build mp4box: "
  778. ) else set buildMp4box=%mp4boxINI%
  779. if "%buildMp4box%"=="" GOTO mp4boxStatic
  780. if %buildMp4box%==1 set "mp4box=y"
  781. if %buildMp4box%==2 set "mp4box=n"
  782. if %buildMp4box% GTR 2 GOTO mp4boxStatic
  783. if %deleteINI%==1 echo.mp4box=^%buildMp4box%>>%ini%
  784. :rtmpdump
  785. if %rtmpdumpINI%==0 (
  786. echo -------------------------------------------------------------------------------
  787. echo -------------------------------------------------------------------------------
  788. echo.
  789. echo. Build static rtmpdump binaries [rtmp tools]?
  790. echo. 1 = Yes
  791. echo. 2 = No
  792. echo.
  793. echo -------------------------------------------------------------------------------
  794. echo -------------------------------------------------------------------------------
  795. set /P buildrtmpdump="Build rtmpdump: "
  796. ) else set buildrtmpdump=%rtmpdumpINI%
  797. if "%buildrtmpdump%"=="" GOTO rtmpdump
  798. if %buildrtmpdump%==1 set "rtmpdump=y"
  799. if %buildrtmpdump%==2 set "rtmpdump=n"
  800. if %buildrtmpdump% GTR 2 GOTO rtmpdump
  801. if %deleteINI%==1 echo.rtmpdump=^%buildrtmpdump%>>%ini%
  802. :mplayer
  803. if %mplayer2INI%==0 (
  804. echo -------------------------------------------------------------------------------
  805. echo -------------------------------------------------------------------------------
  806. echo.
  807. echo ######### UNSUPPORTED, IF IT BREAKS, IT BREAKS ################################
  808. echo.
  809. echo. Build static mplayer/mencoder binary?
  810. echo. 1 = Yes
  811. echo. 2 = No
  812. echo.
  813. echo. Don't bother opening issues about this if it breaks, I don't fucking care
  814. echo. about ancient unmaintained shit code. One more issue open about this that
  815. echo. isn't the suite's fault and mplayer goes fucking out.
  816. echo.
  817. echo -------------------------------------------------------------------------------
  818. echo -------------------------------------------------------------------------------
  819. set /P buildmplayer="Build mplayer: "
  820. ) else set buildmplayer=%mplayer2INI%
  821. if "%buildmplayer%"=="" GOTO mplayer
  822. if %buildmplayer%==1 set "mplayer=y"
  823. if %buildmplayer%==2 set "mplayer=n"
  824. if %buildmplayer% GTR 2 GOTO mplayer
  825. if %deleteINI%==1 echo.mplayer2=^%buildmplayer%>>%ini%
  826. :mpv
  827. if %mpvINI%==0 (
  828. echo -------------------------------------------------------------------------------
  829. echo -------------------------------------------------------------------------------
  830. echo.
  831. echo. Build mpv?
  832. echo. 1 = Yes
  833. echo. 2 = No
  834. echo.
  835. echo. Note: when built with shared-only FFmpeg, mpv is also shared.
  836. echo. Note: the third option was removed since vapoursynth is now a delay-import
  837. echo. dependency that is only required if you try to use the corresponding filter.
  838. echo -------------------------------------------------------------------------------
  839. echo -------------------------------------------------------------------------------
  840. set /P buildmpv="Build mpv: "
  841. ) else set buildmpv=%mpvINI%
  842. if "%buildmpv%"=="" GOTO mpv
  843. if %buildmpv%==1 set "mpv=y"
  844. if %buildmpv%==2 set "mpv=n"
  845. if %buildmpv% GTR 2 GOTO mpv
  846. if %deleteINI%==1 echo.mpv=^%buildmpv%>>%ini%
  847. :vlc
  848. if %vlcINI%==0 (
  849. echo -------------------------------------------------------------------------------
  850. echo -------------------------------------------------------------------------------
  851. echo.
  852. echo. Build vlc?
  853. echo. Takes a long time because of qt5 and wouldn't recommend it if you
  854. echo. don't have ccache enabled.
  855. echo. 1 = Yes
  856. echo. 2 = No
  857. echo.
  858. echo. Note: the resulting vlc is extra buggy, do not expect it to work smoothly
  859. echo.
  860. echo -------------------------------------------------------------------------------
  861. echo -------------------------------------------------------------------------------
  862. set /P buildvlc="Build vlc: "
  863. ) else set buildvlc=%vlcINI%
  864. if "%buildvlc%"=="" GOTO vlc
  865. if %buildvlc%==1 set "vlc=y"
  866. if %buildvlc%==2 set "vlc=n"
  867. if %buildvlc% GTR 2 GOTO vlc
  868. if %deleteINI%==1 echo.vlc=^%buildvlc%>>%ini%
  869. :bmx
  870. if %bmxINI%==0 (
  871. echo -------------------------------------------------------------------------------
  872. echo -------------------------------------------------------------------------------
  873. echo.
  874. echo. Build static bmx tools?
  875. echo. 1 = Yes
  876. echo. 2 = No
  877. echo.
  878. echo -------------------------------------------------------------------------------
  879. echo -------------------------------------------------------------------------------
  880. set /P buildbmx="Build bmx: "
  881. ) else set buildbmx=%bmxINI%
  882. if "%buildbmx%"=="" GOTO bmx
  883. if %buildbmx%==1 set "bmx=y"
  884. if %buildbmx%==2 set "bmx=n"
  885. if %buildbmx% GTR 2 GOTO bmx
  886. if %deleteINI%==1 echo.bmx=^%buildbmx%>>%ini%
  887. :curl
  888. if %curlINI%==0 (
  889. echo -------------------------------------------------------------------------------
  890. echo -------------------------------------------------------------------------------
  891. echo.
  892. echo. Build static curl?
  893. echo. 1 = Yes (same backend as FFmpeg's^)
  894. echo. 2 = No
  895. echo. 3 = SChannel backend
  896. echo. 4 = GnuTLS backend
  897. echo. 5 = OpenSSL backend
  898. echo. 6 = LibreSSL backend
  899. echo. 7 = mbedTLS backend
  900. echo.
  901. echo. A curl-ca-bundle.crt will be created to be used as trusted certificate store
  902. echo. for all backends except SChannel.
  903. echo.
  904. echo -------------------------------------------------------------------------------
  905. echo -------------------------------------------------------------------------------
  906. set /P buildcurl="Build curl: "
  907. ) else set buildcurl=%curlINI%
  908. if "%buildcurl%"=="" GOTO curl
  909. if %buildcurl%==1 set "curl=y"
  910. if %buildcurl%==2 set "curl=n"
  911. if %buildcurl%==3 set "curl=schannel"
  912. if %buildcurl%==4 set "curl=gnutls"
  913. if %buildcurl%==5 set "curl=openssl"
  914. if %buildcurl%==6 set "curl=libressl"
  915. if %buildcurl%==7 set "curl=mbedtls"
  916. if %buildcurl% GTR 7 GOTO curl
  917. if %deleteINI%==1 echo.curl=^%buildcurl%>>%ini%
  918. :ffmbc
  919. if %ffmbcINI%==0 (
  920. echo -------------------------------------------------------------------------------
  921. echo -------------------------------------------------------------------------------
  922. echo.
  923. echo ######### UNSUPPORTED, IF IT BREAKS, IT BREAKS ################################
  924. echo.
  925. echo. Build FFMedia Broadcast binary?
  926. echo. 1 = Yes
  927. echo. 2 = No
  928. echo.
  929. echo. Note: this is a fork of FFmpeg 0.10. As such, it's very likely to fail
  930. echo. to build, work, might burn your computer, kill your children, like mplayer.
  931. echo. Only enable it if you absolutely need it. If it breaks, complain first to
  932. echo. the author in #ffmbc in Freenode IRC.
  933. echo.
  934. echo -------------------------------------------------------------------------------
  935. echo -------------------------------------------------------------------------------
  936. set /P buildffmbc="Build ffmbc: "
  937. ) else set buildffmbc=%ffmbcINI%
  938. if "%buildffmbc%"=="" GOTO ffmbc
  939. if %buildffmbc%==1 set "ffmbc=y"
  940. if %buildffmbc%==2 set "ffmbc=n"
  941. if %buildffmbc% GTR 2 GOTO ffmbc
  942. if %deleteINI%==1 echo.ffmbc=^%buildffmbc%>>%ini%
  943. :cyanrip
  944. if %cyanrip2INI%==0 (
  945. echo -------------------------------------------------------------------------------
  946. echo -------------------------------------------------------------------------------
  947. echo.
  948. echo. Build cyanrip (CLI CD ripper^)?
  949. echo. 1 = Yes
  950. echo. 2 = No
  951. echo.
  952. echo -------------------------------------------------------------------------------
  953. echo -------------------------------------------------------------------------------
  954. set /P buildcyanrip="Build cyanrip: "
  955. ) else set buildcyanrip=%cyanrip2INI%
  956. if "%buildcyanrip%"=="" GOTO cyanrip
  957. if %buildcyanrip%==1 set "cyanrip=y"
  958. if %buildcyanrip%==2 set "cyanrip=n"
  959. if %buildcyanrip% GTR 2 GOTO cyanrip
  960. if %deleteINI%==1 echo.cyanrip2=^%buildcyanrip%>>%ini%
  961. :redshift
  962. if %redshiftINI%==0 (
  963. echo -------------------------------------------------------------------------------
  964. echo -------------------------------------------------------------------------------
  965. echo.
  966. echo. Build redshift (f.lux FOSS clone^)?
  967. echo. 1 = Yes
  968. echo. 2 = No
  969. echo.
  970. echo -------------------------------------------------------------------------------
  971. echo -------------------------------------------------------------------------------
  972. set /P buildredshift="Build redshift: "
  973. ) else set buildredshift=%redshiftINI%
  974. if "%buildredshift%"=="" GOTO redshift
  975. if %buildredshift%==1 set "redshift=y"
  976. if %buildredshift%==2 set "redshift=n"
  977. if %buildredshift% GTR 2 GOTO redshift
  978. if %deleteINI%==1 echo.redshift=^%buildredshift%>>%ini%
  979. :ripgrep
  980. if %ripgrepINI%==0 (
  981. echo -------------------------------------------------------------------------------
  982. echo -------------------------------------------------------------------------------
  983. echo.
  984. echo. Build ripgrep (faster grep in Rust^)?
  985. echo. 1 = Yes
  986. echo. 2 = No
  987. echo.
  988. echo -------------------------------------------------------------------------------
  989. echo -------------------------------------------------------------------------------
  990. set /P buildripgrep="Build ripgrep: "
  991. ) else set buildripgrep=%ripgrepINI%
  992. if "%buildripgrep%"=="" GOTO ripgrep
  993. if %buildripgrep%==1 set "ripgrep=y"
  994. if %buildripgrep%==2 set "ripgrep=n"
  995. if %buildripgrep% GTR 2 GOTO ripgrep
  996. if %deleteINI%==1 echo.ripgrep=^%buildripgrep%>>%ini%
  997. :jq
  998. if %jqINI%==0 (
  999. echo -------------------------------------------------------------------------------
  1000. echo -------------------------------------------------------------------------------
  1001. echo.
  1002. echo. Build jq (CLI JSON processor^)?
  1003. echo. 1 = Yes
  1004. echo. 2 = No
  1005. echo.
  1006. echo -------------------------------------------------------------------------------
  1007. echo -------------------------------------------------------------------------------
  1008. set /P buildjq="Build jq: "
  1009. ) else set buildjq=%jqINI%
  1010. if "%buildjq%"=="" GOTO jq
  1011. if %buildjq%==1 set "jq=y"
  1012. if %buildjq%==2 set "jq=n"
  1013. if %buildjq% GTR 2 GOTO jq
  1014. if %deleteINI%==1 echo.jq=^%buildjq%>>%ini%
  1015. :jo
  1016. if %joINI%==0 (
  1017. echo -------------------------------------------------------------------------------
  1018. echo -------------------------------------------------------------------------------
  1019. echo.
  1020. echo. Build jo (CLI JSON from shell^)?
  1021. echo. 1 = Yes
  1022. echo. 2 = No
  1023. echo.
  1024. echo -------------------------------------------------------------------------------
  1025. echo -------------------------------------------------------------------------------
  1026. set /P buildjo="Build jo: "
  1027. ) else set buildjo=%joINI%
  1028. if "%buildjo%"=="" GOTO jo
  1029. if %buildjo%==1 set "jo=y"
  1030. if %buildjo%==2 set "jo=n"
  1031. if %buildjo% GTR 2 GOTO jo
  1032. if %deleteINI%==1 echo.jo=^%buildjo%>>%ini%
  1033. :dssim
  1034. if %dssimINI%==0 (
  1035. echo -------------------------------------------------------------------------------
  1036. echo -------------------------------------------------------------------------------
  1037. echo.
  1038. echo. Build dssim (multiscale SSIM in Rust^)?
  1039. echo. 1 = Yes
  1040. echo. 2 = No
  1041. echo.
  1042. echo -------------------------------------------------------------------------------
  1043. echo -------------------------------------------------------------------------------
  1044. set /P builddssim="Build dssim: "
  1045. ) else set builddssim=%dssimINI%
  1046. if "%builddssim%"=="" GOTO dssim
  1047. if %builddssim%==1 set "dssim=y"
  1048. if %builddssim%==2 set "dssim=n"
  1049. if %builddssim% GTR 2 GOTO dssim
  1050. if %deleteINI%==1 echo.dssim=^%builddssim%>>%ini%
  1051. :avs2
  1052. if %avs2INI%==0 (
  1053. echo -------------------------------------------------------------------------------
  1054. echo -------------------------------------------------------------------------------
  1055. echo.
  1056. echo. Build avs2 (Audio Video Coding Standard Gen2 encoder/decoder^)?
  1057. echo. 1 = Yes
  1058. echo. 2 = No
  1059. echo.
  1060. echo. Binaries being built depends on "standalone=y" and are always static.
  1061. echo.
  1062. echo -------------------------------------------------------------------------------
  1063. echo -------------------------------------------------------------------------------
  1064. set /P buildavs2="Build avs2: "
  1065. ) else set buildavs2=%avs2INI%
  1066. if "%buildavs2%"=="" GOTO avs2
  1067. if %buildavs2%==1 set "avs2=y"
  1068. if %buildavs2%==2 set "avs2=n"
  1069. if %buildavs2% GTR 2 GOTO avs2
  1070. if %deleteINI%==1 echo.avs2=^%buildavs2%>>%ini%
  1071. :CC
  1072. if %CCINI%==0 (
  1073. echo -------------------------------------------------------------------------------
  1074. echo -------------------------------------------------------------------------------
  1075. echo.
  1076. echo. Use clang instead of gcc (C compiler^)?
  1077. echo. Experimental and possibly broken due to gcc assumptions
  1078. echo. 1 = Yes
  1079. echo. 2 = No [Recommended]
  1080. echo.
  1081. echo.
  1082. echo -------------------------------------------------------------------------------
  1083. echo -------------------------------------------------------------------------------
  1084. set /P buildCC="Build using clang: "
  1085. ) else set buildCC=%CCINI%
  1086. if "%buildCC%"=="" GOTO CC
  1087. if %buildCC%==1 set "CC=clang"
  1088. if %buildCC%==2 set "CC=gcc"
  1089. if %buildCC% GTR 2 GOTO CC
  1090. if %deleteINI%==1 echo.CC=^%buildCC%>>%ini%
  1091. :numCores
  1092. if %NUMBER_OF_PROCESSORS% EQU 1 ( set coreHalf=1 ) else set /a coreHalf=%NUMBER_OF_PROCESSORS%/2
  1093. if %coresINI%==0 (
  1094. echo -------------------------------------------------------------------------------
  1095. echo -------------------------------------------------------------------------------
  1096. echo.
  1097. echo. Number of CPU Cores/Threads for compiling:
  1098. echo. [it is non-recommended to use all cores/threads!]
  1099. echo.
  1100. echo. Recommended: %coreHalf%
  1101. echo.
  1102. echo. If you have Windows Defender Real-time protection on, most of your processing
  1103. echo. power will go to it. It is recommended to whitelist this directory from
  1104. echo. scanning due to the amount of new files and copying/moving done by the suite.
  1105. echo. If you do not know how to do this, google it. If you don't care, ignore this.
  1106. echo.
  1107. echo -------------------------------------------------------------------------------
  1108. echo -------------------------------------------------------------------------------
  1109. set /P cpuCores="Core/Thread Count: "
  1110. ) else set cpuCores=%coresINI%
  1111. for /l %%a in (1,1,%cpuCores%) do set cpuCount=%%a
  1112. if "%cpuCount%"=="" GOTO numCores
  1113. if %deleteINI%==1 echo.cores=^%cpuCount%>>%ini%
  1114. if %deleteSourceINI%==0 (
  1115. :delete
  1116. echo -------------------------------------------------------------------------------
  1117. echo -------------------------------------------------------------------------------
  1118. echo.
  1119. echo. Delete versioned source folders after compile is done?
  1120. echo. 1 = Yes [recommended]
  1121. echo. 2 = No
  1122. echo.
  1123. echo. This will save a bit of space for libraries not compiled from git.
  1124. echo.
  1125. echo -------------------------------------------------------------------------------
  1126. echo -------------------------------------------------------------------------------
  1127. set /P deleteS="Delete source: "
  1128. ) else set deleteS=%deleteSourceINI%
  1129. if "%deleteS%"=="" GOTO delete
  1130. if %deleteS%==1 set "deleteSource=y"
  1131. if %deleteS%==2 set "deleteSource=n"
  1132. if %deleteS% GTR 2 GOTO delete
  1133. if %deleteINI%==1 echo.deleteSource=^%deleteS%>>%ini%
  1134. :stripEXE
  1135. if %stripINI%==0 (
  1136. echo -------------------------------------------------------------------------------
  1137. echo -------------------------------------------------------------------------------
  1138. echo.
  1139. echo. Strip compiled files binaries?
  1140. echo. 1 = Yes [recommended]
  1141. echo. 2 = No
  1142. echo.
  1143. echo. Makes binaries smaller at only a small time cost after compiling.
  1144. echo.
  1145. echo -------------------------------------------------------------------------------
  1146. echo -------------------------------------------------------------------------------
  1147. set /P stripF="Strip files: "
  1148. ) else set stripF=%stripINI%
  1149. if "%stripF%"=="" GOTO stripEXE
  1150. if %stripF%==1 set "stripFile=y"
  1151. if %stripF%==2 set "stripFile=n"
  1152. if %stripF% GTR 2 GOTO stripEXE
  1153. if %deleteINI%==1 echo.strip=^%stripF%>>%ini%
  1154. :packEXE
  1155. if %packINI%==0 (
  1156. echo -------------------------------------------------------------------------------
  1157. echo -------------------------------------------------------------------------------
  1158. echo.
  1159. echo. Pack compiled files?
  1160. echo. 1 = Yes
  1161. echo. 2 = No [recommended]
  1162. echo.
  1163. echo. Attention: Some security applications may detect packed binaries as malware.
  1164. echo. Increases delay on runtime during which files need to be unpacked.
  1165. echo. Makes binaries smaller at a big time cost after compiling and on runtime.
  1166. echo.
  1167. echo. If distributing the files, consider packing them with 7-zip instead.
  1168. echo.
  1169. echo -------------------------------------------------------------------------------
  1170. echo -------------------------------------------------------------------------------
  1171. set /P packF="Pack files: "
  1172. ) else set packF=%packINI%
  1173. if "%packF%"=="" GOTO packEXE
  1174. if %packF%==1 set "packFile=y"
  1175. if %packF%==2 set "packFile=n"
  1176. if %packF% GTR 2 GOTO packEXE
  1177. if %deleteINI%==1 echo.pack=^%packF%>>%ini%
  1178. :logging
  1179. if %loggingINI%==0 (
  1180. echo -------------------------------------------------------------------------------
  1181. echo -------------------------------------------------------------------------------
  1182. echo.
  1183. echo. Write logs of compilation commands?
  1184. echo. 1 = Yes [recommended]
  1185. echo. 2 = No
  1186. echo.
  1187. echo Note: Setting this to yes will also hide output from these commands.
  1188. echo On successful compilation, these logs are deleted since they aren't needed.
  1189. echo.
  1190. echo -------------------------------------------------------------------------------
  1191. echo -------------------------------------------------------------------------------
  1192. set /P loggingF="Write logs: "
  1193. ) else set loggingF=%loggingINI%
  1194. if "%loggingF%"=="" GOTO logging
  1195. if %loggingF%==1 set "logging=y"
  1196. if %loggingF%==2 set "logging=n"
  1197. if %loggingF% GTR 2 GOTO logging
  1198. if %deleteINI%==1 echo.logging=^%loggingF%>>%ini%
  1199. :updateSuite
  1200. if %updateSuiteINI%==0 (
  1201. echo -------------------------------------------------------------------------------
  1202. echo -------------------------------------------------------------------------------
  1203. echo.
  1204. echo. Create script to update suite files automatically?
  1205. echo. 1 = Yes
  1206. echo. 2 = No
  1207. echo.
  1208. echo If you have made changes to the scripts, they will be reset but saved to a
  1209. echo .diff text file inside %build%
  1210. echo.
  1211. echo -------------------------------------------------------------------------------
  1212. echo -------------------------------------------------------------------------------
  1213. set /P updateSuiteF="Create update script: "
  1214. ) else set updateSuiteF=%updateSuiteINI%
  1215. if "%updateSuiteF%"=="" GOTO updateSuite
  1216. if %updateSuiteF%==1 set "updateSuite=y"
  1217. if %updateSuiteF%==2 set "updateSuite=n"
  1218. if %updateSuiteF% GTR 2 GOTO updateSuite
  1219. if %deleteINI%==1 echo.updateSuite=^%updateSuiteF%>>%ini%
  1220. :timeStamp
  1221. if %timeStampINI%==0 (
  1222. echo -------------------------------------------------------------------------------
  1223. echo -------------------------------------------------------------------------------
  1224. echo.
  1225. echo. Show timestamps of commands during compilation?
  1226. echo. 1 = Yes
  1227. echo. 2 = No
  1228. echo.
  1229. echo This will show the start times of commands during compilation.
  1230. echo Don't turn this on unless you really want to see the timestamps.
  1231. echo.
  1232. echo -------------------------------------------------------------------------------
  1233. echo -------------------------------------------------------------------------------
  1234. set /P timeStampF="Show Timestamps: "
  1235. ) else set timeStampF=%timeStampINI%
  1236. if "%timeStampF%"=="" GOTO timestamp
  1237. if %timeStampF%==1 set "timeStamp=y"
  1238. if %timeStampF%==2 set "timeStamp=n"
  1239. if %timeStampF% GTR 2 GOTO timeStamp
  1240. if %deleteINI%==1 echo.timeStamp=^%timeStampF%>>%ini%
  1241. :ccache
  1242. if %ccacheINI%==0 (
  1243. echo -------------------------------------------------------------------------------
  1244. echo -------------------------------------------------------------------------------
  1245. echo.
  1246. echo. Use ccache when compiling?
  1247. echo. Experimental.
  1248. echo. Speeds up rebuilds and recompilations, but requires the files to be
  1249. echo. compiled at least once before any effect is seen
  1250. echo. 1 = Yes
  1251. echo. 2 = No
  1252. echo.
  1253. echo -------------------------------------------------------------------------------
  1254. echo -------------------------------------------------------------------------------
  1255. set /P buildwithccache="Use ccache: "
  1256. ) else set buildwithccache=%ccacheINI%
  1257. if "%buildwithccache%"=="" GOTO ccache
  1258. if %buildwithccache%==1 set "ccache=y"
  1259. if %buildwithccache%==2 set "ccache=n"
  1260. if %buildwithccache% GTR 2 GOTO ccache
  1261. if %deleteINI%==1 echo.ccache=^%buildwithccache%>>%ini%
  1262. :noMintty
  1263. if %noMinttyINI%==0 (
  1264. echo -------------------------------------------------------------------------------
  1265. echo -------------------------------------------------------------------------------
  1266. echo.
  1267. echo. Are you running this script through ssh or similar?
  1268. echo. (Can't open another window outside of this terminal^)
  1269. echo. 1 = Yes
  1270. echo. 2 = No
  1271. echo.
  1272. echo This will disable the use of mintty and print the output to this console.
  1273. echo There is no guarantee that this will work properly.
  1274. echo You must make sure that you have ssh keep-alive enabled or something similar
  1275. echo to screen that will allow you to run this script in the background.
  1276. echo.
  1277. echo -------------------------------------------------------------------------------
  1278. echo -------------------------------------------------------------------------------
  1279. set /P noMinttyF="SSH: "
  1280. ) else set noMinttyF=%noMinttyINI%
  1281. if "%noMinttyF%"=="" GOTO noMintty
  1282. if %noMinttyF%==1 (
  1283. set "noMintty=y"
  1284. color
  1285. )
  1286. if %noMinttyF%==2 set "noMintty=n"
  1287. if %noMinttyF% GTR 2 GOTO noMintty
  1288. if %deleteINI%==1 echo.noMintty=^%noMinttyF%>>%ini%
  1289. rem ------------------------------------------------------------------
  1290. rem download and install basic msys2 system:
  1291. rem ------------------------------------------------------------------
  1292. cd %build%
  1293. set scripts=media-suite_compile.sh media-suite_helper.sh media-suite_update.sh
  1294. for %%s in (%scripts%) do (
  1295. if not exist "%build%\%%s" (
  1296. powershell -Command (New-Object System.Net.WebClient^).DownloadFile('"https://github.com/m-ab-s/media-autobuild_suite/raw/master/build/%%s"', '"%%s"' ^)
  1297. )
  1298. )
  1299. rem checkmsys2
  1300. if not exist "%instdir%\msys64\msys2_shell.cmd" (
  1301. echo -------------------------------------------------------------------------------
  1302. echo.
  1303. echo.- Download and install msys2 basic system
  1304. echo.
  1305. echo -------------------------------------------------------------------------------
  1306. echo [System.Net.ServicePointManager]::SecurityProtocol = 'Tls12'; ^
  1307. (New-Object System.Net.WebClient^).DownloadFile(^
  1308. 'https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe', ^
  1309. "$PWD\msys2-base.sfx.exe"^) | powershell -NoProfile -Command - || goto :errorMsys
  1310. :unpack
  1311. if exist %build%\msys2-base.sfx.exe (
  1312. echo -------------------------------------------------------------------------------
  1313. echo.
  1314. echo.- unpacking msys2 basic system
  1315. echo.
  1316. echo -------------------------------------------------------------------------------
  1317. .\msys2-base.sfx.exe x -y -o".."
  1318. if exist msys2-base.sfx.exe del msys2-base.sfx.exe
  1319. )
  1320. if not exist %instdir%\msys64\usr\bin\msys-2.0.dll (
  1321. :errorMsys
  1322. echo -------------------------------------------------------------------------------
  1323. echo.
  1324. echo.- Download msys2 basic system failed,
  1325. echo.- please download it manually from:
  1326. echo.- http://repo.msys2.org/distrib/
  1327. echo.- extract and put the msys2 folder into
  1328. echo.- the root media-autobuid_suite folder
  1329. echo.- and start the batch script again!
  1330. echo.
  1331. echo -------------------------------------------------------------------------------
  1332. pause
  1333. GOTO :unpack
  1334. )
  1335. )
  1336. rem getMintty
  1337. set "bash=%instdir%\msys64\usr\bin\bash.exe"
  1338. set "PATH=%instdir%\msys64\opt\bin;%instdir%\msys64\usr\bin;%PATH%"
  1339. if not exist %instdir%\mintty.lnk (
  1340. echo -------------------------------------------------------------------------------
  1341. echo.- make a first run
  1342. echo -------------------------------------------------------------------------------
  1343. call :runBash firstrun.log exit
  1344. sed -i "s/#Color/Color/;s/^^IgnorePkg.*/#&/" %instdir%\msys64\etc\pacman.conf
  1345. echo.-------------------------------------------------------------------------------
  1346. echo.first update
  1347. echo.-------------------------------------------------------------------------------
  1348. title first msys2 update
  1349. call :runBash firstUpdate.log pacman --noconfirm -Sy --asdeps pacman-mirrors
  1350. echo.-------------------------------------------------------------------------------
  1351. echo.critical updates
  1352. echo.-------------------------------------------------------------------------------
  1353. pacman -S --needed --ask=20 --noconfirm --asdeps bash pacman msys2-runtime
  1354. echo.-------------------------------------------------------------------------------
  1355. echo.second update
  1356. echo.-------------------------------------------------------------------------------
  1357. title second msys2 update
  1358. call :runBash secondUpdate.log pacman --noconfirm -Syu --asdeps
  1359. (
  1360. echo.Set Shell = CreateObject("WScript.Shell"^)
  1361. echo.Set link = Shell.CreateShortcut("%instdir%\mintty.lnk"^)
  1362. echo.link.Arguments = "-full-path -mingw"
  1363. echo.link.Description = "msys2 shell console"
  1364. echo.link.TargetPath = "%instdir%\msys64\msys2_shell.cmd"
  1365. echo.link.WindowStyle = 1
  1366. echo.link.IconLocation = "%instdir%\msys64\msys2.ico"
  1367. echo.link.WorkingDirectory = "%instdir%\msys64"
  1368. echo.link.Save
  1369. )>%build%\setlink.vbs
  1370. cscript /B /Nologo %build%\setlink.vbs
  1371. del %build%\setlink.vbs
  1372. )
  1373. rem createFolders
  1374. if %build32%==yes call :createBaseFolders local32
  1375. if %build64%==yes call :createBaseFolders local64
  1376. rem checkFstab
  1377. set "removefstab=no"
  1378. set "fstab=%instdir%\msys64\etc\fstab"
  1379. if exist %fstab%. (
  1380. findstr build32 %fstab% >nul 2>&1 && set "removefstab=yes"
  1381. findstr trunk %fstab% >nul 2>&1 || set "removefstab=yes"
  1382. for /f "tokens=1 delims= " %%a in ('findstr trunk %fstab%') do if not [%%a]==[%instdir%\] set "removefstab=yes"
  1383. findstr local32 %fstab% >nul 2>&1 && ( if [%build32%]==[no] set "removefstab=yes" ) || if [%build32%]==[yes] set "removefstab=yes"
  1384. findstr local64 %fstab% >nul 2>&1 && ( if [%build64%]==[no] set "removefstab=yes" ) || if [%build64%]==[yes] set "removefstab=yes"
  1385. ) else set removefstab=yes
  1386. if not [%removefstab%]==[no] (
  1387. rem writeFstab
  1388. echo -------------------------------------------------------------------------------
  1389. echo.
  1390. echo.- write fstab mount file
  1391. echo.
  1392. echo -------------------------------------------------------------------------------
  1393. (
  1394. echo.none / cygdrive binary,posix=0,noacl,user 0 0
  1395. echo.
  1396. echo.%instdir%\ /trunk ntfs binary,posix=0,noacl,user 0 0
  1397. echo.%instdir%\build\ /build ntfs binary,posix=0,noacl,user 0 0
  1398. echo.%instdir%\msys64\mingw32\ /mingw32 ntfs binary,posix=0,noacl,user 0 0
  1399. echo.%instdir%\msys64\mingw64\ /mingw64 ntfs binary,posix=0,noacl,user 0 0
  1400. if "%build32%"=="yes" echo.%instdir%\local32\ /local32 ntfs binary,posix=0,noacl,user 0 0
  1401. if "%build64%"=="yes" echo.%instdir%\local64\ /local64 ntfs binary,posix=0,noacl,user 0 0
  1402. )>"%instdir%\msys64\etc\fstab."
  1403. )
  1404. if not exist "%instdir%\msys64\home\%USERNAME%" mkdir "%instdir%\msys64\home\%USERNAME%"
  1405. set "TERM="
  1406. type nul >>"%instdir%\msys64\home\%USERNAME%\.minttyrc"
  1407. for /F "tokens=2 delims==" %%b in ('findstr /i TERM "%instdir%\msys64\home\%USERNAME%\.minttyrc"') do set TERM=%%b
  1408. if not defined TERM (
  1409. printf %%s\n Locale=en_US Charset=UTF-8 Font=Consolas Columns=120 Rows=30 TERM=xterm-256color ^
  1410. > "%instdir%\msys64\home\%USERNAME%\.minttyrc"
  1411. set "TERM=xterm-256color"
  1412. )
  1413. rem gitsettings
  1414. if not exist "%instdir%\msys64\home\%USERNAME%\.gitconfig" (
  1415. echo.[user]
  1416. echo.name = %USERNAME%
  1417. echo.email = %USERNAME%@%COMPUTERNAME%
  1418. echo.
  1419. echo.[color]
  1420. echo.ui = true
  1421. echo.
  1422. echo.[core]
  1423. echo.editor = vim
  1424. echo.autocrlf =
  1425. echo.
  1426. echo.[merge]
  1427. echo.tool = vimdiff
  1428. echo.
  1429. echo.[push]
  1430. echo.default = simple
  1431. )>"%instdir%\msys64\home\%USERNAME%\.gitconfig"
  1432. rem installbase
  1433. if exist "%instdir%\msys64\etc\pac-base.pk" del "%instdir%\msys64\etc\pac-base.pk"
  1434. for %%i in (%msyspackages%) do echo.%%i>>%instdir%\msys64\etc\pac-base.pk
  1435. if not exist %instdir%\msys64\usr\bin\make.exe (
  1436. echo.-------------------------------------------------------------------------------
  1437. echo.install msys2 base system
  1438. echo.-------------------------------------------------------------------------------
  1439. if exist %build%\install_base_failed del %build%\install_base_failed
  1440. title install base system
  1441. (
  1442. echo.echo -ne "\033]0;install base system\007"
  1443. echo.msysbasesystem="$(cat /etc/pac-base.pk | tr '\n\r' ' ')"
  1444. echo.[[ "$(uname)" = *6.1* ]] ^&^& nargs="-n 4"
  1445. echo.echo $msysbasesystem ^| xargs $nargs pacman -Sw --noconfirm --ask=20 --needed
  1446. echo.echo $msysbasesystem ^| xargs $nargs pacman -S --noconfirm --ask=20 --needed
  1447. echo.echo $msysbasesystem ^| xargs $nargs pacman -D --asexplicit
  1448. echo.sleep ^3
  1449. echo.exit
  1450. )>%build%\pacman.sh
  1451. call :runBash pacman.log /build/pacman.sh
  1452. del %build%\pacman.sh
  1453. )
  1454. for %%i in (%instdir%\msys64\usr\ssl\cert.pem) do if %%~zi==0 call :runBash cert.log update-ca-trust
  1455. rem installmingw
  1456. if exist "%instdir%\msys64\etc\pac-mingw.pk" del "%instdir%\msys64\etc\pac-mingw.pk"
  1457. for %%i in (%mingwpackages%) do echo.%%i>>%instdir%\msys64\etc\pac-mingw.pk
  1458. if %build32%==yes call :getmingw 32
  1459. if %build64%==yes call :getmingw 64
  1460. if exist "%build%\mingw.sh" del %build%\mingw.sh
  1461. rem updatebase
  1462. echo.-------------------------------------------------------------------------------
  1463. echo.update autobuild suite
  1464. echo.-------------------------------------------------------------------------------
  1465. cd %build%
  1466. if %updateSuite%==y (
  1467. if not exist %instdir%\update_suite.sh (
  1468. echo -------------------------------------------------------------------------------
  1469. echo. Creating suite update file...
  1470. echo.
  1471. echo. Run this file by dragging it to mintty before the next time you run
  1472. echo. the suite and before reporting an issue.
  1473. echo.
  1474. echo. It needs to be run separately and with the suite not running!
  1475. echo -------------------------------------------------------------------------------
  1476. )
  1477. (
  1478. echo.#!/bin/bash
  1479. echo.
  1480. echo.# Run this file by dragging it to mintty shortcut.
  1481. echo.# Be sure the suite is not running before using it!
  1482. echo.
  1483. echo.update=yes
  1484. %instdir%\msys64\usr\bin\sed -n '/start suite update/,/end suite update/p' ^
  1485. %build%/media-suite_update.sh
  1486. )>%instdir%\update_suite.sh
  1487. )
  1488. rem update
  1489. call :runBash update.log /build/media-suite_update.sh --build32=%build32% --build64=%build64%
  1490. if exist "%build%\update_core" (
  1491. echo.-------------------------------------------------------------------------------
  1492. echo.critical updates
  1493. echo.-------------------------------------------------------------------------------
  1494. pacman -S --needed --noconfirm --ask=20 --asdeps bash pacman msys2-runtime
  1495. del "%build%\update_core"
  1496. )
  1497. rem ------------------------------------------------------------------
  1498. rem write config profiles:
  1499. rem ------------------------------------------------------------------
  1500. if %build32%==yes call :writeProfile 32
  1501. if %build64%==yes call :writeProfile 64
  1502. mkdir "%instdir%\msys64\home\%USERNAME%\.gnupg" > nul 2>&1
  1503. findstr hkps://keys.openpgp.org "%instdir%\msys64\home\%USERNAME%\.gnupg\gpg.conf" >nul 2>&1 || echo keyserver hkps://keys.openpgp.org >> "%instdir%\msys64\home\%USERNAME%\.gnupg\gpg.conf"
  1504. rem loginProfile
  1505. if exist %instdir%\msys64\etc\profile.pacnew ^
  1506. move /y %instdir%\msys64\etc\profile.pacnew %instdir%\msys64\etc\profile
  1507. findstr /C:"profile2.local" %instdir%\msys64\etc\profile.d\Zab-suite.sh >nul 2>&1 || (
  1508. echo.if [[ -z "$MSYSTEM" ^|^| "$MSYSTEM" = MINGW64 ]]; then
  1509. echo. source /local64/etc/profile2.local
  1510. echo.elif [[ -z "$MSYSTEM" ^|^| "$MSYSTEM" = MINGW32 ]]; then
  1511. echo. source /local32/etc/profile2.local
  1512. echo.fi
  1513. )>%instdir%\msys64\etc\profile.d\Zab-suite.sh
  1514. findstr /C:"LANG" %instdir%\msys64\etc\profile.d\Zab-suite.sh >nul 2>&1 || (
  1515. echo.case $- in
  1516. echo.*i*^) ;;
  1517. echo.*^) export LANG=en_US.UTF-8 ;;
  1518. echo.esac
  1519. )>>%instdir%\msys64\etc\profile.d\Zab-suite.sh
  1520. rem compileLocals
  1521. cd %instdir%
  1522. title MABSbat
  1523. if exist %build%\compilation_failed del %build%\compilation_failed
  1524. if exist %build%\fail_comp del %build%\compilation_failed
  1525. endlocal & (
  1526. set compileArgs=--cpuCount=%cpuCount% --build32=%build32% --build64=%build64% ^
  1527. --deleteSource=%deleteSource% --mp4box=%mp4box% --vpx=%vpx2% --x264=%x2643% --x265=%x2652% ^
  1528. --other265=%other265% --flac=%flac% --fdkaac=%fdkaac% --mediainfo=%mediainfo% --sox=%sox% ^
  1529. --ffmpeg=%ffmpeg% --ffmpegUpdate=%ffmpegUpdate% --ffmpegChoice=%ffmpegChoice% --mplayer=%mplayer% ^
  1530. --mpv=%mpv% --license=%license2% --stripping=%stripFile% --packing=%packFile% --rtmpdump=%rtmpdump% ^
  1531. --logging=%logging% --bmx=%bmx% --standalone=%standalone% --aom=%aom% --faac=%faac% --exhale=%exhale% ^
  1532. --ffmbc=%ffmbc% --curl=%curl% --cyanrip=%cyanrip% --redshift=%redshift% --rav1e=%rav1e% --ripgrep=%ripgrep% ^
  1533. --dav1d=%dav1d% --vvc=%vvc% --jq=%jq% --jo=%jo% --dssim=%dssim% --avs2=%avs2% --timeStamp=%timeStamp% ^
  1534. --noMintty=%noMintty% --ccache=%ccache% --svthevc=%svthevc% --svtav1=%svtav1% --svtvp9=%svtvp9% --xvc=%xvc% ^
  1535. --vlc=%vlc% --libavif=%libavif% --jpegxl=%jpegxl%
  1536. set "noMintty=%noMintty%"
  1537. if %build64%==yes ( set "MSYSTEM=MINGW64" ) else set "MSYSTEM=MINGW32"
  1538. set "MSYS2_PATH_TYPE=inherit"
  1539. if %noMintty%==y set "PATH=%PATH%"
  1540. set "build=%build%"
  1541. set "instdir=%instdir%"
  1542. )
  1543. if %noMintty%==y (
  1544. call :runBash compile.log /build/media-suite_compile.sh %compileArgs%
  1545. ) else (
  1546. if exist %build%\compile.log del %build%\compile.log
  1547. start "compile" /I /LOW %CD%\msys64\usr\bin\mintty.exe -i /msys2.ico -t "media-autobuild_suite" ^
  1548. --log 2>&1 %build%\compile.log /bin/env MSYSTEM=%MSYSTEM% MSYS2_PATH_TYPE=inherit ^
  1549. /usr/bin/bash ^
  1550. --login /build/media-suite_compile.sh %compileArgs%
  1551. )
  1552. exit /B %ERRORLEVEL%
  1553. endlocal
  1554. goto :EOF
  1555. :createBaseFolders
  1556. if not exist %instdir%\%1\share (
  1557. echo.-------------------------------------------------------------------------------
  1558. echo.creating %1-bit install folders
  1559. echo.-------------------------------------------------------------------------------
  1560. mkdir %instdir%\%1 2>NUL
  1561. mkdir %instdir%\%1\bin 2>NUL
  1562. mkdir %instdir%\%1\bin-audio 2>NUL
  1563. mkdir %instdir%\%1\bin-global 2>NUL
  1564. mkdir %instdir%\%1\bin-video 2>NUL
  1565. mkdir %instdir%\%1\etc 2>NUL
  1566. mkdir %instdir%\%1\include 2>NUL
  1567. mkdir %instdir%\%1\lib 2>NUL
  1568. mkdir %instdir%\%1\lib\pkgconfig 2>NUL
  1569. mkdir %instdir%\%1\share 2>NUL
  1570. )
  1571. goto :EOF
  1572. :writeProfile
  1573. (
  1574. echo.MSYSTEM=MINGW%1
  1575. echo.source /etc/msystem
  1576. echo.
  1577. echo.# package build directory
  1578. echo.LOCALBUILDDIR=/build
  1579. echo.# package installation prefix
  1580. echo.LOCALDESTDIR=/local%1
  1581. echo.export LOCALBUILDDIR LOCALDESTDIR
  1582. echo.
  1583. echo.bits='%1bit'
  1584. echo.
  1585. echo.alias dir='ls -la --color=auto'
  1586. echo.alias ls='ls --color=auto'
  1587. if %CC%==clang (
  1588. echo.export CC="ccache clang"
  1589. echo.export CXX="ccache clang++"
  1590. ) else (
  1591. echo.export CC="ccache gcc"
  1592. echo.export CXX="ccache g++"
  1593. )
  1594. echo.
  1595. echo.CARCH="${MINGW_CHOST%%%%-*}"
  1596. echo.CPATH="$(cygpath -pm $LOCALDESTDIR/include:$MINGW_PREFIX/include)"
  1597. echo.LIBRARY_PATH="$(cygpath -pm $LOCALDESTDIR/lib:$MINGW_PREFIX/lib)"
  1598. echo.export CPATH LIBRARY_PATH
  1599. echo.
  1600. echo.MANPATH="${LOCALDESTDIR}/share/man:${MINGW_PREFIX}/share/man:/usr/share/man"
  1601. echo.INFOPATH="${LOCALDESTDIR}/share/info:${MINGW_PREFIX}/share/info:/usr/share/info"
  1602. echo.
  1603. echo.DXSDK_DIR="${MINGW_PREFIX}/${MINGW_CHOST}"
  1604. echo.ACLOCAL_PATH="${LOCALDESTDIR}/share/aclocal:${MINGW_PREFIX}/share/aclocal:/usr/share/aclocal"
  1605. echo.PKG_CONFIG="${MINGW_PREFIX}/bin/pkg-config --static"
  1606. echo.PKG_CONFIG_PATH="${LOCALDESTDIR}/lib/pkgconfig:${MINGW_PREFIX}/lib/pkgconfig"
  1607. echo.CPPFLAGS="-D_FORTIFY_SOURCE=0 -D__USE_MINGW_ANSI_STDIO=1"
  1608. if %CC%==clang (
  1609. echo.CFLAGS="-mtune=generic -O2 -pipe"
  1610. ) else (
  1611. echo.CFLAGS="-mthreads -mtune=generic -O2 -pipe"
  1612. )
  1613. echo.CXXFLAGS="${CFLAGS}"
  1614. echo.LDFLAGS="-pipe -static-libgcc -static-libstdc++"
  1615. echo.export DXSDK_DIR ACLOCAL_PATH PKG_CONFIG PKG_CONFIG_PATH CPPFLAGS CFLAGS CXXFLAGS LDFLAGS MSYSTEM
  1616. echo.
  1617. echo.export CARGO_HOME="/opt/cargo" RUSTUP_HOME="/opt/cargo"
  1618. echo.export CCACHE_DIR="$HOME/.ccache"
  1619. echo.
  1620. echo.export PYTHONPATH=
  1621. echo.
  1622. echo.LANG=en_US.UTF-8
  1623. echo.PATH="${MINGW_PREFIX}/bin:${INFOPATH}:${MSYS2_PATH}:${ORIGINAL_PATH}"
  1624. echo.PATH="${LOCALDESTDIR}/bin-audio:${LOCALDESTDIR}/bin-global:${LOCALDESTDIR}/bin-video:${LOCALDESTDIR}/bin:${PATH}"
  1625. echo.PATH="/opt/cargo/bin:/opt/bin:${PATH}"
  1626. echo.source '/etc/profile.d/perlbin.sh'
  1627. echo.PS1='\[\033[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
  1628. echo.HOME="/home/${USERNAME}"
  1629. echo.GIT_GUI_LIB_DIR=`cygpath -w /usr/share/git-gui/lib`
  1630. echo.export LANG PATH PS1 HOME GIT_GUI_LIB_DIR
  1631. echo.stty susp undef
  1632. echo.cd /trunk
  1633. echo.test -f "$LOCALDESTDIR/etc/custom_profile" ^&^& source "$LOCALDESTDIR/etc/custom_profile"
  1634. )>%instdir%\local%1\etc\profile2.local
  1635. %instdir%\msys64\usr\bin\dos2unix -q %instdir%\local%1\etc\profile2.local
  1636. goto :EOF
  1637. :writeOption
  1638. setlocal enabledelayedexpansion
  1639. for %%i in (%*) do (
  1640. set _opt=%%~i
  1641. if ["!_opt:~0,2!"]==["--"] (
  1642. echo !_opt!
  1643. ) else if ["!_opt:~0,3!"]==["#--"] (
  1644. echo !_opt!
  1645. ) else if ["!_opt:~0,1!"]==["#"] (
  1646. echo #--enable-!_opt:~1!
  1647. ) else (
  1648. echo --enable-!_opt!
  1649. )
  1650. )
  1651. endlocal
  1652. goto :EOF
  1653. :runBash
  1654. setlocal enabledelayedexpansion
  1655. set "log=%1"
  1656. shift
  1657. set "command=%1"
  1658. shift
  1659. set args=%*
  1660. set arg=!args:%log% %command%=!
  1661. if %noMintty%==y (
  1662. start "bash" /B /LOW /WAIT bash %build%\bash.sh "%build%\%log%" "%command%" "%arg%"
  1663. ) else (
  1664. if exist %build%\%log% del %build%\%log%
  1665. start /I /LOW /WAIT %instdir%\msys64\usr\bin\mintty.exe -d -i /msys2.ico ^
  1666. -t "media-autobuild_suite" --log 2>&1 %build%\%log% /usr/bin/bash -lc ^
  1667. "%command% %arg%"
  1668. )
  1669. endlocal
  1670. goto :EOF
  1671. :getmingw
  1672. setlocal
  1673. if exist %instdir%\msys64\mingw%1\bin\gcc.exe GOTO :EOF
  1674. echo.-------------------------------------------------------------------------------
  1675. echo.install %1 bit compiler
  1676. echo.-------------------------------------------------------------------------------
  1677. if "%1"=="32" (
  1678. set prefix=mingw-w64-i686-
  1679. ) else set prefix=mingw-w64-x86_64-
  1680. (
  1681. echo.printf '\033]0;install %1 bit compiler\007'
  1682. echo.[[ "$(uname)" = *6.1* ]] ^&^& nargs="-n 4"
  1683. echo.sed 's/^^/%prefix%/g' /etc/pac-mingw.pk ^| xargs $nargs pacman -Sw --noconfirm --ask=20 --needed
  1684. echo.sed 's/^^/%prefix%/g' /etc/pac-mingw.pk ^| xargs $nargs pacman -S --noconfirm --ask=20 --needed
  1685. echo.sleep 3
  1686. echo.exit
  1687. )>%build%\mingw.sh
  1688. call :runBash mingw%1.log /build/mingw.sh
  1689. if not exist %instdir%\msys64\mingw%1\bin\gcc.exe (
  1690. echo -------------------------------------------------------------------------------
  1691. echo.
  1692. echo.MinGW%1 GCC compiler isn't installed; maybe the download didn't work
  1693. echo.Do you want to try it again?
  1694. echo.
  1695. echo -------------------------------------------------------------------------------
  1696. set /P try="try again [y/n]: "
  1697. if [%try%]==[y] GOTO getmingw %1
  1698. exit
  1699. )
  1700. endlocal
  1701. goto :EOF