media-autobuild_suite.bat 84 KB

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