| 1 |
:: |
| 2 |
:: This bat file doesn't use cd, all the paths are full paths. |
| 3 |
:: with this convention this bat file is position independent |
| 4 |
:: and it will be easier to move the place of somefiles. |
| 5 |
:: |
| 6 |
|
| 7 |
@echo off |
| 8 |
set ERRLEV=0 |
| 9 |
|
| 10 |
:CHECK_ENV |
| 11 |
@call setenvvar.bat |
| 12 |
@if errorlevel 1 (goto :END) |
| 13 |
|
| 14 |
@call set_build_target.bat %* |
| 15 |
|
| 16 |
|
| 17 |
::=========== |
| 18 |
:MAIN |
| 19 |
@echo. |
| 20 |
@echo Creating directories |
| 21 |
:: Create the directory hierarchy. |
| 22 |
for %%v in ( alice auth burp dsql gpre isql jrd misc msgs qli examples yvalve utilities) do ( |
| 23 |
@mkdir %FB_GEN_DIR%\%%v 2>nul |
| 24 |
) |
| 25 |
|
| 26 |
@mkdir %FB_GEN_DIR%\utilities\gstat 2>nul |
| 27 |
@mkdir %FB_GEN_DIR%\auth\SecurityDatabase 2>nul |
| 28 |
@mkdir %FB_GEN_DIR%\gpre\std 2>nul |
| 29 |
|
| 30 |
call :interfaces |
| 31 |
if "%ERRLEV%"=="1" goto :END |
| 32 |
|
| 33 |
call :btyacc |
| 34 |
if "%ERRLEV%"=="1" goto :END |
| 35 |
|
| 36 |
call :LibTom |
| 37 |
if "%ERRLEV%"=="1" goto :END |
| 38 |
|
| 39 |
call :decNumber |
| 40 |
if "%ERRLEV%"=="1" goto :END |
| 41 |
|
| 42 |
if "%FB_TARGET_PLATFORM%"=="x64" call :ttmath |
| 43 |
if "%ERRLEV%"=="1" goto :END |
| 44 |
|
| 45 |
call :re2 |
| 46 |
if "%ERRLEV%"=="1" goto :END |
| 47 |
|
| 48 |
call :zlib |
| 49 |
if "%ERRLEV%"=="1" goto :END |
| 50 |
|
| 51 |
@echo Generating DSQL parser... |
| 52 |
@call parse.bat %* |
| 53 |
if "%ERRLEV%"=="1" goto :END |
| 54 |
|
| 55 |
::======= |
| 56 |
call :gpre_boot |
| 57 |
if "%ERRLEV%"=="1" goto :END |
| 58 |
|
| 59 |
::======= |
| 60 |
@echo Preprocessing the source files needed to build gbak, gpre and isql... |
| 61 |
@call preprocess.bat BOOT |
| 62 |
|
| 63 |
::======= |
| 64 |
call :engine |
| 65 |
if "%ERRLEV%"=="1" goto :END |
| 66 |
|
| 67 |
call :gbak |
| 68 |
if "%ERRLEV%"=="1" goto :END |
| 69 |
|
| 70 |
call :gpre |
| 71 |
if "%ERRLEV%"=="1" goto :END |
| 72 |
|
| 73 |
call :isql |
| 74 |
if "%ERRLEV%"=="1" goto :END |
| 75 |
|
| 76 |
@copy %FB_ROOT_PATH%\builds\install\misc\firebird.conf %FB_BIN_DIR%\firebird.conf |
| 77 |
|
| 78 |
:: Copy ICU and zlib both to Debug and Release configurations |
| 79 |
|
| 80 |
@call set_build_target.bat %* RELEASE |
| 81 |
@mkdir %FB_BIN_DIR% |
| 82 |
@copy %FB_ROOT_PATH%\extern\icu\icudt???.dat %FB_BIN_DIR% >nul 2>&1 |
| 83 |
@copy %FB_ICU_SOURCE_BIN%\*.dll %FB_BIN_DIR% >nul 2>&1 |
| 84 |
@copy %FB_ROOT_PATH%\extern\zlib\%FB_TARGET_PLATFORM%\*.dll %FB_BIN_DIR% >nul 2>&1 |
| 85 |
|
| 86 |
@call set_build_target.bat %* DEBUG |
| 87 |
@mkdir %FB_BIN_DIR% |
| 88 |
@copy %FB_ROOT_PATH%\extern\icu\icudt???.dat %FB_BIN_DIR% >nul 2>&1 |
| 89 |
@copy %FB_ICU_SOURCE_BIN%\*.dll %FB_BIN_DIR% >nul 2>&1 |
| 90 |
@copy %FB_ROOT_PATH%\extern\zlib\%FB_TARGET_PLATFORM%\*.dll %FB_BIN_DIR% >nul 2>&1 |
| 91 |
|
| 92 |
@call set_build_target.bat %* |
| 93 |
|
| 94 |
|
| 95 |
::======= |
| 96 |
@call :databases |
| 97 |
|
| 98 |
::======= |
| 99 |
@echo Preprocessing the entire source tree... |
| 100 |
@call preprocess.bat |
| 101 |
|
| 102 |
::======= |
| 103 |
@call :msgs |
| 104 |
if "%ERRLEV%"=="1" goto :END |
| 105 |
|
| 106 |
@call :codes |
| 107 |
if "%ERRLEV%"=="1" goto :END |
| 108 |
|
| 109 |
::======= |
| 110 |
@call create_msgs.bat msg |
| 111 |
::======= |
| 112 |
|
| 113 |
@call :NEXT_STEP |
| 114 |
@goto :END |
| 115 |
|
| 116 |
|
| 117 |
::=================== |
| 118 |
:: BUILD btyacc |
| 119 |
:btyacc |
| 120 |
@echo. |
| 121 |
@echo Building btyacc (%FB_OBJ_DIR%)... |
| 122 |
@call compile.bat builds\win32\%VS_VER%\FirebirdBoot btyacc_%FB_TARGET_PLATFORM%.log btyacc |
| 123 |
if errorlevel 1 call :boot2 btyacc |
| 124 |
goto :EOF |
| 125 |
|
| 126 |
::=================== |
| 127 |
:: BUILD LibTom |
| 128 |
:: NS: Note we need both debug and non-debug version as it is a static library linked to CRT |
| 129 |
:: and linking executable with both debug and non-debug CRT results in undefined behavior |
| 130 |
:LibTom |
| 131 |
@echo. |
| 132 |
@call set_build_target.bat %* RELEASE |
| 133 |
@echo Building LibTomMath (%FB_OBJ_DIR%)... |
| 134 |
@call compile.bat extern\libtommath\libtommath_MSVC%MSVC_VERSION% libtommath_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log libtommath |
| 135 |
if errorlevel 1 call :boot2 libtommath_%FB_OBJ_DIR% |
| 136 |
@echo Building LibTomCrypt (%FB_OBJ_DIR%)... |
| 137 |
@call compile.bat extern\libtomcrypt\libtomcrypt_MSVC%MSVC_VERSION% libtomcrypt_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log libtomcrypt |
| 138 |
if errorlevel 1 call :boot2 libtomcrypt_%FB_OBJ_DIR% |
| 139 |
|
| 140 |
@call set_build_target.bat %* DEBUG |
| 141 |
@echo Building LibTomMath (%FB_OBJ_DIR%)... |
| 142 |
@call compile.bat extern\libtommath\libtommath_MSVC%MSVC_VERSION% libtommath_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log libtommath |
| 143 |
if errorlevel 1 call :boot2 libtommath_%FB_OBJ_DIR% |
| 144 |
@echo Building LibTomCrypt (%FB_OBJ_DIR%)... |
| 145 |
@call compile.bat extern\libtomcrypt\libtomcrypt_MSVC%MSVC_VERSION% libtomcrypt_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log libtomcrypt |
| 146 |
if errorlevel 1 call :boot2 libtomcrypt_%FB_OBJ_DIR% |
| 147 |
|
| 148 |
@call set_build_target.bat %* |
| 149 |
goto :EOF |
| 150 |
|
| 151 |
::=================== |
| 152 |
:: BUILD decNumber |
| 153 |
:decNumber |
| 154 |
@echo. |
| 155 |
@call set_build_target.bat %* RELEASE |
| 156 |
@echo Building decNumber (%FB_OBJ_DIR%)... |
| 157 |
@call compile.bat extern\decNumber\msvc\decNumber_MSVC%MSVC_VERSION% decNumber_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log decNumber |
| 158 |
if errorlevel 1 call :boot2 decNumber_%FB_OBJ_DIR% |
| 159 |
@call set_build_target.bat %* DEBUG |
| 160 |
@echo Building decNumber (%FB_OBJ_DIR%)... |
| 161 |
@call compile.bat extern\decNumber\msvc\decNumber_MSVC%MSVC_VERSION% decNumber_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log decNumber |
| 162 |
if errorlevel 1 call :boot2 decNumber_%FB_OBJ_DIR% |
| 163 |
@call set_build_target.bat %* |
| 164 |
goto :EOF |
| 165 |
|
| 166 |
::=================== |
| 167 |
:: BUILD ttmath |
| 168 |
:ttmath |
| 169 |
@echo. |
| 170 |
@call set_build_target.bat %* RELEASE |
| 171 |
@echo Building ttmath (%FB_OBJ_DIR%)... |
| 172 |
@mkdir %FB_TEMP_DIR%\..\%FB_OBJ_DIR%\common 2>nul |
| 173 |
@ml64.exe /c /Fo %FB_TEMP_DIR%\..\%FB_OBJ_DIR%\common\ttmathuint_x86_64_msvc.obj %FB_ROOT_PATH%\extern\ttmath\ttmathuint_x86_64_msvc.asm |
| 174 |
if errorlevel 1 call :boot2 ttmath_%FB_OBJ_DIR% |
| 175 |
@call set_build_target.bat %* DEBUG |
| 176 |
@echo Building ttmath (%FB_OBJ_DIR%)... |
| 177 |
@mkdir %FB_TEMP_DIR%\..\%FB_OBJ_DIR%\common 2>nul |
| 178 |
@ml64.exe /c /Zi /Fo %FB_TEMP_DIR%\..\%FB_OBJ_DIR%\common\ttmathuint_x86_64_msvc.obj %FB_ROOT_PATH%\extern\ttmath\ttmathuint_x86_64_msvc.asm |
| 179 |
if errorlevel 1 call :boot2 ttmath_%FB_OBJ_DIR% |
| 180 |
@call set_build_target.bat %* |
| 181 |
goto :EOF |
| 182 |
|
| 183 |
::=================== |
| 184 |
:: BUILD re2 |
| 185 |
:re2 |
| 186 |
@echo. |
| 187 |
@echo Building re2... |
| 188 |
@mkdir %FB_ROOT_PATH%\extern\re2\builds\%FB_TARGET_PLATFORM% 2>nul |
| 189 |
@pushd %FB_ROOT_PATH%\extern\re2\builds\%FB_TARGET_PLATFORM% |
| 190 |
@cmake -G "%MSVC_CMAKE_GENERATOR%" -A %FB_TARGET_PLATFORM% -S %FB_ROOT_PATH%\extern\re2 |
| 191 |
if errorlevel 1 call :boot2 re2 |
| 192 |
@cmake --build %FB_ROOT_PATH%\extern\re2\builds\%FB_TARGET_PLATFORM% --target ALL_BUILD --config Release > re2_Release_%FB_TARGET_PLATFORM%.log |
| 193 |
@cmake --build %FB_ROOT_PATH%\extern\re2\builds\%FB_TARGET_PLATFORM% --target ALL_BUILD --config Debug > re2_Debug_%FB_TARGET_PLATFORM%.log |
| 194 |
@popd |
| 195 |
goto :EOF |
| 196 |
|
| 197 |
::=================== |
| 198 |
:: Build CLOOP and generate interface headers |
| 199 |
:interfaces |
| 200 |
@echo. |
| 201 |
@echo Building CLOOP and generating interfaces... |
| 202 |
@nmake /s /x interfaces_%FB_TARGET_PLATFORM%.log /f gen_helper.nmake updateCloopInterfaces |
| 203 |
if errorlevel 1 call :boot2 interfaces |
| 204 |
goto :EOF |
| 205 |
|
| 206 |
::=================== |
| 207 |
:: Extract zlib |
| 208 |
:zlib |
| 209 |
@echo Extracting pre-built zlib |
| 210 |
if exist %FB_ROOT_PATH%\extern\zlib\zlib.h ( |
| 211 |
@echo %FB_ROOT_PATH%\extern\zlib\zlib.h already extracted |
| 212 |
) else ( |
| 213 |
%FB_ROOT_PATH%\extern\zlib\zlib.exe -y > zlib_%FB_TARGET_PLATFORM%.log |
| 214 |
if errorlevel 1 call :boot2 zlib |
| 215 |
) |
| 216 |
goto :EOF |
| 217 |
|
| 218 |
::=================== |
| 219 |
:: BUILD gpre_boot |
| 220 |
:gpre_boot |
| 221 |
@echo. |
| 222 |
@echo Building gpre_boot (%FB_OBJ_DIR%)... |
| 223 |
@call compile.bat builds\win32\%VS_VER%\FirebirdBoot gpre_boot_%FB_TARGET_PLATFORM%.log gpre_boot |
| 224 |
if errorlevel 1 call :boot2 gpre_boot |
| 225 |
goto :EOF |
| 226 |
|
| 227 |
::=================== |
| 228 |
:: BUILD engine |
| 229 |
:engine |
| 230 |
@echo. |
| 231 |
@echo Building engine (%FB_OBJ_DIR%)... |
| 232 |
@call compile.bat builds\win32\%VS_VER%\Firebird engine_%FB_TARGET_PLATFORM%.log engine |
| 233 |
@call compile.bat builds\win32\%VS_VER%\Firebird engine_%FB_TARGET_PLATFORM%.log ib_util |
| 234 |
if errorlevel 1 call :boot2 engine |
| 235 |
@goto :EOF |
| 236 |
|
| 237 |
::=================== |
| 238 |
:: BUILD gbak |
| 239 |
:gbak |
| 240 |
@echo. |
| 241 |
@echo Building gbak (%FB_OBJ_DIR%)... |
| 242 |
@call compile.bat builds\win32\%VS_VER%\Firebird gbak_%FB_TARGET_PLATFORM%.log gbak |
| 243 |
if errorlevel 1 call :boot2 gbak |
| 244 |
@goto :EOF |
| 245 |
|
| 246 |
::=================== |
| 247 |
:: BUILD gpre |
| 248 |
:gpre |
| 249 |
@echo. |
| 250 |
@echo Building gpre (%FB_OBJ_DIR%)... |
| 251 |
@call compile.bat builds\win32\%VS_VER%\Firebird gpre_%FB_TARGET_PLATFORM%.log gpre |
| 252 |
if errorlevel 1 call :boot2 gpre |
| 253 |
@goto :EOF |
| 254 |
|
| 255 |
::=================== |
| 256 |
:: BUILD isql |
| 257 |
:isql |
| 258 |
@echo. |
| 259 |
@echo Building isql (%FB_OBJ_DIR%)... |
| 260 |
@call compile.bat builds\win32\%VS_VER%\Firebird isql_%FB_TARGET_PLATFORM%.log isql |
| 261 |
if errorlevel 1 call :boot2 isql |
| 262 |
@goto :EOF |
| 263 |
|
| 264 |
::=================== |
| 265 |
:: ERROR boot |
| 266 |
:boot2 |
| 267 |
echo. |
| 268 |
echo Error building %1, see %1_%FB_TARGET_PLATFORM%.log |
| 269 |
echo. |
| 270 |
set ERRLEV=1 |
| 271 |
goto :EOF |
| 272 |
|
| 273 |
|
| 274 |
::=================== |
| 275 |
:: BUILD messages |
| 276 |
:msgs |
| 277 |
@echo. |
| 278 |
@echo Building build_msg (%FB_OBJ_DIR%)... |
| 279 |
@call compile.bat builds\win32\%VS_VER%\FirebirdBoot build_msg_%FB_TARGET_PLATFORM%.log build_msg |
| 280 |
if errorlevel 1 goto :msgs2 |
| 281 |
@goto :EOF |
| 282 |
:msgs2 |
| 283 |
echo. |
| 284 |
echo Error building build_msg, see build_msg_%FB_TARGET_PLATFORM%.log |
| 285 |
echo. |
| 286 |
set ERRLEV=1 |
| 287 |
goto :EOF |
| 288 |
|
| 289 |
::=================== |
| 290 |
:: BUILD codes |
| 291 |
:codes |
| 292 |
@echo. |
| 293 |
@echo Building codes (%FB_OBJ_DIR%)... |
| 294 |
@call compile.bat builds\win32\%VS_VER%\FirebirdBoot codes_%FB_TARGET_PLATFORM%.log codes |
| 295 |
if errorlevel 1 goto :codes2 |
| 296 |
@goto :EOF |
| 297 |
:codes2 |
| 298 |
echo. |
| 299 |
echo Error building codes, see codes_%FB_TARGET_PLATFORM%.log |
| 300 |
echo. |
| 301 |
set ERRLEV=1 |
| 302 |
goto :EOF |
| 303 |
|
| 304 |
::============== |
| 305 |
:databases |
| 306 |
@rmdir /s /q %FB_GEN_DIR%\dbs 2>nul |
| 307 |
@mkdir %FB_GEN_DIR%\dbs 2>nul |
| 308 |
|
| 309 |
@echo Create security4.fdb... |
| 310 |
@echo create database '%FB_GEN_DB_DIR%\dbs\security4.fdb'; | "%FB_BIN_DIR%\isql" -q |
| 311 |
@echo Apply security.sql... |
| 312 |
@"%FB_BIN_DIR%\isql" -q %FB_GEN_DB_DIR%/dbs/security4.fdb -i %FB_ROOT_PATH%\src\dbs\security.sql |
| 313 |
@copy %FB_GEN_DIR%\dbs\security4.fdb %FB_GEN_DIR%\dbs\security.fdb > nul |
| 314 |
|
| 315 |
@echo Restore metadata.gbak... |
| 316 |
@%FB_BIN_DIR%\gbak -r %FB_ROOT_PATH%\builds\misc\metadata.gbak %FB_GEN_DB_DIR%/dbs/metadata.fdb |
| 317 |
|
| 318 |
@call create_msgs.bat db |
| 319 |
|
| 320 |
@%FB_BIN_DIR%\gbak -r %FB_ROOT_PATH%\builds\misc\help.gbak %FB_GEN_DB_DIR%/dbs/help.fdb |
| 321 |
@copy %FB_GEN_DIR%\dbs\metadata.fdb %FB_GEN_DIR%\dbs\yachts.lnk > nul |
| 322 |
|
| 323 |
@goto :EOF |
| 324 |
|
| 325 |
|
| 326 |
::============== |
| 327 |
:NEXT_STEP |
| 328 |
@echo. |
| 329 |
@echo You may now run make_all.bat [DEBUG] [CLEAN] |
| 330 |
@echo. |
| 331 |
@goto :EOF |
| 332 |
|
| 333 |
:END |