make_boot.bat 7.6 KB

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