2012-01-30 17:50:19 +01:00
|
|
|
@echo off
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2012-02-09 16:45:42 +01:00
|
|
|
REM // Set Paths
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2015-12-19 19:18:38 +01:00
|
|
|
set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
|
2015-12-19 22:19:09 +01:00
|
|
|
set "WSDK_PATH=C:\Program Files (x86)\Windows Kits\10"
|
2012-02-09 16:45:42 +01:00
|
|
|
set "NSIS_PATH=C:\Program Files\NSIS\Unicode"
|
|
|
|
set "UPX3_PATH=C:\Program Files\UPX"
|
2015-02-02 22:18:40 +01:00
|
|
|
set "PDOC_PATH=C:\Program Files\Pandoc"
|
2015-12-19 19:18:38 +01:00
|
|
|
set "TOOLS_VER=140"
|
2012-02-09 16:45:42 +01:00
|
|
|
|
|
|
|
REM ###############################################
|
|
|
|
REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
|
|
|
|
REM ###############################################
|
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Setup environment
|
2012-01-30 17:50:19 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
call "%MSVC_PATH%\vcvarsall.bat" x86
|
2012-02-09 16:45:42 +01:00
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Check environment
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
if "%VCINSTALLDIR%"=="" (
|
|
|
|
echo %%VCINSTALLDIR%% not specified. Please check your MSVC_PATH var!
|
|
|
|
goto BuildError
|
|
|
|
)
|
|
|
|
if "%QTDIR%"=="" (
|
|
|
|
echo %%QTDIR%% not specified. Please check your MSVC_PATH var!
|
|
|
|
goto BuildError
|
|
|
|
)
|
|
|
|
if not exist "%VCINSTALLDIR%\bin\cl.exe" (
|
|
|
|
echo C++ compiler not found. Please check your MSVC_PATH var!
|
|
|
|
goto BuildError
|
|
|
|
)
|
2014-08-13 16:43:38 +02:00
|
|
|
if not exist "%PDOC_PATH%\pandoc.exe" (
|
|
|
|
echo Pandoc binary could not be found. Please check your PDOC_PATH var!
|
|
|
|
goto BuildError
|
|
|
|
)
|
2012-02-09 16:45:42 +01:00
|
|
|
|
2012-02-10 22:30:27 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Get current date and time (in ISO format)
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
set "ISO_DATE="
|
|
|
|
set "ISO_TIME="
|
|
|
|
if not exist "%~dp0\etc\date.exe" BuildError
|
|
|
|
for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISODATE:%%Y-%%m-%%d') do (
|
|
|
|
if "%%a"=="ISODATE" set "ISO_DATE=%%b"
|
|
|
|
)
|
|
|
|
for /F "tokens=1,2,3,4 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISOTIME:%%T') do (
|
|
|
|
if "%%a"=="ISOTIME" set "ISO_TIME=%%b:%%c:%%d"
|
|
|
|
)
|
|
|
|
if "%ISO_DATE%"=="" goto BuildError
|
|
|
|
if "%ISO_TIME%"=="" goto BuildError
|
|
|
|
|
2015-12-19 23:30:40 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Clean up temp files
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
echo ---------------------------------------------------------------------
|
|
|
|
echo CLEAN UP
|
|
|
|
echo ---------------------------------------------------------------------
|
|
|
|
for %%i in (bin,obj,tmp) do (
|
|
|
|
del /Q /S /F "%~dp0\%%i\*.*"
|
|
|
|
)
|
|
|
|
|
2012-02-09 16:45:42 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Build the binaries
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2012-01-30 17:50:19 +01:00
|
|
|
echo ---------------------------------------------------------------------
|
|
|
|
echo BEGIN BUILD
|
|
|
|
echo ---------------------------------------------------------------------
|
2015-12-19 19:18:38 +01:00
|
|
|
MSBuild.exe /property:Configuration=release /target:clean "%~dp0\x264_launcher_MSVC2015.sln"
|
2012-01-30 17:50:19 +01:00
|
|
|
if not "%ERRORLEVEL%"=="0" goto BuildError
|
2015-12-19 19:18:38 +01:00
|
|
|
MSBuild.exe /property:Configuration=release /target:rebuild "%~dp0\x264_launcher_MSVC2015.sln"
|
2012-01-30 17:50:19 +01:00
|
|
|
if not "%ERRORLEVEL%"=="0" goto BuildError
|
2012-02-09 16:45:42 +01:00
|
|
|
|
2012-02-10 22:30:27 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Detect build number
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
set "BUILD_NO="
|
|
|
|
for /F "tokens=2,*" %%s in (%~dp0\src\version.h) do (
|
|
|
|
if "%%s"=="VER_X264_BUILD" set "BUILD_NO=%%~t"
|
|
|
|
)
|
|
|
|
if "%BUILD_NO%"=="" goto BuildError
|
|
|
|
|
2012-02-09 16:45:42 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Copy base files
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2012-01-30 17:50:19 +01:00
|
|
|
echo ---------------------------------------------------------------------
|
|
|
|
echo BEGIN PACKAGING
|
|
|
|
echo ---------------------------------------------------------------------
|
|
|
|
set "PACK_PATH=%TMP%\~%RANDOM%%RANDOM%.tmp"
|
|
|
|
mkdir "%PACK_PATH%"
|
|
|
|
mkdir "%PACK_PATH%\imageformats"
|
2013-05-05 14:32:58 +02:00
|
|
|
mkdir "%PACK_PATH%\toolset\x86"
|
|
|
|
mkdir "%PACK_PATH%\toolset\x64"
|
2013-12-09 22:19:32 +01:00
|
|
|
mkdir "%PACK_PATH%\toolset\common"
|
2014-02-26 18:15:23 +01:00
|
|
|
mkdir "%PACK_PATH%\sources"
|
2015-02-02 22:18:40 +01:00
|
|
|
copy "%~dp0\bin\Win32\Release\x264_launcher.exe" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\bin\Win32\Release\MUtils32-?.dll" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\bin\Win32\Release\toolset\x86\*.exe" "%PACK_PATH%\toolset\x86"
|
|
|
|
copy "%~dp0\bin\Win32\Release\toolset\x86\*.dll" "%PACK_PATH%\toolset\x86"
|
|
|
|
copy "%~dp0\bin\Win32\Release\toolset\x64\*.exe" "%PACK_PATH%\toolset\x64"
|
|
|
|
copy "%~dp0\bin\Win32\Release\toolset\x64\*.dll" "%PACK_PATH%\toolset\x64"
|
|
|
|
copy "%~dp0\bin\Win32\Release\toolset\common\*.exe" "%PACK_PATH%\toolset\common"
|
|
|
|
copy "%~dp0\bin\Win32\Release\toolset\common\*.gpg" "%PACK_PATH%\toolset\common"
|
2015-02-08 22:45:12 +01:00
|
|
|
copy "%~dp0\etc\sources\*.xz" "%PACK_PATH%\sources"
|
2015-02-02 22:18:40 +01:00
|
|
|
copy "%~dp0\LICENSE.html" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\*.txt" "%PACK_PATH%"
|
2012-02-09 16:45:42 +01:00
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Copy dependencies
|
2012-01-30 17:50:19 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2015-08-02 19:16:37 +02:00
|
|
|
copy "%MSVC_PATH%\redist\x86\Microsoft.VC%TOOLS_VER%.CRT\*.dll" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtCore4.dll" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtGui4.dll" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtSvg4.dll" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
|
2015-04-17 19:00:03 +02:00
|
|
|
del "%PACK_PATH%\imageformats\*d4.dll" 2> NUL
|
2015-12-19 22:19:09 +01:00
|
|
|
if %TOOLS_VER% GEQ 140 (
|
|
|
|
copy "%WSDK_PATH%\Redist\ucrt\DLLs\x86\*.dll" "%PACK_PATH%"
|
|
|
|
)
|
2012-02-09 16:45:42 +01:00
|
|
|
|
2014-08-13 16:43:38 +02:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Generate Docs
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2015-02-09 20:15:04 +01:00
|
|
|
"%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"
|
2014-08-13 16:43:38 +02:00
|
|
|
|
2012-02-09 16:45:42 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Compress
|
2012-01-30 17:50:19 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
"%UPX3_PATH%\upx.exe" --brute "%PACK_PATH%\*.exe"
|
2015-12-19 22:19:09 +01:00
|
|
|
"%UPX3_PATH%\upx.exe" --brute "%PACK_PATH%\MUtils32-?.dll
|
|
|
|
"%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\Qt*.dll"
|
2012-02-09 16:45:42 +01:00
|
|
|
|
2012-02-18 01:22:24 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Attributes
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
attrib +R "%PACK_PATH%\*.exe"
|
|
|
|
attrib +R "%PACK_PATH%\*.dll"
|
|
|
|
attrib +R "%PACK_PATH%\*.txt"
|
2014-08-13 16:43:38 +02:00
|
|
|
attrib +R "%PACK_PATH%\*.html"
|
2012-02-18 01:22:24 +01:00
|
|
|
|
2012-02-09 16:45:42 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Setup install parameters
|
2012-01-30 17:50:19 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2014-08-15 16:50:15 +02:00
|
|
|
mkdir "%~dp0\out" 2> NUL
|
|
|
|
set "OUT_PATH=%~dp0\out\x264_launcher.%ISO_DATE%"
|
2012-02-07 00:22:25 +01:00
|
|
|
:GenerateOutfileName
|
2013-12-14 13:19:30 +01:00
|
|
|
if exist "%OUT_PATH%.exe" (
|
|
|
|
set "OUT_PATH=%OUT_PATH%.new"
|
|
|
|
goto GenerateOutfileName
|
|
|
|
)
|
|
|
|
if exist "%OUT_PATH%.sfx" (
|
|
|
|
set "OUT_PATH=%OUT_PATH%.new"
|
2012-02-07 00:22:25 +01:00
|
|
|
goto GenerateOutfileName
|
|
|
|
)
|
2014-04-16 20:18:48 +02:00
|
|
|
if exist "%OUT_PATH%.zip" (
|
|
|
|
set "OUT_PATH=%OUT_PATH%.new"
|
|
|
|
goto GenerateOutfileName
|
|
|
|
)
|
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Create Tag
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
echo Simple x264/x265 Launcher - graphical front-end for x264 and x265 > "%PACK_PATH%\BUILD_TAG.txt"
|
2015-01-31 19:56:04 +01:00
|
|
|
echo Copyright (C) 2004-2015 LoRd_MuldeR ^<MuldeR2@GMX.de^> >> "%PACK_PATH%\BUILD_TAG.txt"
|
2014-04-16 20:18:48 +02:00
|
|
|
echo. >> "%PACK_PATH%\BUILD_TAG.txt"
|
|
|
|
echo Build #%BUILD_NO%, created on %ISO_DATE% at %ISO_TIME% >> "%PACK_PATH%\BUILD_TAG.txt"
|
|
|
|
echo. >> "%PACK_PATH%\BUILD_TAG.txt"
|
|
|
|
echo. >> "%PACK_PATH%\BUILD_TAG.txt"
|
|
|
|
"%~dp0\etc\cat.exe" "%~dp0\etc\setup\build.nfo" >> "%PACK_PATH%\BUILD_TAG.txt"
|
2012-02-09 16:45:42 +01:00
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Build the installer
|
2012-02-07 00:22:25 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2013-12-14 13:19:30 +01:00
|
|
|
"%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"
|
2012-01-30 17:50:19 +01:00
|
|
|
if not "%ERRORLEVEL%"=="0" goto BuildError
|
2013-12-14 13:19:30 +01:00
|
|
|
|
|
|
|
"%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"
|
|
|
|
if not "%ERRORLEVEL%"=="0" goto BuildError
|
|
|
|
|
|
|
|
attrib +R "%OUT_PATH%.exe"
|
|
|
|
attrib +R "%OUT_PATH%.sfx"
|
2014-04-16 20:18:48 +02:00
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Build ZIP package
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
pushd "%PACK_PATH%"
|
|
|
|
"%~dp0\etc\zip.exe" -r -9 -z "%OUT_PATH%.zip" "*.*" < "%PACK_PATH%\BUILD_TAG.txt"
|
|
|
|
popd
|
|
|
|
|
|
|
|
if not "%ERRORLEVEL%"=="0" goto BuildError
|
2014-04-16 22:36:23 +02:00
|
|
|
attrib +R "%OUT_PATH%.zip"
|
2014-04-16 20:18:48 +02:00
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Clean up
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2012-01-31 20:28:40 +01:00
|
|
|
rmdir /Q /S "%PACK_PATH%"
|
2012-02-09 16:45:42 +01:00
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // COMPLETE
|
2012-01-30 17:50:19 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
echo.
|
|
|
|
echo Build completed.
|
|
|
|
echo.
|
|
|
|
pause
|
|
|
|
goto:eof
|
2012-02-09 16:45:42 +01:00
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // FAILED
|
2012-01-30 17:50:19 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
:BuildError
|
|
|
|
echo.
|
|
|
|
echo Build has failed !!!
|
|
|
|
echo.
|
|
|
|
pause
|