Improved build script and installer.

This commit is contained in:
LoRd_MuldeR 2012-02-09 16:45:42 +01:00
parent 8e22c9c35e
commit fe0847e60c
7 changed files with 103 additions and 17 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
/bin/ /bin/
/ipch/ /ipch/
/res/toolset/ /res/toolset/
/src/*.h.bak
/*.sdf /*.sdf
/*.suo /*.suo
/*.user /*.user

BIN
etc/auto_inc.exe Normal file

Binary file not shown.

View File

@ -1,3 +1,5 @@
!include "WinVer.nsh"
Function .onInit Function .onInit
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{79d6a7e5-35af-47b1-a7d6-f20d0e5df772}") i .r1 ?e' System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{79d6a7e5-35af-47b1-a7d6-f20d0e5df772}") i .r1 ?e'
Pop $0 Pop $0
@ -9,17 +11,28 @@ Function .onInit
; -------- ; --------
${IfNot} ${IsNT} ${IfNot} ${IsNT}
MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does NOT support Windows 9x or Windows ME!" MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does NOT support Windows 9x !!!"
Quit Quit
${EndIf} ${EndIf}
${If} ${AtMostWinNT4} ${IfNot} ${AtLeastWinXP}
${StdUtils.GetParameter} $R0 "Update" "?" MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application requires Windows XP or later!"
${If} $R0 == "?" Quit
MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, your platform is not supported anymore. Installation aborted!$\nThe minimum required platform is Windows 2000."
${Else}
MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, your platform is not supported anymore. Update not possible!$\nThe minimum required platform is Windows 2000."
${EndIf} ${EndIf}
${If} ${IsWinXP}
${AndIf} ${AtMostServicePack} 1
MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application requires Service-Pack 2 for Windows XP or later!"
ExecShell "open" "http://www.microsoft.com/download/en/details.aspx?id=24"
Quit
${EndIf}
; --------
UserInfo::GetAccountType
Pop $0
${If} $0 != "Admin"
MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
Quit Quit
${EndIf} ${EndIf}
FunctionEnd FunctionEnd

3
etc/finalization.nsh Normal file
View File

@ -0,0 +1,3 @@
Function .onInstSuccess
ExecShell "explore" '$INSTDIR'
FunctionEnd

4
etc/shortcut.nsh Normal file
View File

@ -0,0 +1,4 @@
#Function createShortcuts
MessageBox MB_ICONQUESTION|MB_TOPMOST|MB_YESNO "Create a desktop icon for Simple x264 Launcher?" IDNO +2
CreateShortCut "$DESKTOP\Simple x264 Launcher.lnk" "$INSTDIR\x264_launcher.exe"
#FunctionEnd

View File

@ -21,7 +21,7 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 0 #define VER_X264_MINOR 0
#define VER_X264_PATCH 62 #define VER_X264_PATCH 66
#define VER_X264_MINIMUM_REV 2146 #define VER_X264_MINIMUM_REV 2146
#define VER_X264_CURRENT_API 120 #define VER_X264_CURRENT_API 120

View File

@ -1,13 +1,47 @@
@echo off @echo off
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
set "MSVC_PATH=D:\Microsoft Visual Studio 10.0\VC" REM // Set Paths
set "NSIS_PATH=E:\NSIS\_Unicode" REM ///////////////////////////////////////////////////////////////////////////
set "QTVC_PATH=E:\QtSDK\Desktop\Qt\4.8.0\msvc2010" set "MSVC_PATH=C:\Program Files\Microsoft Visual Studio 10.0\VC"
set "UPX3_PATH=E:\UPX" set "NSIS_PATH=C:\Program Files\NSIS\Unicode"
set "QTVC_PATH=C:\MuldeR\Qt\4.8.0"
set "UPX3_PATH=C:\Program Files\UPX"
REM ###############################################
REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
REM ###############################################
REM ///////////////////////////////////////////////////////////////////////////
REM // Setup environment
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
if exist "%QTVC_PATH%\bin\qtvars.bat" ( call "%QTVC_PATH%\bin\qtvars.bat" ) 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" ) if exist "%QTVC_PATH%\bin\qtenv2.bat" ( call "%QTVC_PATH%\bin\qtenv2.bat" )
call "%MSVC_PATH%\vcvarsall.bat" x86 call "%MSVC_PATH%\vcvarsall.bat" x86
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
)
REM ///////////////////////////////////////////////////////////////////////////
REM // Build the binaries
REM ///////////////////////////////////////////////////////////////////////////
echo --------------------------------------------------------------------- echo ---------------------------------------------------------------------
echo BEGIN BUILD echo BEGIN BUILD
echo --------------------------------------------------------------------- echo ---------------------------------------------------------------------
@ -15,6 +49,10 @@ MSBuild.exe /property:Configuration=release /target:clean "%~dp0\x264_launcher.s
if not "%ERRORLEVEL%"=="0" goto BuildError if not "%ERRORLEVEL%"=="0" goto BuildError
MSBuild.exe /property:Configuration=release /target:rebuild "%~dp0\x264_launcher.sln" MSBuild.exe /property:Configuration=release /target:rebuild "%~dp0\x264_launcher.sln"
if not "%ERRORLEVEL%"=="0" goto BuildError if not "%ERRORLEVEL%"=="0" goto BuildError
REM ///////////////////////////////////////////////////////////////////////////
REM // Copy base files
REM ///////////////////////////////////////////////////////////////////////////
echo --------------------------------------------------------------------- echo ---------------------------------------------------------------------
echo BEGIN PACKAGING echo BEGIN PACKAGING
echo --------------------------------------------------------------------- echo ---------------------------------------------------------------------
@ -24,7 +62,9 @@ mkdir "%PACK_PATH%\imageformats"
mkdir "%PACK_PATH%\toolset" mkdir "%PACK_PATH%\toolset"
copy "%~dp0\bin\Release\*.exe" "%PACK_PATH%" copy "%~dp0\bin\Release\*.exe" "%PACK_PATH%"
copy "%~dp0\bin\Release\toolset\*.exe" "%PACK_PATH%\toolset" copy "%~dp0\bin\Release\toolset\*.exe" "%PACK_PATH%\toolset"
copy "%~dp0\*.txt" "%PACK_PATH%"
REM ///////////////////////////////////////////////////////////////////////////
REM // Copy dependencies
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
copy "%MSVC_PATH%\redist\x86\Microsoft.VC100.CRT\*.dll" "%PACK_PATH%" copy "%MSVC_PATH%\redist\x86\Microsoft.VC100.CRT\*.dll" "%PACK_PATH%"
copy "%QTVC_PATH%\bin\QtCore4.dll" "%PACK_PATH%" copy "%QTVC_PATH%\bin\QtCore4.dll" "%PACK_PATH%"
@ -34,49 +74,74 @@ copy "%QTVC_PATH%\bin\QtXml4.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" copy "%QTVC_PATH%\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
del "%PACK_PATH%\imageformats\*d4.dll" del "%PACK_PATH%\imageformats\*d4.dll"
REM ///////////////////////////////////////////////////////////////////////////
REM // Compress
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
"%UPX3_PATH%\upx.exe" --brute "%PACK_PATH%\*.exe" "%UPX3_PATH%\upx.exe" --brute "%PACK_PATH%\*.exe"
"%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.dll" "%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.dll"
REM ///////////////////////////////////////////////////////////////////////////
REM // Get current date (in ISO format)
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
if not exist "%~dp0\etc\date.exe" BuildError 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 ( for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\etc\date.exe" +ISODATE:%%Y-%%m-%%d') do (
if "%%a"=="ISODATE" set "ISO_DATE=%%b" if "%%a"=="ISODATE" set "ISO_DATE=%%b"
) )
if "%ISO_DATE%"=="" BuildError if "%ISO_DATE%"=="" BuildError
REM ///////////////////////////////////////////////////////////////////////////
REM // Setup install parameters
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
set "NSI_FILE=%TMP%\~%RANDOM%%RANDOM%.nsi" set "NSI_FILE=%TMP%\~%RANDOM%%RANDOM%.nsi"
set "OUT_NAME=x264_x64.%ISO_DATE%" set "OUT_NAME=x264_x64.%ISO_DATE%"
set "OUT_PATH=%~dp0\bin" set "OUT_PATH=%~dp0\bin"
set "OUT_FULL=%OUT_PATH%\%OUT_NAME%.exe" set "OUT_FULL=%OUT_PATH%\%OUT_NAME%.exe"
REM ///////////////////////////////////////////////////////////////////////////
:GenerateOutfileName :GenerateOutfileName
if exist "%OUT_FULL%" ( if exist "%OUT_FULL%" (
set "OUT_NAME=%OUT_NAME%.new" set "OUT_NAME=%OUT_NAME%.new"
set "OUT_FULL=%OUT_PATH%\%OUT_NAME%.exe" set "OUT_FULL=%OUT_PATH%\%OUT_NAME%.exe"
goto GenerateOutfileName goto GenerateOutfileName
) )
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
echo !define ZIP2EXE_NAME `Simple x264 Launcher (%ISO_DATE%)` > "%NSI_FILE%" REM // Generate install script
REM ///////////////////////////////////////////////////////////////////////////
echo #Generated File - Do NOT modify! > "%NSI_FILE%"
echo !define ZIP2EXE_NAME `Simple x264 Launcher (%ISO_DATE%)` >> "%NSI_FILE%"
echo !define ZIP2EXE_OUTFILE `%OUT_FULL%` >> "%NSI_FILE%" echo !define ZIP2EXE_OUTFILE `%OUT_FULL%` >> "%NSI_FILE%"
echo !define ZIP2EXE_COMPRESSOR_LZMA >> "%NSI_FILE%" echo !define ZIP2EXE_COMPRESSOR_LZMA >> "%NSI_FILE%"
echo !define ZIP2EXE_INSTALLDIR `$PROGRAMFILES\MuldeR\Simple x264 Launcher v2` >> "%NSI_FILE%" echo !define ZIP2EXE_INSTALLDIR `$PROGRAMFILES\MuldeR\Simple x264 Launcher v2` >> "%NSI_FILE%"
echo ShowInstDetails show >> "%NSI_FILE%"
echo !include `${NSISDIR}\Contrib\zip2exe\Base.nsh` >> "%NSI_FILE%" echo !include `${NSISDIR}\Contrib\zip2exe\Base.nsh` >> "%NSI_FILE%"
echo !include `${NSISDIR}\Contrib\zip2exe\Modern.nsh` >> "%NSI_FILE%" echo !include `${NSISDIR}\Contrib\zip2exe\Modern.nsh` >> "%NSI_FILE%"
echo !insertmacro SECTION_BEGIN >> "%NSI_FILE%" echo !insertmacro SECTION_BEGIN >> "%NSI_FILE%"
echo File /r `%PACK_PATH%\*.*` >> "%NSI_FILE%" echo File /r `%PACK_PATH%\*.*` >> "%NSI_FILE%"
echo !include `%~dp0\etc\shortcut.nsh` >> "%NSI_FILE%"
echo !insertmacro SECTION_END >> "%NSI_FILE%" echo !insertmacro SECTION_END >> "%NSI_FILE%"
echo !include `%~dp0\etc\check_os.nsh` >> "%NSI_FILE%"
echo !include `%~dp0\etc\finalization.nsh` >> "%NSI_FILE%"
REM ///////////////////////////////////////////////////////////////////////////
REM // Build the installer
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
"%NSIS_PATH%\makensis.exe" "%NSI_FILE%" "%NSIS_PATH%\makensis.exe" "%NSI_FILE%"
if not "%ERRORLEVEL%"=="0" goto BuildError if not "%ERRORLEVEL%"=="0" goto BuildError
attrib +R "%OUT_FULL%" attrib +R "%OUT_FULL%"
del "%NSI_FILE%" del "%NSI_FILE%"
rmdir /Q /S "%PACK_PATH%" rmdir /Q /S "%PACK_PATH%"
REM ///////////////////////////////////////////////////////////////////////////
REM // COMPLETE
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
echo. echo.
echo Build completed. echo Build completed.
echo. echo.
pause pause
goto:eof goto:eof
REM ///////////////////////////////////////////////////////////////////////////
REM // FAILED
REM /////////////////////////////////////////////////////////////////////////// REM ///////////////////////////////////////////////////////////////////////////
:BuildError :BuildError
echo. echo.