make_examples.bat 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. @echo off
  2. :: Set env vars
  3. @call setenvvar.bat
  4. @if errorlevel 1 (goto :EOF)
  5. @call set_build_target.bat %*
  6. :: verify that boot was run before
  7. @if not exist %FB_BIN_DIR%\isql.exe (goto :HELP_BOOT & goto :EOF)
  8. @if not exist %FB_BIN_DIR%\gpre.exe (goto :HELP_BOOT & goto :EOF)
  9. @if not exist %FB_BIN_DIR%\fbclient.dll (goto :HELP_BOOT & goto :EOF)
  10. ::Uncomment this to build intlemp
  11. ::set FB2_INTLEMP=1
  12. ::===========
  13. :MAIN
  14. @echo BUILD_EMPBUILD
  15. @call :BUILD_EMPBUILD
  16. @echo.
  17. @echo Building %FB_OBJ_DIR%
  18. @call compile.bat builds\win32\%VS_VER%\FirebirdExamples empbuild_%FB_TARGET_PLATFORM%.log empbuild
  19. @if defined FB2_INTLEMP (
  20. @call compile.bat builds\win32\%VS_VER%\FirebirdExamples intlbuild_%FB_TARGET_PLATFORM%.log intlbuild
  21. )
  22. @call compile.bat builds\win32\%VS_VER%\FirebirdExamples udrcpp_example_%FB_TARGET_PLATFORM%.log udrcpp_example
  23. if errorlevel 1 (
  24. @call :ERROR building udrcpp example failed - see udrcpp_example_%FB_TARGET_PLATFORM%.log for details
  25. @goto :EOF
  26. )
  27. @call compile.bat examples\extauth\msvc\ExtAuth_%VS_VER% ExtAuth_%FB_TARGET_PLATFORM%.log
  28. if errorlevel 1 (
  29. @call :ERROR building ExtAuth examples failed - see ExtAuth_%FB_TARGET_PLATFORM%.log for details
  30. @goto :EOF
  31. )
  32. @call compile.bat examples\dbcrypt\msvc\DbCrypt_%VS_VER% DbCrypt_%FB_TARGET_PLATFORM%.log
  33. if errorlevel 1 (
  34. @call :ERROR building DbCrypt examples failed - see DbCrypt_%FB_TARGET_PLATFORM%.log for details
  35. @goto :EOF
  36. )
  37. @echo.
  38. @call :MOVE
  39. @call :BUILD_EMPLOYEE
  40. @call :MOVE2
  41. @goto :EOF
  42. :BUILD_EMPBUILD
  43. ::===========
  44. @echo.
  45. @echo Building empbuild.fdb
  46. @copy /y %FB_ROOT_PATH%\examples\empbuild\*.sql %FB_GEN_DIR%\examples\ > nul
  47. @copy /y %FB_ROOT_PATH%\examples\empbuild\*.inp %FB_GEN_DIR%\examples\ > nul
  48. @echo.
  49. :: Here we must use cd because isql does not have an option to set a base directory
  50. @pushd "%FB_LONG_ROOT_PATH%\gen\examples"
  51. @echo Creating empbuild.fdb...
  52. @echo.
  53. @del empbuild.fdb 2> nul
  54. @%FB_BIN_DIR%\isql -i empbld.sql
  55. if defined FB2_INTLEMP (
  56. @echo Creating intlbuild.fdb...
  57. @echo.
  58. @copy %FB_ROOT_PATH%\builds\install\misc\fbintl.conf %FB_BIN_DIR%\intl >nul
  59. @del intlbuild.fdb 2> nul
  60. @%FB_BIN_DIR%\isql -i intlbld.sql
  61. )
  62. @popd
  63. @echo.
  64. @echo path = %FB_GEN_DB_DIR%\examples
  65. @echo Preprocessing empbuild.e...
  66. @echo.
  67. @%FB_BIN_DIR%\gpre.exe -r -m -n -z %FB_ROOT_PATH%\examples\empbuild\empbuild.e %FB_GEN_DIR%\examples\empbuild.c -b %FB_GEN_DB_DIR%/examples/
  68. if defined FB2_INTLEMP (
  69. @echo Preprocessing intlbld.e...
  70. @echo.
  71. @%FB_BIN_DIR%\gpre.exe -r -m -n -z %FB_ROOT_PATH%\examples\empbuild\intlbld.e %FB_GEN_DIR%\examples\intlbld.c -b %FB_GEN_DB_DIR%/examples/
  72. )
  73. ::End of BUILD_EMPBUILD
  74. ::---------------------
  75. @goto :EOF
  76. :MOVE
  77. ::===========
  78. @echo.
  79. @rmdir /q /s %FB_OUTPUT_DIR%\examples 2>nul
  80. @mkdir %FB_OUTPUT_DIR%\examples
  81. @mkdir %FB_OUTPUT_DIR%\examples\api
  82. @mkdir %FB_OUTPUT_DIR%\examples\dbcrypt
  83. @mkdir %FB_OUTPUT_DIR%\examples\dbcrypt\msvc
  84. @mkdir %FB_OUTPUT_DIR%\examples\build_win32
  85. @mkdir %FB_OUTPUT_DIR%\examples\empbuild
  86. @mkdir %FB_OUTPUT_DIR%\examples\extauth
  87. @mkdir %FB_OUTPUT_DIR%\examples\extauth\msvc
  88. @mkdir %FB_OUTPUT_DIR%\examples\include
  89. @mkdir %FB_OUTPUT_DIR%\examples\interfaces
  90. @mkdir %FB_OUTPUT_DIR%\examples\package
  91. @mkdir %FB_OUTPUT_DIR%\examples\stat
  92. @mkdir %FB_OUTPUT_DIR%\examples\udf
  93. @mkdir %FB_OUTPUT_DIR%\examples\udr
  94. @mkdir %FB_OUTPUT_DIR%\plugins\udr 2>nul
  95. @mkdir %FB_OUTPUT_DIR%\examples\prebuilt\bin
  96. @mkdir %FB_OUTPUT_DIR%\examples\prebuilt\plugins
  97. @echo Moving files to output directory
  98. copy %FB_ROOT_PATH%\examples\* %FB_OUTPUT_DIR%\examples > nul
  99. ren %FB_OUTPUT_DIR%\examples\readme readme.txt > nul
  100. copy %FB_ROOT_PATH%\examples\api\* %FB_OUTPUT_DIR%\examples\api > nul
  101. copy %FB_ROOT_PATH%\examples\dbcrypt\* %FB_OUTPUT_DIR%\examples\dbcrypt > nul
  102. copy %FB_ROOT_PATH%\examples\dbcrypt\msvc\* %FB_OUTPUT_DIR%\examples\dbcrypt\msvc > nul
  103. copy %FB_ROOT_PATH%\examples\dbcrypt\*.conf %FB_OUTPUT_DIR%\examples\prebuilt\plugins > nul
  104. copy %FB_ROOT_PATH%\examples\build_win32\* %FB_OUTPUT_DIR%\examples\build_win32 > nul
  105. :: @copy %FB_ROOT_PATH%\examples\empbuild\* %FB_OUTPUT_DIR%\examples\empbuild > nul
  106. @copy %FB_ROOT_PATH%\examples\extauth\* %FB_OUTPUT_DIR%\examples\extauth > nul
  107. @copy %FB_ROOT_PATH%\examples\extauth\msvc\* %FB_OUTPUT_DIR%\examples\extauth\msvc > nul
  108. copy %FB_ROOT_PATH%\examples\empbuild\employe2.sql %FB_OUTPUT_DIR%\examples\empbuild > nul
  109. copy %FB_ROOT_PATH%\examples\include\* %FB_OUTPUT_DIR%\examples\include > nul
  110. copy %FB_ROOT_PATH%\examples\interfaces\* %FB_OUTPUT_DIR%\examples\interfaces > nul
  111. copy %FB_ROOT_PATH%\examples\package\* %FB_OUTPUT_DIR%\examples\package > nul
  112. copy %FB_ROOT_PATH%\examples\stat\* %FB_OUTPUT_DIR%\examples\stat > nul
  113. copy %FB_ROOT_PATH%\examples\udf\* %FB_OUTPUT_DIR%\examples\udf > nul
  114. copy %FB_ROOT_PATH%\examples\udr\* %FB_OUTPUT_DIR%\examples\udr > nul
  115. copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\plugins\udr\*.dll %FB_OUTPUT_DIR%\plugins\udr >nul
  116. copy %FB_ROOT_PATH%\examples\prebuilt\%FB_OBJ_DIR%\bin\*.exe %FB_OUTPUT_DIR%\examples\prebuilt\bin > nul
  117. copy %FB_ROOT_PATH%\examples\prebuilt\%FB_OBJ_DIR%\plugins\*.dll %FB_OUTPUT_DIR%\examples\prebuilt\plugins > nul
  118. ::@copy %FB_GEN_DIR%\examples\empbuild.c %FB_OUTPUT_DIR%\examples\empbuild\ > nul
  119. ::@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\examples\empbuild.exe %FB_GEN_DIR%\examples\empbuild.exe > nul
  120. ::if defined FB2_INTLEMP (
  121. ::if "%VS_VER%"=="msvc6" (
  122. ::@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\examples\intlbld.exe %FB_GEN_DIR%\examples\intlbuild.exe > nul
  123. ::) else (
  124. ::@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\examples\intlbuild.exe %FB_GEN_DIR%\examples\intlbuild.exe > nul
  125. ::)
  126. ::)
  127. ::End of MOVE
  128. ::-----------
  129. @goto :EOF
  130. :BUILD_EMPLOYEE
  131. ::===========
  132. :: only to test if it works
  133. @echo.
  134. @echo Building employee.fdb
  135. :: Do no mess with global variables
  136. setlocal
  137. :: This allows us to use the new engine in embedded mode to build
  138. :: the employee database.
  139. @set FIREBIRD=%FB_BIN_DIR%
  140. @set PATH=%FB_BIN_DIR%;%PATH%
  141. :: Here we must use cd because isql does not have an option to set a base directory
  142. :: and empbuild.exe uses isql
  143. :: BEWARE: It will run without error if you have FB client from previous version
  144. :: installed in System32 and server run but created database will have
  145. :: wrong ODS.
  146. @pushd "%FB_GEN_DIR%\examples"
  147. if exist employee.fdb del employee.fdb
  148. %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\empbuild\empbuild.exe %FB_GEN_DB_DIR%/examples/employee.fdb
  149. if errorlevel 44 (call :ERROR empbuild.exe failed - see empbuild_%FB_TARGET_PLATFORM%.log for details )
  150. @if defined FB2_INTLEMP (
  151. @echo Building intlemp.fdb
  152. @del %FB_GEN_DIR%\examples\intlemp.fdb 2>nul
  153. @del isql.tmp 2>nul
  154. @echo s;intlemp.fdb;%FB_GEN_DIR%\examples\intlemp.fdb;g > isql.tmp
  155. @%FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\intlbuild\intlbuild.exe %FB_GEN_DB_DIR%/examples/intlemp.fdb
  156. )
  157. @popd
  158. endlocal
  159. ::End of BUILD_EMPLOYEE
  160. ::---------------------
  161. @goto :EOF
  162. ::==============
  163. :MOVE2
  164. @copy %FB_GEN_DIR%\examples\employee.fdb %FB_OUTPUT_DIR%\examples\empbuild\ > nul
  165. if errorlevel 1 (
  166. @call :ERROR copying employee database to %FB_OUTPUT_DIR%\examples\empbuild failed - see make_examples_%FB_TARGET_PLATFORM%.log for details
  167. @goto :EOF
  168. )
  169. if defined FB2_INTLEMP (
  170. if exist %FB_GEN_DIR%\examples\intlemp.fdb (
  171. @copy %FB_GEN_DIR%\examples\intlemp.fdb %FB_OUTPUT_DIR%\examples\empbuild\ > nul
  172. )
  173. )
  174. @goto :EOF
  175. ::==============
  176. :HELP_BOOT
  177. @echo.
  178. @echo You must run make_boot.bat before running this script
  179. @echo.
  180. @goto :EOF
  181. :ERROR
  182. ::====
  183. @echo.
  184. @echo Error - %*
  185. @echo.
  186. set ERRLEV=1
  187. exit /b 1
  188. ::End of ERROR
  189. ::------------