2 REM ///////////////////////////////////////////////////////////////////////////
4 REM ///////////////////////////////////////////////////////////////////////////
5 set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
6 set "WSDK_PATH=C:\Program Files (x86)\Windows Kits\10"
7 set "NSIS_PATH=C:\Program Files\NSIS\Unicode"
8 set "PDOC_PATH=C:\Program Files\Pandoc"
11 REM ###############################################
12 REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
13 REM ###############################################
15 REM ///////////////////////////////////////////////////////////////////////////
16 REM // Setup environment
17 REM ///////////////////////////////////////////////////////////////////////////
18 call "%MSVC_PATH%\vcvarsall.bat" x86
20 REM ///////////////////////////////////////////////////////////////////////////
21 REM // Check environment
22 REM ///////////////////////////////////////////////////////////////////////////
23 if "%VCINSTALLDIR%"=="" (
24 echo %%VCINSTALLDIR%% not specified. Please check your MSVC_PATH var!
28 echo %%QTDIR%% not specified. Please check your MSVC_PATH var!
31 if not exist "%VCINSTALLDIR%\bin\cl.exe" (
32 echo C++ compiler not found. Please check your MSVC_PATH var!
35 if not exist "%PDOC_PATH%\pandoc.exe" (
36 echo Pandoc binary could not be found. Please check your PDOC_PATH var!
40 REM ///////////////////////////////////////////////////////////////////////////
41 REM // Get current date and time (in ISO format)
42 REM ///////////////////////////////////////////////////////////////////////////
45 if not exist "%~dp0\etc\date.exe" BuildError
46 for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISODATE:%%Y-%%m-%%d') do (
47 if "%%a"=="ISODATE" set "ISO_DATE=%%b"
49 for /F "tokens=1,2,3,4 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISOTIME:%%T') do (
50 if "%%a"=="ISOTIME" set "ISO_TIME=%%b:%%c:%%d"
52 if "%ISO_DATE%"=="" goto BuildError
53 if "%ISO_TIME%"=="" goto BuildError
55 REM ///////////////////////////////////////////////////////////////////////////
56 REM // Clean up temp files
57 REM ///////////////////////////////////////////////////////////////////////////
58 echo ---------------------------------------------------------------------
60 echo ---------------------------------------------------------------------
61 for %%i in (bin,obj,tmp) do (
62 del /Q /S /F "%~dp0\%%i\*.*"
65 REM ///////////////////////////////////////////////////////////////////////////
66 REM // Build the binaries
67 REM ///////////////////////////////////////////////////////////////////////////
68 echo ---------------------------------------------------------------------
70 echo ---------------------------------------------------------------------
71 MSBuild.exe /property:Configuration=release /target:clean "%~dp0\x264_launcher_MSVC2015.sln"
72 if not "%ERRORLEVEL%"=="0" goto BuildError
73 MSBuild.exe /property:Configuration=release /target:rebuild "%~dp0\x264_launcher_MSVC2015.sln"
74 if not "%ERRORLEVEL%"=="0" goto BuildError
76 REM ///////////////////////////////////////////////////////////////////////////
77 REM // Detect build number
78 REM ///////////////////////////////////////////////////////////////////////////
80 for /F "tokens=2,*" %%s in (%~dp0\src\version.h) do (
81 if "%%s"=="VER_X264_BUILD" set "BUILD_NO=%%~t"
83 if "%BUILD_NO%"=="" goto BuildError
85 REM ///////////////////////////////////////////////////////////////////////////
86 REM // Copy base files
87 REM ///////////////////////////////////////////////////////////////////////////
88 echo ---------------------------------------------------------------------
90 echo ---------------------------------------------------------------------
91 set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp"
93 mkdir "%PACK_PATH%\imageformats"
94 mkdir "%PACK_PATH%\toolset\x86"
95 mkdir "%PACK_PATH%\toolset\x64"
96 mkdir "%PACK_PATH%\toolset\common"
97 mkdir "%PACK_PATH%\sources"
98 copy "%~dp0\bin\Win32\Release\x264_launcher.exe" "%PACK_PATH%"
99 copy "%~dp0\bin\Win32\Release\MUtils32-?.dll" "%PACK_PATH%"
100 copy "%~dp0\bin\Win32\Release\toolset\x86\*.exe" "%PACK_PATH%\toolset\x86"
101 copy "%~dp0\bin\Win32\Release\toolset\x86\*.dll" "%PACK_PATH%\toolset\x86"
102 copy "%~dp0\bin\Win32\Release\toolset\x64\*.exe" "%PACK_PATH%\toolset\x64"
103 copy "%~dp0\bin\Win32\Release\toolset\x64\*.dll" "%PACK_PATH%\toolset\x64"
104 copy "%~dp0\bin\Win32\Release\toolset\common\*.exe" "%PACK_PATH%\toolset\common"
105 copy "%~dp0\bin\Win32\Release\toolset\common\*.gpg" "%PACK_PATH%\toolset\common"
106 copy "%~dp0\etc\sources\*.xz" "%PACK_PATH%\sources"
107 copy "%~dp0\LICENSE.html" "%PACK_PATH%"
108 copy "%~dp0\*.txt" "%PACK_PATH%"
110 REM ///////////////////////////////////////////////////////////////////////////
111 REM // Copy dependencies
112 REM ///////////////////////////////////////////////////////////////////////////
113 copy "%MSVC_PATH%\redist\x86\Microsoft.VC%TOOLS_VER%.CRT\*.dll" "%PACK_PATH%"
114 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtCore4.dll" "%PACK_PATH%"
115 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtGui4.dll" "%PACK_PATH%"
116 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtSvg4.dll" "%PACK_PATH%"
117 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
118 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
119 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
120 del "%PACK_PATH%\imageformats\*d4.dll" 2> NUL
121 if %TOOLS_VER% GEQ 140 (
122 copy "%WSDK_PATH%\Redist\ucrt\DLLs\x86\*.dll" "%PACK_PATH%"
125 REM ///////////////////////////////////////////////////////////////////////////
127 REM ///////////////////////////////////////////////////////////////////////////
128 "%PDOC_PATH%\pandoc.exe" --from markdown_github+pandoc_title_block+header_attributes+implicit_figures --to html5 --toc -N --standalone -H "%~dp0\etc\css\style.inc" --output "%PACK_PATH%\README.html" "%~dp0\README.md"
130 REM ///////////////////////////////////////////////////////////////////////////
132 REM ///////////////////////////////////////////////////////////////////////////
133 "%~dp0\etc\upx.exe" --brute "%PACK_PATH%\*.exe"
134 "%~dp0\etc\upx.exe" --brute "%PACK_PATH%\MUtils32-?.dll
135 "%~dp0\etc\upx.exe" --best "%PACK_PATH%\Qt*.dll"
137 REM ///////////////////////////////////////////////////////////////////////////
139 REM ///////////////////////////////////////////////////////////////////////////
140 attrib +R "%PACK_PATH%\*.exe"
141 attrib +R "%PACK_PATH%\*.dll"
142 attrib +R "%PACK_PATH%\*.txt"
143 attrib +R "%PACK_PATH%\*.html"
145 REM ///////////////////////////////////////////////////////////////////////////
146 REM // Setup install parameters
147 REM ///////////////////////////////////////////////////////////////////////////
148 mkdir "%~dp0\out" 2> NUL
149 set "OUT_PATH=%~dp0\out\x264_launcher.%ISO_DATE%"
151 if exist "%OUT_PATH%.exe" (
152 set "OUT_PATH=%OUT_PATH%.new"
153 goto GenerateOutfileName
155 if exist "%OUT_PATH%.sfx" (
156 set "OUT_PATH=%OUT_PATH%.new"
157 goto GenerateOutfileName
159 if exist "%OUT_PATH%.zip" (
160 set "OUT_PATH=%OUT_PATH%.new"
161 goto GenerateOutfileName
164 REM ///////////////////////////////////////////////////////////////////////////
166 REM ///////////////////////////////////////////////////////////////////////////
167 echo Simple x264/x265 Launcher - graphical front-end for x264 and x265 > "%PACK_PATH%\BUILD_TAG.txt"
168 echo Copyright (C) 2004-2016 LoRd_MuldeR ^<MuldeR2@GMX.de^> >> "%PACK_PATH%\BUILD_TAG.txt"
169 echo. >> "%PACK_PATH%\BUILD_TAG.txt"
170 echo Build #%BUILD_NO%, created on %ISO_DATE% at %ISO_TIME% >> "%PACK_PATH%\BUILD_TAG.txt"
171 echo. >> "%PACK_PATH%\BUILD_TAG.txt"
172 echo. >> "%PACK_PATH%\BUILD_TAG.txt"
173 "%~dp0\etc\cat.exe" "%~dp0\etc\setup\build.nfo" >> "%PACK_PATH%\BUILD_TAG.txt"
175 REM ///////////////////////////////////////////////////////////////////////////
176 REM // Build the installer
177 REM ///////////////////////////////////////////////////////////////////////////
178 "%NSIS_PATH%\makensis.exe" "/DX264_UPX_PATH=%~dp0\etc\upx.exe" "/DX264_DATE=%ISO_DATE%" "/DX264_BUILD=%BUILD_NO%" "/DX264_OUTPUT_FILE=%OUT_PATH%.sfx" "/DX264_SOURCE_PATH=%PACK_PATH%" "%~dp0\etc\setup\setup.nsi"
179 if not "%ERRORLEVEL%"=="0" goto BuildError
181 call "%~dp0\etc\7zSD.cmd" "%OUT_PATH%.sfx" "%OUT_PATH%.exe" "Simple x264/x265 Launcher" "x264_launcher-setup-r%BUILD_NO%"
182 if not "%ERRORLEVEL%"=="0" goto BuildError
184 set "VERPATCH_PRODUCT=Simple x264/x265 Launcher (Setup)"
185 set "VERPATCH_FILEVER=%ISO_DATE:-=.%.%BUILD_NO%"
186 "%~dp0\etc\verpatch.exe" "%OUT_PATH%.exe" "%VERPATCH_FILEVER%" /pv "%VERPATCH_FILEVER%" /fn /s desc "%VERPATCH_PRODUCT%" /s product "%VERPATCH_PRODUCT%" /s title "x264 Launcher Installer SFX" /s copyright "Copyright (C) 2004-2016 LoRd_MuldeR" /s company "Free Software Foundation"
187 if not "%ERRORLEVEL%"=="0" goto BuildError
189 attrib +R "%OUT_PATH%.exe"
190 attrib +R "%OUT_PATH%.sfx"
192 REM ///////////////////////////////////////////////////////////////////////////
193 REM // Build ZIP package
194 REM ///////////////////////////////////////////////////////////////////////////
196 "%~dp0\etc\zip.exe" -r -9 -z "%OUT_PATH%.zip" "*.*" < "%PACK_PATH%\BUILD_TAG.txt"
199 if not "%ERRORLEVEL%"=="0" goto BuildError
200 attrib +R "%OUT_PATH%.zip"
202 REM ///////////////////////////////////////////////////////////////////////////
204 REM ///////////////////////////////////////////////////////////////////////////
205 rmdir /Q /S "%PACK_PATH%"
207 REM ///////////////////////////////////////////////////////////////////////////
209 REM ///////////////////////////////////////////////////////////////////////////
211 echo Build completed.
216 REM ///////////////////////////////////////////////////////////////////////////
218 REM ///////////////////////////////////////////////////////////////////////////
221 echo Build has failed !!!