2 REM ///////////////////////////////////////////////////////////////////////////
4 REM ///////////////////////////////////////////////////////////////////////////
5 set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
6 set "NSIS_PATH=C:\Program Files\NSIS\Unicode"
7 set "UPX3_PATH=C:\Program Files\UPX"
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 // Build the binaries
57 REM ///////////////////////////////////////////////////////////////////////////
58 echo ---------------------------------------------------------------------
60 echo ---------------------------------------------------------------------
61 MSBuild.exe /property:Configuration=release /target:clean "%~dp0\x264_launcher_MSVC2015.sln"
62 if not "%ERRORLEVEL%"=="0" goto BuildError
63 MSBuild.exe /property:Configuration=release /target:rebuild "%~dp0\x264_launcher_MSVC2015.sln"
64 if not "%ERRORLEVEL%"=="0" goto BuildError
66 REM ///////////////////////////////////////////////////////////////////////////
67 REM // Detect build number
68 REM ///////////////////////////////////////////////////////////////////////////
70 for /F "tokens=2,*" %%s in (%~dp0\src\version.h) do (
71 if "%%s"=="VER_X264_BUILD" set "BUILD_NO=%%~t"
73 if "%BUILD_NO%"=="" goto BuildError
75 REM ///////////////////////////////////////////////////////////////////////////
76 REM // Copy base files
77 REM ///////////////////////////////////////////////////////////////////////////
78 echo ---------------------------------------------------------------------
80 echo ---------------------------------------------------------------------
81 set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp"
83 mkdir "%PACK_PATH%\imageformats"
84 mkdir "%PACK_PATH%\toolset\x86"
85 mkdir "%PACK_PATH%\toolset\x64"
86 mkdir "%PACK_PATH%\toolset\common"
87 mkdir "%PACK_PATH%\sources"
88 copy "%~dp0\bin\Win32\Release\x264_launcher.exe" "%PACK_PATH%"
89 copy "%~dp0\bin\Win32\Release\MUtils32-?.dll" "%PACK_PATH%"
90 copy "%~dp0\bin\Win32\Release\toolset\x86\*.exe" "%PACK_PATH%\toolset\x86"
91 copy "%~dp0\bin\Win32\Release\toolset\x86\*.dll" "%PACK_PATH%\toolset\x86"
92 copy "%~dp0\bin\Win32\Release\toolset\x64\*.exe" "%PACK_PATH%\toolset\x64"
93 copy "%~dp0\bin\Win32\Release\toolset\x64\*.dll" "%PACK_PATH%\toolset\x64"
94 copy "%~dp0\bin\Win32\Release\toolset\common\*.exe" "%PACK_PATH%\toolset\common"
95 copy "%~dp0\bin\Win32\Release\toolset\common\*.gpg" "%PACK_PATH%\toolset\common"
96 copy "%~dp0\etc\sources\*.xz" "%PACK_PATH%\sources"
97 copy "%~dp0\LICENSE.html" "%PACK_PATH%"
98 copy "%~dp0\*.txt" "%PACK_PATH%"
100 REM ///////////////////////////////////////////////////////////////////////////
101 REM // Copy dependencies
102 REM ///////////////////////////////////////////////////////////////////////////
103 copy "%MSVC_PATH%\redist\x86\Microsoft.VC%TOOLS_VER%.CRT\*.dll" "%PACK_PATH%"
104 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtCore4.dll" "%PACK_PATH%"
105 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtGui4.dll" "%PACK_PATH%"
106 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtSvg4.dll" "%PACK_PATH%"
107 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
108 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
109 copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
110 del "%PACK_PATH%\imageformats\*d4.dll" 2> NUL
112 REM ///////////////////////////////////////////////////////////////////////////
114 REM ///////////////////////////////////////////////////////////////////////////
115 "%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"
117 REM ///////////////////////////////////////////////////////////////////////////
119 REM ///////////////////////////////////////////////////////////////////////////
120 "%UPX3_PATH%\upx.exe" --brute "%PACK_PATH%\*.exe"
121 "%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.dll"
123 REM ///////////////////////////////////////////////////////////////////////////
125 REM ///////////////////////////////////////////////////////////////////////////
126 attrib +R "%PACK_PATH%\*.exe"
127 attrib +R "%PACK_PATH%\*.dll"
128 attrib +R "%PACK_PATH%\*.txt"
129 attrib +R "%PACK_PATH%\*.html"
131 REM ///////////////////////////////////////////////////////////////////////////
132 REM // Setup install parameters
133 REM ///////////////////////////////////////////////////////////////////////////
134 mkdir "%~dp0\out" 2> NUL
135 set "OUT_PATH=%~dp0\out\x264_launcher.%ISO_DATE%"
137 if exist "%OUT_PATH%.exe" (
138 set "OUT_PATH=%OUT_PATH%.new"
139 goto GenerateOutfileName
141 if exist "%OUT_PATH%.sfx" (
142 set "OUT_PATH=%OUT_PATH%.new"
143 goto GenerateOutfileName
145 if exist "%OUT_PATH%.zip" (
146 set "OUT_PATH=%OUT_PATH%.new"
147 goto GenerateOutfileName
150 REM ///////////////////////////////////////////////////////////////////////////
152 REM ///////////////////////////////////////////////////////////////////////////
153 echo Simple x264/x265 Launcher - graphical front-end for x264 and x265 > "%PACK_PATH%\BUILD_TAG.txt"
154 echo Copyright (C) 2004-2015 LoRd_MuldeR ^<MuldeR2@GMX.de^> >> "%PACK_PATH%\BUILD_TAG.txt"
155 echo. >> "%PACK_PATH%\BUILD_TAG.txt"
156 echo Build #%BUILD_NO%, created on %ISO_DATE% at %ISO_TIME% >> "%PACK_PATH%\BUILD_TAG.txt"
157 echo. >> "%PACK_PATH%\BUILD_TAG.txt"
158 echo. >> "%PACK_PATH%\BUILD_TAG.txt"
159 "%~dp0\etc\cat.exe" "%~dp0\etc\setup\build.nfo" >> "%PACK_PATH%\BUILD_TAG.txt"
161 REM ///////////////////////////////////////////////////////////////////////////
162 REM // Build the installer
163 REM ///////////////////////////////////////////////////////////////////////////
164 "%NSIS_PATH%\makensis.exe" "/DX264_UPX_PATH=%UPX3_PATH%" "/DX264_DATE=%ISO_DATE%" "/DX264_BUILD=%BUILD_NO%" "/DX264_OUTPUT_FILE=%OUT_PATH%.sfx" "/DX264_SOURCE_PATH=%PACK_PATH%" "%~dp0\etc\setup\setup.nsi"
165 if not "%ERRORLEVEL%"=="0" goto BuildError
167 "%NSIS_PATH%\makensis.exe" "/DX264_UPX_PATH=%UPX3_PATH%" "/DX264_DATE=%ISO_DATE%" "/DX264_BUILD=%BUILD_NO%" "/DX264_OUTPUT_FILE=%OUT_PATH%.exe" "/DX264_SOURCE_FILE=%OUT_PATH%.sfx" "%~dp0\etc\setup\wrapper.nsi"
168 if not "%ERRORLEVEL%"=="0" goto BuildError
170 attrib +R "%OUT_PATH%.exe"
171 attrib +R "%OUT_PATH%.sfx"
173 REM ///////////////////////////////////////////////////////////////////////////
174 REM // Build ZIP package
175 REM ///////////////////////////////////////////////////////////////////////////
177 "%~dp0\etc\zip.exe" -r -9 -z "%OUT_PATH%.zip" "*.*" < "%PACK_PATH%\BUILD_TAG.txt"
180 if not "%ERRORLEVEL%"=="0" goto BuildError
181 attrib +R "%OUT_PATH%.zip"
183 REM ///////////////////////////////////////////////////////////////////////////
185 REM ///////////////////////////////////////////////////////////////////////////
186 rmdir /Q /S "%PACK_PATH%"
188 REM ///////////////////////////////////////////////////////////////////////////
190 REM ///////////////////////////////////////////////////////////////////////////
192 echo Build completed.
197 REM ///////////////////////////////////////////////////////////////////////////
199 REM ///////////////////////////////////////////////////////////////////////////
202 echo Build has failed !!!