From ccaa1ba8f523de1a6c9886825c9cbeea0b2a05ea Mon Sep 17 00:00:00 2001 From: lordmulder Date: Wed, 10 Nov 2010 21:39:37 +0100 Subject: [PATCH] Make deployment script more portable + update to Qt 4.7.1 --- etc/Deployment/_build.bat | 5 ++++- etc/Deployment/_error.bat | 2 +- etc/Deployment/_paths.bat | 45 ++++++++++++++++++++++++++++++++----- etc/Deployment/_version.bat | 12 +++++----- etc/Deployment/buildenv.txt | 6 +++++ etc/Deployment/release.bat | 25 +++++++++++++++++---- 6 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 etc/Deployment/buildenv.txt diff --git a/etc/Deployment/_build.bat b/etc/Deployment/_build.bat index 52bc197b..598ca0a9 100644 --- a/etc/Deployment/_build.bat +++ b/etc/Deployment/_build.bat @@ -5,9 +5,12 @@ echo Solution File: %1 echo Configuration: %~n2 echo ---------------------------------------------------------------- call _paths.bat -call "%PATH_MSVC90%\VC\bin\vcvars32.bat" +if not "%LAMEXP_ERROR%"=="0" GOTO:EOF +REM ----------------------------------------------------------------- +call "%PATH_MSVC90%\VC\bin\vcvars32.bat" x86 call "%PATH_QTMSVC%\bin\qtvars.bat" REM ----------------------------------------------------------------- +set "LAMEXP_ERROR=1" msbuild.exe /property:Configuration=%~n2 /target:Clean /verbosity:d %1 if exist "%~d1%~p1bin\%~n2\*.exe" GOTO:EOF if exist "%~d1%~p1obj\%~n2\*.obj" GOTO:EOF diff --git a/etc/Deployment/_error.bat b/etc/Deployment/_error.bat index 8e457dee..b0d64255 100644 --- a/etc/Deployment/_error.bat +++ b/etc/Deployment/_error.bat @@ -1,5 +1,5 @@ @echo off echo. -echo %~n1%~x1 !!! +echo %~1 !!! echo. pause diff --git a/etc/Deployment/_paths.bat b/etc/Deployment/_paths.bat index 5bb1dd38..4f2dba2a 100644 --- a/etc/Deployment/_paths.bat +++ b/etc/Deployment/_paths.bat @@ -1,7 +1,40 @@ @echo off -set "PATH_SEVENZ=E:\7-Zip\7z.exe" -set "PATH_MPRESS=E:\MPress\mpress.exe" -set "PATH_UPXBIN=E:\MPUI\installer\upx.exe" -set "PATH_MKNSIS=E:\NSIS\makensis.exe" -set "PATH_MSVC90=D:\Microsoft Visual Studio 9.0" -set "PATH_QTMSVC=E:\Qt\MSVC\4.7.0" +set "LAMEXP_ERROR=1" +REM ------------------------------------------ +set "PATH_SEVENZ=" +set "PATH_MPRESS=" +set "PATH_UPXBIN=" +set "PATH_MKNSIS=" +set "PATH_MSVC90=" +set "PATH_QTMSVC=" +REM ------------------------------------------ +for /f "tokens=2,*" %%s in (buildenv.txt) do ( + if "%%s"=="PATH_SEVENZ" set "PATH_SEVENZ=%%~t" + if "%%s"=="PATH_MPRESS" set "PATH_MPRESS=%%~t" + if "%%s"=="PATH_UPXBIN" set "PATH_UPXBIN=%%~t" + if "%%s"=="PATH_MKNSIS" set "PATH_MKNSIS=%%~t" + if "%%s"=="PATH_MSVC90" set "PATH_MSVC90=%%~t" + if "%%s"=="PATH_QTMSVC" set "PATH_QTMSVC=%%~t" +) +REM ------------------------------------------ +:: echo PATH_SEVENZ=%PATH_SEVENZ% +:: echo PATH_MPRESS=%PATH_MPRESS% +:: echo PATH_UPXBIN=%PATH_UPXBIN% +:: echo PATH_MKNSIS=%PATH_MKNSIS% +:: echo PATH_MSVC90=%PATH_MSVC90% +:: echo PATH_QTMSVC=%PATH_QTMSVC% +REM ------------------------------------------ +set "LAMEXP_ERROR=1" +REM ------------------------------------------ +if not exist "%PATH_SEVENZ%\7z.exe" GOTO:EOF +if not exist "%PATH_MPRESS%\mpress.exe" GOTO:EOF +if not exist "%PATH_UPXBIN%\upx.exe" GOTO:EOF +if not exist "%PATH_MKNSIS%\makensis.exe" GOTO:EOF +if not exist "%PATH_MSVC90%\VC\vcvarsall.bat" GOTO:EOF +if not exist "%PATH_MSVC90%\VC\bin\cl.exe" GOTO:EOF +if not exist "%PATH_QTMSVC%\bin\qtvars.bat" GOTO:EOF +if not exist "%PATH_QTMSVC%\bin\uic.exe" GOTO:EOF +if not exist "%PATH_QTMSVC%\bin\moc.exe" GOTO:EOF +if not exist "%PATH_QTMSVC%\bin\rcc.exe" GOTO:EOF +REM ------------------------------------------ +set "LAMEXP_ERROR=0" diff --git a/etc/Deployment/_version.bat b/etc/Deployment/_version.bat index 1d5a145d..bb2add14 100644 --- a/etc/Deployment/_version.bat +++ b/etc/Deployment/_version.bat @@ -7,12 +7,12 @@ set "VER_LAMEXP_MINOR_LO=" set "VER_LAMEXP_BUILD=" set "VER_LAMEXP_SUFFIX=" REM ------------------------------------------ -FOR /F "tokens=2,3" %%s IN (..\..\src\Resource.h) DO ( - if "%%s"=="VER_LAMEXP_MAJOR" set "VER_LAMEXP_MAJOR=%%t" - if "%%s"=="VER_LAMEXP_MINOR_HI" set "VER_LAMEXP_MINOR_HI=%%t" - if "%%s"=="VER_LAMEXP_MINOR_LO" set "VER_LAMEXP_MINOR_LO=%%t" - if "%%s"=="VER_LAMEXP_BUILD" set "VER_LAMEXP_BUILD=%%t" - if "%%s"=="VER_LAMEXP_SUFFIX" set "VER_LAMEXP_SUFFIX=%%t" +for /f "tokens=2,*" %%s in (..\..\src\Config.h) do ( + if "%%s"=="VER_LAMEXP_MAJOR" set "VER_LAMEXP_MAJOR=%%~t" + if "%%s"=="VER_LAMEXP_MINOR_HI" set "VER_LAMEXP_MINOR_HI=%%~t" + if "%%s"=="VER_LAMEXP_MINOR_LO" set "VER_LAMEXP_MINOR_LO=%%~t" + if "%%s"=="VER_LAMEXP_BUILD" set "VER_LAMEXP_BUILD=%%~t" + if "%%s"=="VER_LAMEXP_SUFFIX" set "VER_LAMEXP_SUFFIX=%%~t" ) REM ------------------------------------------ set "LAMEXP_ERROR=1" diff --git a/etc/Deployment/buildenv.txt b/etc/Deployment/buildenv.txt new file mode 100644 index 00000000..628cc822 --- /dev/null +++ b/etc/Deployment/buildenv.txt @@ -0,0 +1,6 @@ +#define PATH_SEVENZ "E:\7-Zip" +#define PATH_MPRESS "E:\MPress" +#define PATH_UPXBIN "E:\MPUI\installer" +#define PATH_MKNSIS "E:\NSIS" +#define PATH_MSVC90 "D:\Microsoft Visual Studio 9.0" +#define PATH_QTMSVC "E:\Qt\MSVC\4.7.1" diff --git a/etc/Deployment/release.bat b/etc/Deployment/release.bat index 97c6937a..f421e8e9 100644 --- a/etc/Deployment/release.bat +++ b/etc/Deployment/release.bat @@ -1,17 +1,28 @@ @echo off +REM ------------------------------------------ +REM :: SETUP PATHS :: +REM ------------------------------------------ call _paths.bat +if not "%LAMEXP_ERROR%"=="0" ( + call _error.bat "FAILD TO SETUP PATHS. CHECK YOUR 'BUILDENV.TXT' FILE" + GOTO:EOF +) REM ------------------------------------------ set "OUT_PATH=..\..\bin\Release" set "OUT_DATE=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%" set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.Release" set "TMP_PATH=%TEMP%\~LameXP.%OUT_DATE%.tmp" REM ------------------------------------------ +REM :: READ VERSION INFO :: +REM ------------------------------------------ call _version.bat if not "%LAMEXP_ERROR%"=="0" ( call _error.bat "FAILD TO READ VERSION INFO!" GOTO:EOF ) REM ------------------------------------------ +REM :: CLEAN UP :: +REM ------------------------------------------ del "%OUT_FILE%.exe" del "%OUT_FILE%.zip" if exist "%OUT_FILE%.exe" ( @@ -23,12 +34,16 @@ if exist "%OUT_FILE%.zip" ( GOTO:EOF ) REM ------------------------------------------ +REM :: BUILD BINARIES :: +REM ------------------------------------------ call _build.bat "..\..\LameXP.sln" Release if not "%LAMEXP_ERROR%"=="0" ( call _error.bat "BUILD HAS FAILED" GOTO:EOF ) +REM ------------------------------------------ +REM :: POST BUILD :: REM ------------------------------------------ rd /S /Q "%TMP_PATH%" mkdir "%TMP_PATH%" @@ -42,17 +57,19 @@ copy "%QTDIR%\bin\QtSvg4.dll" "%TMP_PATH%" copy "%QTDIR%\plugins\imageformats\q???4.dll" "%TMP_PATH%\imageformats" REM ------------------------------------------ for %%f in ("%TMP_PATH%\*.exe") do ( - "%PATH_UPXBIN%" --best --lzma "%%f" + "%PATH_UPXBIN%\upx.exe" --best --lzma "%%f" ) for %%f in ("%TMP_PATH%\*.dll") do ( - "%PATH_UPXBIN%" --best --lzma "%%f" + "%PATH_UPXBIN%\upx.exe" --best --lzma "%%f" ) REM ------------------------------------------ copy "..\Redist\*.*" "%TMP_PATH%" copy "..\..\License.txt" "%TMP_PATH%" REM ------------------------------------------ -"%PATH_SEVENZ%" a -tzip -r "%OUT_FILE%.zip" "%TMP_PATH%\*" -"%PATH_MKNSIS%" "/DLAMEXP_SOURCE_PATH=%TMP_PATH%" "/DLAMEXP_OUTPUT_FILE=%OUT_FILE%.exe" "/DLAMEXP_DATE=%OUT_DATE%" "/DLAMEXP_VERSION=%VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%" "/DLAMEXP_BUILD=%VER_LAMEXP_BUILD%" "/DLAMEXP_SUFFIX=%VER_LAMEXP_SUFFIX%" "..\NSIS\setup.nsi" +REM :: CREATE PACKAGES :: +REM ------------------------------------------ +"%PATH_SEVENZ%\7z.exe" a -tzip -r "%OUT_FILE%.zip" "%TMP_PATH%\*" +"%PATH_MKNSIS%\makensis.exe" "/DLAMEXP_SOURCE_PATH=%TMP_PATH%" "/DLAMEXP_OUTPUT_FILE=%OUT_FILE%.exe" "/DLAMEXP_DATE=%OUT_DATE%" "/DLAMEXP_VERSION=%VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%" "/DLAMEXP_BUILD=%VER_LAMEXP_BUILD%" "/DLAMEXP_SUFFIX=%VER_LAMEXP_SUFFIX%" "..\NSIS\setup.nsi" rd /S /Q "%TMP_PATH%" REM ------------------------------------------ if not exist "%OUT_FILE%.zip" (