2 setlocal ENABLEDELAYEDEXPANSION
3 REM ------------------------------------------
4 REM :: SETUP ENVIRONMENT ::
5 REM ------------------------------------------
7 if not "%LAMEXP_ERROR%"=="0" (
8 call _error.bat "FAILD TO SETUP PATHS. CHECK YOUR 'BUILDENV.TXT' FILE"
11 REM ------------------------------------------
12 if "%LAMEXP_CONFIG%"=="" (
13 set "LAMEXP_CONFIG=Release"
15 if not "%LAMEXP_REDIST%"=="0" (
18 REM ------------------------------------------
20 REM ------------------------------------------
21 set "OUT_PATH=..\..\bin\%LAMEXP_CONFIG%"
22 set "OUT_DATE=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%"
23 set "TMP_PATH=%TEMP%\~LameXP.%LAMEXP_CONFIG%.%OUT_DATE%.tmp"
24 set "OBJ_PATH=..\..\obj\%LAMEXP_CONFIG%"
25 set "MOC_PATH=..\..\tmp"
26 REM ------------------------------------------
27 REM goto SkipBuildThisTime
28 REM ------------------------------------------
30 REM ------------------------------------------
31 del /Q "%OUT_PATH%\*.exe"
32 del /Q "%OUT_PATH%\*.dll"
33 del /Q "%OBJ_PATH%\*.obj"
34 del /Q "%OBJ_PATH%\*.res"
35 del /Q "%OBJ_PATH%\*.bat"
36 del /Q "%OBJ_PATH%\*.idb"
37 del /Q "%MOC_PATH%\*.cpp"
38 del /Q "%MOC_PATH%\*.h"
39 REM ------------------------------------------
40 REM :: BUILD BINARIES ::
41 REM ------------------------------------------
43 call _build.bat "..\..\LameXP.sln" "%LAMEXP_CONFIG%"
44 if not "%LAMEXP_ERROR%"=="0" (
45 call _error.bat "BUILD HAS FAILED"
48 REM ------------------------------------------
49 REM :SkipBuildThisTime
50 REM ------------------------------------------
51 REM :: READ VERSION INFO ::
52 REM ------------------------------------------
54 if not "%LAMEXP_ERROR%"=="0" (
55 call _error.bat "FAILD TO READ VERSION INFO!"
58 REM ------------------------------------------
59 set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%"
60 for /L %%n in (1, 1, 99) do (
61 if exist "!OUT_FILE!.exe" set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%.Update-%%n"
62 if exist "!OUT_FILE!.zip" set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%.Update-%%n"
64 REM ------------------------------------------
65 REM :: DELETE OLD OUTPUT FILE ::
66 REM ------------------------------------------
69 REM ------------------------------------------
70 if exist "%OUT_FILE%.exe" (
71 call _error.bat "FAILD TO DELET EXISTING FILE"
74 if exist "%OUT_FILE%.zip" (
75 call _error.bat "FAILD TO DELET EXISTING FILE"
78 REM ------------------------------------------
80 REM ------------------------------------------
83 copy "%OUT_PATH%\*.exe" "%TMP_PATH%"
84 REM ------------------------------------------
85 if "%LAMEXP_REDIST%"=="1" (
86 copy "%QTDIR%\bin\QtCore4.dll" "%TMP_PATH%"
87 copy "%QTDIR%\bin\QtGui4.dll" "%TMP_PATH%"
88 copy "%QTDIR%\bin\QtXml4.dll" "%TMP_PATH%"
89 copy "%QTDIR%\bin\QtSvg4.dll" "%TMP_PATH%"
90 mkdir "%TMP_PATH%\imageformats"
91 copy "%QTDIR%\plugins\imageformats\q???4.dll" "%TMP_PATH%\imageformats"
93 REM ------------------------------------------
94 for %%f in ("%TMP_PATH%\*.exe") do (
95 "%PATH_UPXBIN%\upx.exe" --best "%%f"
97 for %%f in ("%TMP_PATH%\*.dll") do (
98 "%PATH_UPXBIN%\upx.exe" --best "%%f"
100 REM ------------------------------------------
101 if exist _postproc.bat (
102 call _postproc.bat "%TMP_PATH%"
104 REM ------------------------------------------
105 if "%LAMEXP_REDIST%"=="1" (
106 copy "..\Redist\*.*" "%TMP_PATH%"
108 copy "..\..\ReadMe.txt" "%TMP_PATH%"
109 copy "..\..\License.txt" "%TMP_PATH%"
110 copy "..\..\doc\Changelog.html" "%TMP_PATH%"
111 copy "..\..\doc\Translate.html" "%TMP_PATH%"
112 copy "..\..\doc\FAQ.html" "%TMP_PATH%"
113 REM ------------------------------------------
114 REM :: CREATE PACKAGES ::
115 REM ------------------------------------------
116 "%PATH_SEVENZ%\7z.exe" a -tzip -r "%OUT_FILE%.zip" "%TMP_PATH%\*"
117 "%PATH_MKNSIS%\makensis.exe" "/DLAMEXP_SOURCE_PATH=%TMP_PATH%" "/DLAMEXP_OUTPUT_FILE=%OUT_FILE%.exe" "/DLAMEXP_UPX_PATH=%PATH_UPXBIN%" "/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"
118 rd /S /Q "%TMP_PATH%"
119 REM ------------------------------------------
120 if not exist "%OUT_FILE%.zip" (
121 call _error.bat "PACKAGING HAS FAILED"
124 if not exist "%OUT_FILE%.exe" (
125 call _error.bat "PACKAGING HAS FAILED"
128 REM ------------------------------------------
129 attrib +R "%OUT_FILE%.zip"
130 attrib +R "%OUT_FILE%.exe"
131 REM ------------------------------------------
132 REM :: CREATE SIGNATURE ::
133 REM ------------------------------------------
134 "%PATH_GNUPG1%\gpg.exe" --detach-sign "%OUT_FILE%.exe"
135 attrib +R "%OUT_FILE%.exe.sig"
136 REM ------------------------------------------
138 echo BUIDL COMPLETED SUCCESSFULLY :-)
140 REM ------------------------------------------