Debian Codegraph @

builds/win32/make_examples.bat

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