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 ------------------------------------------
42 call _build.bat "..\..\LameXP.sln" "%LAMEXP_CONFIG%"
43 if not "%LAMEXP_ERROR%"=="0" (
44 call _error.bat "BUILD HAS FAILED"
47 REM ------------------------------------------
48 REM :SkipBuildThisTime
49 REM ------------------------------------------
50 REM :: READ VERSION INFO ::
51 REM ------------------------------------------
53 if not "%LAMEXP_ERROR%"=="0" (
54 call _error.bat "FAILD TO READ VERSION INFO!"
57 REM ------------------------------------------
58 set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%"
59 for /L %%n in (1, 1, 99) do (
60 if exist "!OUT_FILE!.exe" set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%.Update-%%n"
61 if exist "!OUT_FILE!.zip" set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%.Update-%%n"
63 REM ------------------------------------------
64 REM :: DELETE OLD OUTPUT FILE ::
65 REM ------------------------------------------
68 REM ------------------------------------------
69 if exist "%OUT_FILE%.exe" (
70 call _error.bat "FAILD TO DELET EXISTING FILE"
73 if exist "%OUT_FILE%.zip" (
74 call _error.bat "FAILD TO DELET EXISTING FILE"
77 REM ------------------------------------------
79 REM ------------------------------------------
82 copy "%OUT_PATH%\*.exe" "%TMP_PATH%"
83 REM ------------------------------------------
84 if "%LAMEXP_REDIST%"=="1" (
85 copy "%QTDIR%\bin\QtCore4.dll" "%TMP_PATH%"
86 copy "%QTDIR%\bin\QtGui4.dll" "%TMP_PATH%"
87 copy "%QTDIR%\bin\QtXml4.dll" "%TMP_PATH%"
88 copy "%QTDIR%\bin\QtSvg4.dll" "%TMP_PATH%"
89 mkdir "%TMP_PATH%\imageformats"
90 copy "%QTDIR%\plugins\imageformats\q???4.dll" "%TMP_PATH%\imageformats"
92 REM ------------------------------------------
93 for %%f in ("%TMP_PATH%\*.exe") do (
94 "%PATH_UPXBIN%\upx.exe" --best --lzma "%%f"
96 for %%f in ("%TMP_PATH%\*.dll") do (
97 "%PATH_UPXBIN%\upx.exe" --best --lzma "%%f"
99 REM ------------------------------------------
100 if exist _postproc.bat (
101 call _postproc.bat "%TMP_PATH%"
103 REM ------------------------------------------
104 if "%LAMEXP_REDIST%"=="1" (
105 copy "..\Redist\*.*" "%TMP_PATH%"
107 copy "..\..\License.txt" "%TMP_PATH%"
108 REM ------------------------------------------
109 REM :: CREATE PACKAGES ::
110 REM ------------------------------------------
111 "%PATH_SEVENZ%\7z.exe" a -tzip -r "%OUT_FILE%.zip" "%TMP_PATH%\*"
112 "%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"
113 rd /S /Q "%TMP_PATH%"
114 REM ------------------------------------------
115 if not exist "%OUT_FILE%.zip" (
116 call _error.bat "PACKAGING HAS FAILED"
119 if not exist "%OUT_FILE%.exe" (
120 call _error.bat "PACKAGING HAS FAILED"
123 REM ------------------------------------------
124 attrib +R "%OUT_FILE%.zip"
125 attrib +R "%OUT_FILE%.exe"
126 REM ------------------------------------------
127 REM :: CREATE SIGNATURE ::
128 REM ------------------------------------------
129 "%PATH_GNUPG1%\gpg.exe" --detach-sign "%OUT_FILE%.exe"
130 attrib +R "%OUT_FILE%.exe.sig"
131 REM ------------------------------------------
133 echo BUIDL COMPLETED SUCCESSFULLY :-)
135 REM ------------------------------------------