2 setlocal ENABLEDELAYEDEXPANSION
3 REM ------------------------------------------
4 REM :: SETUP ENVIRONMENT ::
5 REM ------------------------------------------
6 call "%~d0%~p0\_paths.bat"
7 if not "%LAMEXP_ERROR%"=="0" (
8 call "%~d0%~p0\_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=%~d0%~p0\..\..\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=%~d0%~p0\..\..\obj\%LAMEXP_CONFIG%"
25 set "MOC_PATH=%~d0%~p0\..\..\tmp"
26 set "IPC_PATH=%~d0%~p0\..\..\ipch"
27 REM ------------------------------------------
28 if "%LAMEXP_SKIP_BUILD%"=="YES" (
29 goto SkipBuildThisTime
31 REM ------------------------------------------
33 REM ------------------------------------------
34 del /Q "%OUT_PATH%\*.exe"
35 del /Q "%OUT_PATH%\*.dll"
36 del /Q "%OBJ_PATH%\*.obj"
37 del /Q "%OBJ_PATH%\*.res"
38 del /Q "%OBJ_PATH%\*.bat"
39 del /Q "%OBJ_PATH%\*.idb"
40 del /Q "%OBJ_PATH%\*.log"
41 del /Q "%OBJ_PATH%\*.manifest"
42 del /Q "%OBJ_PATH%\*.lastbuildstate"
43 del /Q "%OBJ_PATH%\*.htm"
44 del /Q "%OBJ_PATH%\*.dep"
45 del /Q "%MOC_PATH%\*.cpp"
46 del /Q "%MOC_PATH%\*.h"
47 del /Q /S "%IPC_PATH%\*.*"
48 REM ------------------------------------------
49 REM :: BUILD BINARIES ::
50 REM ------------------------------------------
51 call "%~d0%~p0\_lupdate.bat"
52 call "%~d0%~p0\_build.bat" "%~d0%~p0\..\..\%PATH_VCPROJ%" "%LAMEXP_CONFIG%"
53 if not "%LAMEXP_ERROR%"=="0" (
54 call "%~d0%~p0\_error.bat" "BUILD HAS FAILED"
57 REM ------------------------------------------
59 REM ------------------------------------------
60 REM :: READ VERSION INFO ::
61 REM ------------------------------------------
62 call "%~d0%~p0\_version.bat"
63 if not "%LAMEXP_ERROR%"=="0" (
64 call "%~d0%~p0\_error.bat" "FAILD TO READ VERSION INFO!"
67 REM ------------------------------------------
68 set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%"
69 for /L %%n in (1, 1, 99) do (
70 if exist "!OUT_FILE!.exe" set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%.Update-%%n"
71 if exist "!OUT_FILE!.zip" set "OUT_FILE=%OUT_PATH%\..\LameXP.%OUT_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%.Update-%%n"
73 REM ------------------------------------------
74 REM :: DELETE OLD OUTPUT FILE ::
75 REM ------------------------------------------
78 REM ------------------------------------------
79 if exist "%OUT_FILE%.exe" (
80 call "%~d0%~p0\_error.bat" "FAILD TO DELET EXISTING FILE"
83 if exist "%OUT_FILE%.zip" (
84 call "%~d0%~p0\_error.bat" "FAILD TO DELET EXISTING FILE"
87 REM ------------------------------------------
89 REM ------------------------------------------
92 copy "%OUT_PATH%\*.exe" "%TMP_PATH%"
93 REM ------------------------------------------
94 if "%LAMEXP_REDIST%"=="1" (
95 copy "%QTDIR%\bin\QtCore4.dll" "%TMP_PATH%"
96 copy "%QTDIR%\bin\QtGui4.dll" "%TMP_PATH%"
97 copy "%QTDIR%\bin\QtXml4.dll" "%TMP_PATH%"
98 copy "%QTDIR%\bin\QtSvg4.dll" "%TMP_PATH%"
99 mkdir "%TMP_PATH%\imageformats"
100 copy "%QTDIR%\plugins\imageformats\q???4.dll" "%TMP_PATH%\imageformats"
102 REM ------------------------------------------
103 for %%f in ("%TMP_PATH%\*.exe") do (
104 "%PATH_UPXBIN%\upx.exe" --best "%%f"
106 for %%f in ("%TMP_PATH%\*.dll") do (
107 "%PATH_UPXBIN%\upx.exe" --best "%%f"
109 REM ------------------------------------------
110 if exist "%~d0%~p0\_postproc.bat" (
111 call "%~d0%~p0\_postproc.bat" "%TMP_PATH%"
113 REM ------------------------------------------
114 if "%LAMEXP_REDIST%"=="1" (
115 copy "..\Redist\*.*" "%TMP_PATH%"
117 copy "%~d0%~p0\..\..\ReadMe.txt" "%TMP_PATH%"
118 copy "%~d0%~p0\..\..\License.txt" "%TMP_PATH%"
119 copy "%~d0%~p0\..\..\doc\Changelog.html" "%TMP_PATH%"
120 copy "%~d0%~p0\..\..\doc\Translate.html" "%TMP_PATH%"
121 copy "%~d0%~p0\..\..\doc\FAQ.html" "%TMP_PATH%"
122 REM ------------------------------------------
123 REM :: CREATE PACKAGES ::
124 REM ------------------------------------------
125 "%PATH_SEVENZ%\7z.exe" a -tzip -r "%OUT_FILE%.zip" "%TMP_PATH%\*"
126 "%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_INSTTYPE=%VER_LAMEXP_TYPE%" "/DLAMEXP_PATCH=%VER_LAMEXP_PATCH%" "%~d0%~p0\..\NSIS\setup.nsi"
127 rd /S /Q "%TMP_PATH%"
128 REM ------------------------------------------
129 if not exist "%OUT_FILE%.zip" (
130 call "%~d0%~p0\_error.bat" "PACKAGING HAS FAILED"
133 if not exist "%OUT_FILE%.exe" (
134 call "%~d0%~p0\_error.bat" "PACKAGING HAS FAILED"
137 REM ------------------------------------------
138 attrib +R "%OUT_FILE%.zip"
139 attrib +R "%OUT_FILE%.exe"
140 REM ------------------------------------------
141 REM :: CREATE SIGNATURE ::
142 REM ------------------------------------------
143 "%PATH_GNUPG1%\gpg.exe" --detach-sign "%OUT_FILE%.exe"
144 attrib +R "%OUT_FILE%.exe.sig"
145 REM ------------------------------------------
147 echo BUIDL COMPLETED SUCCESSFULLY :-)
149 REM ------------------------------------------