make_examples.bat 7.3 KB

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