make_boot.bat 9.1 KB

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