2012-01-30 17:50:19 +01:00
|
|
|
@echo off
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2012-02-09 16:45:42 +01:00
|
|
|
REM // Set Paths
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
set "MSVC_PATH=C:\Program Files\Microsoft Visual Studio 10.0\VC"
|
|
|
|
set "NSIS_PATH=C:\Program Files\NSIS\Unicode"
|
2012-12-01 15:54:07 +01:00
|
|
|
set "QTVC_PATH=C:\Qt\4.8.4"
|
2012-02-09 16:45:42 +01:00
|
|
|
set "UPX3_PATH=C:\Program Files\UPX"
|
|
|
|
|
|
|
|
REM ###############################################
|
|
|
|
REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
|
|
|
|
REM ###############################################
|
|
|
|
|
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Setup environment
|
2012-01-30 17:50:19 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2012-02-04 22:44:19 +01:00
|
|
|
if exist "%QTVC_PATH%\bin\qtvars.bat" ( call "%QTVC_PATH%\bin\qtvars.bat" )
|
|
|
|
if exist "%QTVC_PATH%\bin\qtenv2.bat" ( call "%QTVC_PATH%\bin\qtenv2.bat" )
|
2012-01-30 17:50:19 +01:00
|
|
|
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
|
|
|
|
)
|
|
|
|
if not exist "%QTDIR%\bin\moc.exe" (
|
|
|
|
echo Qt meta compiler not found. Please check your QTVC_PATH var!
|
|
|
|
goto BuildError
|
|
|
|
)
|
|
|
|
|
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
|
|
|
|
|
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 ---------------------------------------------------------------------
|
2012-12-05 22:51:27 +01:00
|
|
|
MSBuild.exe /property:Configuration=release /target:clean "%~dp0\x264_launcher_MSVC2010.sln"
|
2012-01-30 17:50:19 +01:00
|
|
|
if not "%ERRORLEVEL%"=="0" goto BuildError
|
2012-12-05 22:51:27 +01:00
|
|
|
MSBuild.exe /property:Configuration=release /target:rebuild "%~dp0\x264_launcher_MSVC2010.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"
|
|
|
|
mkdir "%PACK_PATH%\toolset"
|
|
|
|
copy "%~dp0\bin\Release\*.exe" "%PACK_PATH%"
|
|
|
|
copy "%~dp0\bin\Release\toolset\*.exe" "%PACK_PATH%\toolset"
|
2012-02-09 23:14:38 +01:00
|
|
|
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 ///////////////////////////////////////////////////////////////////////////
|
2012-12-05 22:51:27 +01:00
|
|
|
for %%i in (100, 110) do (
|
|
|
|
if exist "%MSVC_PATH%\redist\x86\Microsoft.VC%%i.CRT\*.dll" (
|
|
|
|
copy "%MSVC_PATH%\redist\x86\Microsoft.VC%%i.CRT\msvc?%%i.dll" "%PACK_PATH%"
|
|
|
|
)
|
|
|
|
)
|
2012-01-30 17:50:19 +01:00
|
|
|
copy "%QTVC_PATH%\bin\QtCore4.dll" "%PACK_PATH%"
|
|
|
|
copy "%QTVC_PATH%\bin\QtGui4.dll" "%PACK_PATH%"
|
|
|
|
copy "%QTVC_PATH%\bin\QtSvg4.dll" "%PACK_PATH%"
|
|
|
|
copy "%QTVC_PATH%\bin\QtXml4.dll" "%PACK_PATH%"
|
|
|
|
copy "%QTVC_PATH%\bin\QtXml4.dll" "%PACK_PATH%"
|
|
|
|
copy "%QTVC_PATH%\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
|
|
|
|
del "%PACK_PATH%\imageformats\*d4.dll"
|
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"
|
2012-03-25 22:11:07 +02:00
|
|
|
"%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.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"
|
|
|
|
|
2012-02-09 16:45:42 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Setup install parameters
|
2012-01-30 17:50:19 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2012-02-07 00:22:25 +01:00
|
|
|
set "NSI_FILE=%TMP%\~%RANDOM%%RANDOM%.nsi"
|
|
|
|
set "OUT_NAME=x264_x64.%ISO_DATE%"
|
|
|
|
set "OUT_PATH=%~dp0\bin"
|
|
|
|
set "OUT_FULL=%OUT_PATH%\%OUT_NAME%.exe"
|
|
|
|
:GenerateOutfileName
|
|
|
|
if exist "%OUT_FULL%" (
|
|
|
|
set "OUT_NAME=%OUT_NAME%.new"
|
|
|
|
set "OUT_FULL=%OUT_PATH%\%OUT_NAME%.exe"
|
|
|
|
goto GenerateOutfileName
|
|
|
|
)
|
2012-02-09 16:45:42 +01:00
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Generate install script
|
2012-02-07 00:22:25 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
2012-02-09 16:45:42 +01:00
|
|
|
echo #Generated File - Do NOT modify! > "%NSI_FILE%"
|
|
|
|
echo !define ZIP2EXE_NAME `Simple x264 Launcher (%ISO_DATE%)` >> "%NSI_FILE%"
|
2012-02-07 00:22:25 +01:00
|
|
|
echo !define ZIP2EXE_OUTFILE `%OUT_FULL%` >> "%NSI_FILE%"
|
|
|
|
echo !define ZIP2EXE_COMPRESSOR_LZMA >> "%NSI_FILE%"
|
2012-03-25 22:11:07 +02:00
|
|
|
echo !define ZIP2EXE_COMPRESSOR_SOLID >> "%NSI_FILE%"
|
2012-02-07 00:22:25 +01:00
|
|
|
echo !define ZIP2EXE_INSTALLDIR `$PROGRAMFILES\MuldeR\Simple x264 Launcher v2` >> "%NSI_FILE%"
|
2012-02-13 02:12:04 +01:00
|
|
|
echo !define ZIP2EXE_REGPATH `SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{986E454F-DACA-4326-A9C7-3E46C0BFFDCE}` >> "%NSI_FILE%"
|
2012-02-09 23:14:38 +01:00
|
|
|
echo !define MUI_INSTFILESPAGE_COLORS "C5DEFB 000000" >> "%NSI_FILE%"
|
2012-02-13 02:12:04 +01:00
|
|
|
echo RequestExecutionLevel Admin >> "%NSI_FILE%"
|
|
|
|
echo ShowInstDetails show >> "%NSI_FILE%"
|
|
|
|
echo BrandingText `Created: %ISO_DATE%, %ISO_TIME% [Build #%BUILD_NO%]` >> "%NSI_FILE%"
|
|
|
|
echo InstallDirRegKey HKLM `${ZIP2EXE_REGPATH}` InstallLocation >> "%NSI_FILE%"
|
2012-02-07 00:22:25 +01:00
|
|
|
echo !include `${NSISDIR}\Contrib\zip2exe\Base.nsh` >> "%NSI_FILE%"
|
2012-03-25 22:11:07 +02:00
|
|
|
echo SetCompressorDictSize 96 >> "%NSI_FILE%"
|
2012-02-07 00:22:25 +01:00
|
|
|
echo !include `${NSISDIR}\Contrib\zip2exe\Modern.nsh` >> "%NSI_FILE%"
|
2012-02-10 22:30:27 +01:00
|
|
|
echo !include `%~dp0\etc\check_os.nsh` >> "%NSI_FILE%"
|
|
|
|
echo !include `%~dp0\etc\finalization.nsh` >> "%NSI_FILE%"
|
|
|
|
echo !include `%~dp0\etc\version.nsh` >> "%NSI_FILE%"
|
|
|
|
echo !insertmacro X264_VERSIONINFO `%ISO_DATE%` `%ISO_TIME%` `%BUILD_NO%` >> "%NSI_FILE%"
|
2012-02-07 00:22:25 +01:00
|
|
|
echo !insertmacro SECTION_BEGIN >> "%NSI_FILE%"
|
2012-03-29 18:45:51 +02:00
|
|
|
echo Delete `$INSTDIR\*.exe` >> "%NSI_FILE%"
|
|
|
|
echo Delete `$INSTDIR\*.dll` >> "%NSI_FILE%"
|
|
|
|
echo Delete `$INSTDIR\toolset\*.exe` >> "%NSI_FILE%"
|
2012-02-18 01:22:24 +01:00
|
|
|
echo File /a /r `%PACK_PATH%\*.exe` >> "%NSI_FILE%"
|
|
|
|
echo File /a /r `%PACK_PATH%\*.dll` >> "%NSI_FILE%"
|
|
|
|
echo File /a /r `%PACK_PATH%\*.txt` >> "%NSI_FILE%"
|
2012-02-13 02:12:04 +01:00
|
|
|
echo WriteRegStr HKLM `${ZIP2EXE_REGPATH}` InstallLocation `$INSTDIR` >> "%NSI_FILE%"
|
2012-02-09 16:45:42 +01:00
|
|
|
echo !include `%~dp0\etc\shortcut.nsh` >> "%NSI_FILE%"
|
2012-02-07 00:22:25 +01:00
|
|
|
echo !insertmacro SECTION_END >> "%NSI_FILE%"
|
2012-02-09 16:45:42 +01:00
|
|
|
|
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
REM // Build the installer
|
2012-02-07 00:22:25 +01:00
|
|
|
REM ///////////////////////////////////////////////////////////////////////////
|
|
|
|
"%NSIS_PATH%\makensis.exe" "%NSI_FILE%"
|
2012-01-30 17:50:19 +01:00
|
|
|
if not "%ERRORLEVEL%"=="0" goto BuildError
|
2012-02-07 00:22:25 +01:00
|
|
|
attrib +R "%OUT_FULL%"
|
|
|
|
del "%NSI_FILE%"
|
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
|