make_boot.bat 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. @setlocal EnableDelayedExpansion
  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 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. @mkdir %FB_BIN_DIR%\tzdata 2>nul
  24. call :interfaces
  25. if "!ERRLEV!"=="1" goto :END
  26. call :LibTom
  27. if "!ERRLEV!"=="1" goto :END
  28. call :decNumber
  29. if "!ERRLEV!"=="1" goto :END
  30. if "%FB_TARGET_PLATFORM%"=="x64" call :ttmath
  31. if "!ERRLEV!"=="1" goto :END
  32. call :zlib
  33. if "!ERRLEV!"=="1" goto :END
  34. @if "%FB_CLIENT_ONLY%"=="" (
  35. call :re2
  36. if "!ERRLEV!"=="1" goto :END
  37. call :btyacc
  38. if "!ERRLEV!"=="1" goto :END
  39. call :libcds
  40. if "!ERRLEV!"=="1" goto :END
  41. echo Generating DSQL parser...
  42. call parse.bat %*
  43. if "!ERRLEV!"=="1" goto :END
  44. ::=======
  45. call :gpre_boot
  46. if "!ERRLEV!"=="1" goto :END
  47. ::=======
  48. echo Preprocessing the source files needed to build gpre and isql...
  49. call preprocess.bat %FB_CONFIG% BOOT
  50. ::=======
  51. call :engine
  52. if "!ERRLEV!"=="1" goto :END
  53. call :gpre
  54. if "!ERRLEV!"=="1" goto :END
  55. call :isql
  56. if "!ERRLEV!"=="1" goto :END
  57. )
  58. @mkdir %FB_BIN_DIR% >nul 2>&1
  59. @mkdir %FB_BIN_DIR%\intl\ >nul 2>&1
  60. :: copy conf files only if not exists already
  61. for %%v in (firebird plugins) do (
  62. if not exist %FB_BIN_DIR%\%%v.conf (
  63. @copy %FB_ROOT_PATH%\builds\install\misc\%%v.conf %FB_BIN_DIR% >nul 2>&1
  64. )
  65. )
  66. @if "%FB_CLIENT_ONLY%"=="" (
  67. :: copy conf files only if not exists already
  68. for %%v in (databases replication) do (
  69. if not exist %FB_BIN_DIR%\%%v.conf (
  70. copy %FB_ROOT_PATH%\builds\install\misc\%%v.conf %FB_BIN_DIR% >nul 2>&1
  71. )
  72. )
  73. if not exist %FB_BIN_DIR%\intl\fbintl.conf (
  74. copy %FB_ROOT_PATH%\builds\install\misc\fbintl.conf %FB_BIN_DIR%\intl\ >nul 2>&1
  75. )
  76. )
  77. :: Copy ICU and zlib to the output directory
  78. @copy %FB_ROOT_PATH%\extern\icu\icudt???.dat %FB_BIN_DIR% >nul 2>&1
  79. @copy %FB_ICU_SOURCE_BIN%\*.dll %FB_BIN_DIR% >nul 2>&1
  80. @copy %FB_ROOT_PATH%\extern\icu\tzdata-extract\* %FB_BIN_DIR%\tzdata >nul 2>&1
  81. @copy %FB_ROOT_PATH%\extern\zlib\%FB_TARGET_PLATFORM%\*.dll %FB_BIN_DIR% >nul 2>&1
  82. @if "%FB_CLIENT_ONLY%"=="" (
  83. ::=======
  84. call :databases
  85. if "!ERRLEV!"=="1" goto :END
  86. :: copy security db if not exists already
  87. if not exist %FB_BIN_DIR%\security6.fdb (
  88. copy %FB_GEN_DIR%\dbs\security6.fdb %FB_BIN_DIR%
  89. )
  90. ::=======
  91. echo Preprocessing the entire source tree...
  92. call preprocess.bat %FB_CONFIG%
  93. )
  94. ::=======
  95. @call create_msgs.bat %FB_CONFIG%
  96. ::=======
  97. @call :NEXT_STEP
  98. @goto :END
  99. ::===================
  100. :: BUILD btyacc
  101. :btyacc
  102. @echo.
  103. @echo Building btyacc (%FB_OBJ_DIR%)...
  104. @call compile.bat builds\win32\%VS_VER%\FirebirdBoot btyacc_%FB_TARGET_PLATFORM%.log btyacc
  105. if errorlevel 1 call :boot2 btyacc
  106. goto :EOF
  107. ::===================
  108. :: BUILD LibTom
  109. :LibTom
  110. @echo.
  111. @echo Building LibTomMath (%FB_OBJ_DIR%)...
  112. @call compile.bat extern\libtommath\libtommath_MSVC%MSVC_VERSION% libtommath_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log libtommath
  113. if errorlevel 1 call :boot2 libtommath_%FB_OBJ_DIR%
  114. @echo Building LibTomCrypt (%FB_OBJ_DIR%)...
  115. @call compile.bat extern\libtomcrypt\libtomcrypt_MSVC%MSVC_VERSION% libtomcrypt_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log libtomcrypt
  116. if errorlevel 1 call :boot2 libtomcrypt_%FB_OBJ_DIR%
  117. goto :EOF
  118. ::===================
  119. :: BUILD decNumber
  120. :decNumber
  121. @echo.
  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. goto :EOF
  126. ::===================
  127. :: Build libcds
  128. :libcds
  129. @echo.
  130. set FB_LIBCDS=1
  131. @echo Building libcds (%FB_OBJ_DIR%)...
  132. @call compile.bat extern\libcds\projects\Win\vc141\cds libcds_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log cds
  133. if errorlevel 1 call :boot2 libcds%FB_OBJ_DIR%
  134. set FB_LIBCDS=
  135. goto :EOF
  136. ::===================
  137. :: BUILD ttmath
  138. :ttmath
  139. @echo.
  140. @echo Building ttmath (%FB_OBJ_DIR%)...
  141. @mkdir %FB_ROOT_PATH%\extern\ttmath\%FB_CONFIG% 2>nul
  142. if not "%FB_TARGET_PLATFORM%"=="arm64" (
  143. if /I "%FB_CONFIG%"=="debug" (
  144. @ml64.exe /c /Zi /Fo %FB_ROOT_PATH%\extern\ttmath\%FB_CONFIG%\ttmathuint_x86_64_msvc.obj %FB_ROOT_PATH%\extern\ttmath\ttmathuint_x86_64_msvc.asm
  145. ) else (
  146. @ml64.exe /c /Fo %FB_ROOT_PATH%\extern\ttmath\%FB_CONFIG%\ttmathuint_x86_64_msvc.obj %FB_ROOT_PATH%\extern\ttmath\ttmathuint_x86_64_msvc.asm
  147. )
  148. )
  149. if errorlevel 1 call :boot2 ttmath_%FB_OBJ_DIR%
  150. goto :EOF
  151. ::===================
  152. :: BUILD re2
  153. :re2
  154. @echo.
  155. @echo Building re2...
  156. @mkdir %FB_ROOT_PATH%\extern\re2\builds\%FB_TARGET_PLATFORM% 2>nul
  157. @pushd %FB_ROOT_PATH%\extern\re2\builds\%FB_TARGET_PLATFORM%
  158. @cmake -G "%MSVC_CMAKE_GENERATOR%" -A %FB_TARGET_PLATFORM% -S %FB_ROOT_PATH%\extern\re2
  159. if errorlevel 1 call :boot2 re2
  160. @cmake --build %FB_ROOT_PATH%\extern\re2\builds\%FB_TARGET_PLATFORM% --target ALL_BUILD --config %FB_CONFIG% > re2_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log
  161. @popd
  162. goto :EOF
  163. ::===================
  164. :: Build CLOOP and generate interface headers
  165. :interfaces
  166. @echo.
  167. @echo Building CLOOP and generating interfaces...
  168. @mkdir %FB_GEN_DIR%\%FB_TARGET_PLATFORM%\cloop 2>nul
  169. @pushd %FB_GEN_DIR%\%FB_TARGET_PLATFORM%\cloop
  170. @cmake -G "%MSVC_CMAKE_GENERATOR%" -A %FB_TARGET_PLATFORM% -S %FB_ROOT_PATH%\extern\cloop -DCLOOP_BUILD_TESTS=OFF
  171. if errorlevel 1 call :boot2 interfaces
  172. @cmake --build %FB_GEN_DIR%\%FB_TARGET_PLATFORM%\cloop --target ALL_BUILD --config %FB_CONFIG% > cloop_%FB_CONFIG%_%FB_TARGET_PLATFORM%.log
  173. if errorlevel 1 call :boot2 interfaces
  174. @popd
  175. @nmake /s /x interfaces_%FB_TARGET_PLATFORM%.log /f gen_helper.nmake updateCloopInterfaces
  176. if errorlevel 1 call :boot2 interfaces
  177. goto :EOF
  178. ::===================
  179. :: Extract zlib
  180. :zlib
  181. @echo Extracting pre-built zlib
  182. if exist %FB_ROOT_PATH%\extern\zlib\zlib.h (
  183. @echo %FB_ROOT_PATH%\extern\zlib\zlib.h already extracted
  184. ) else (
  185. %FB_ROOT_PATH%\extern\zlib\zlib.exe -y > zlib_%FB_TARGET_PLATFORM%.log
  186. if errorlevel 1 call :boot2 zlib
  187. )
  188. goto :EOF
  189. ::===================
  190. :: BUILD gpre_boot
  191. :gpre_boot
  192. @echo.
  193. @echo Building gpre_boot (%FB_OBJ_DIR%)...
  194. @call compile.bat builds\win32\%VS_VER%\FirebirdBoot gpre_boot_%FB_TARGET_PLATFORM%.log gpre_boot
  195. if errorlevel 1 call :boot2 gpre_boot
  196. goto :EOF
  197. ::===================
  198. :: BUILD engine
  199. :engine
  200. @echo.
  201. @echo Building engine (%FB_OBJ_DIR%)...
  202. @call compile.bat builds\win32\%VS_VER%\Firebird engine_%FB_TARGET_PLATFORM%.log DLLs\engine
  203. @call compile.bat builds\win32\%VS_VER%\Firebird engine_%FB_TARGET_PLATFORM%.log DLLs\ib_util
  204. if errorlevel 1 call :boot2 engine
  205. @goto :EOF
  206. ::===================
  207. :: BUILD gpre
  208. :gpre
  209. @echo.
  210. @echo Building gpre (%FB_OBJ_DIR%)...
  211. @call compile.bat builds\win32\%VS_VER%\Firebird gpre_%FB_TARGET_PLATFORM%.log EXEs\gpre
  212. if errorlevel 1 call :boot2 gpre
  213. @goto :EOF
  214. ::===================
  215. :: BUILD isql
  216. :isql
  217. @echo.
  218. @echo Building isql (%FB_OBJ_DIR%)...
  219. @call compile.bat builds\win32\%VS_VER%\Firebird isql_%FB_TARGET_PLATFORM%.log EXEs\isql
  220. if errorlevel 1 call :boot2 isql
  221. @goto :EOF
  222. ::===================
  223. :: ERROR boot
  224. :boot2
  225. echo.
  226. echo Error building %1, see %1_%FB_TARGET_PLATFORM%.log
  227. echo.
  228. set ERRLEV=1
  229. goto :EOF
  230. ::==============
  231. :databases
  232. @rmdir /s /q %FB_GEN_DIR%\dbs 2>nul
  233. @mkdir %FB_GEN_DIR%\dbs 2>nul
  234. @echo Create security6.fdb...
  235. @echo create database '%FB_GEN_DB_DIR%\dbs\security6.fdb'; | "%FB_BIN_DIR%\isql" -q > nul
  236. if errorlevel 1 call :boot2 databases & goto :EOF
  237. @echo Apply security.sql...
  238. @"%FB_BIN_DIR%\isql" -q %FB_GEN_DB_DIR%/dbs/security6.fdb -i %FB_ROOT_PATH%\src\dbs\security.sql > nul
  239. if errorlevel 1 call :boot2 databases & goto :EOF
  240. @mklink %FB_GEN_DIR%\dbs\security.fdb %FB_GEN_DIR%\dbs\security6.fdb > nul
  241. if errorlevel 1 (
  242. @copy %FB_GEN_DIR%\dbs\security6.fdb %FB_GEN_DIR%\dbs\security.fdb > nul
  243. )
  244. if errorlevel 1 call :boot2 databases & goto :EOF
  245. @echo Creating metadata.fdb...
  246. @echo create database '%FB_GEN_DB_DIR%/dbs/metadata.fdb'; | "%FB_BIN_DIR%\isql" -q -sqldialect 1 > nul
  247. if errorlevel 1 call :boot2 databases & goto :EOF
  248. @mklink %FB_GEN_DIR%\dbs\yachts.lnk %FB_GEN_DIR%\dbs\metadata.fdb > nul
  249. if errorlevel 1 (
  250. @copy %FB_GEN_DIR%\dbs\metadata.fdb %FB_GEN_DIR%\dbs\yachts.lnk > nul
  251. )
  252. if errorlevel 1 call :boot2 databases
  253. @goto :EOF
  254. ::==============
  255. :NEXT_STEP
  256. @echo.
  257. @echo You may now run make_all.bat [DEBUG] [CLEAN]
  258. @echo.
  259. @goto :EOF
  260. :END
  261. endlocal