media-autobuild_suite.bat 84 KB

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