Debian Codegraph @

builds/install/arch-specific/win32/BuildExecutableInstall.bat

raw
1 :: Initial Developer's Public License.
2 :: The contents of this file are subject to the Initial Developer's Public
3 :: License Version 1.0 (the "License"). You may not use this file except
4 :: in compliance with the License. You may obtain a copy of the License at
5 :: http://www.ibphoenix.com?a=ibphoenix&page=ibp_idpl
6 :: Software distributed under the License is distributed on an "AS IS" basis,
7 :: WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8 :: for the specific language governing rights and limitations under the
9 :: License.
10 ::
11 :: The Original Code is copyright 2003-2004 Paul Reeves.
12 ::
13 :: The Initial Developer of the Original Code is Paul Reeves
14 ::
15 :: All Rights Reserved.
16 ::
17 ::=============================================================================
18 @echo off
19 set SCRIPT_FULL_NAME=%~d0%~p0%~n0%~x0
20 set SCRIPT_SHORT_NAME=%~n0%~x0
21
22 @goto :MAIN
23 @goto :EOF
24 ::============================================================================
25
26 :SET_PARAMS
27 ::=========
28
29 @echo off
30 :: reset ERRLEV to clear error from last run in same cmd shell
31 set ERRLEV=
32
33 :: Assume we are preparing a production build
34 set FBBUILD_BUILDTYPE=release
35
36 :: Don't ship pdb files by default
37 set FBBUILD_SHIP_PDB=no_pdb
38 :: Reset "make" vars to zero
39 set FBBUILD_ZIP_PACK=0
40 set FBBUILD_ISX_PACK=0
41
42 if not defined FB2_SNAPSHOT (set FB2_SNAPSHOT=0)
43
44
45 :: See what we have on the command line
46
47 @for %%v in ( %* ) do (
48 ( if /I "%%v"=="DEBUG" (set FBBUILD_BUILDTYPE=debug) )
49 ( if /I "%%v"=="PDB" (set FBBUILD_SHIP_PDB=ship_pdb) )
50 ( if /I "%%v"=="ZIP" (set FBBUILD_ZIP_PACK=1) )
51 ( if /I "%%v"=="ISX" (set FBBUILD_ISX_PACK=1) )
52 ( if /I "%%v"=="ALL" ( (set FBBUILD_ZIP_PACK=1) & (set FBBUILD_ISX_PACK=1) ) )
53 )
54
55 :: Are we doing a snapshot build? If so we always do less work.
56 if "%FB2_SNAPSHOT%"=="1" (
57 ( set FBBUILD_ISX_PACK=0 )
58 )
59
60
61 ::End of SET_PARAMS
62 ::-----------------
63 @goto :EOF
64
65
66 :CHECK_ENVIRONMENT
67 ::================
68 :: Make sure we have everything we need. If something is missing then
69 :: let's bail out now.
70
71 @echo o Checking for sed...
72 @(cmd /c "sed.exe --version 2>&1 > nul ") || ( call :ERROR Could not locate sed & goto :EOF )
73
74 @echo o Checking for unix2dos...
75 @(cmd /c "unix2dos.exe --quiet --version 2>&1 > nul" ) || ( call :ERROR Could not locate unix2dos & goto :EOF )
76
77 @for /f "usebackq tokens=*" %%c in ( `where /f md5sum 2^>nul` ) do set MD5_COMMAND=%%c
78 @if defined MD5_COMMAND (
79 echo o POSIX md5sum utility found at %MD5_COMMAND%
80 )
81
82 @if %FBBUILD_ZIP_PACK% EQU 1 (
83 if not defined SEVENZIP (
84 if exist "%ProgramW6432%\7-Zip\7z.exe" set SEVENZIP=%ProgramW6432%\7-Zip
85 )
86 if not defined SEVENZIP (
87 call :ERROR SEVENZIP environment variable is not defined.
88 goto :EOF
89 ) else (
90 echo o Compression utility found.
91 )
92 )
93
94 @if %FBBUILD_ISX_PACK% NEQ 1 goto :SKIP_INNO
95
96 @if defined INNO6_SETUP_PATH (
97 set ISCC_COMMAND=%INNO6_SETUP_PATH%\iscc.exe
98 )
99 :: If the environment variable is not set let's search in PATH
100 @if not defined ISCC_COMMAND (
101 for /f "usebackq tokens=*" %%c in ( `where /f iscc 2^>nul` ) do set ISCC_COMMAND=%%c
102 )
103 @if not defined ISCC_COMMAND (
104 echo Required Inno Setup compiler not found
105 exit /b 1
106 )
107 @echo o Inno Setup found as %ISCC_COMMAND%.
108
109 :SKIP_INNO
110
111 @if not defined WIX (
112 echo.
113 echo The WIX environment var not defined.
114 echo WiX is needed to build the MSI kits of the CRT runtimes.
115 echo.
116 ) else (
117 echo o WiX found at "%WIX%".
118 )
119
120 @if not defined FB_EXTERNAL_DOCS (
121 echo.
122 echo The FB_EXTERNAL_DOCS environment var is not defined
123 echo It should point to the directory containing the relevant release notes
124 echo in adobe pdf format.
125 echo.
126 ) else (
127 echo o Package will include documentation from "%FB_EXTERNAL_DOCS%".
128 )
129
130
131 ::End of CHECK_ENVIRONMENT
132 ::------------------------
133 @goto :EOF
134
135
136 :SET_VERSION
137 ::==========
138
139 :: Cut off everything that is not #define to let Inno Setup use it
140 @findstr /B /L "#define" "%FB_ROOT_PATH%\src\jrd\build_no.h" > "%FB_ROOT_PATH%\gen\jrd\build_no.h"
141 :: Read version parameters from build_no.h
142 @for /F "tokens=2*" %%a in ( %FB_ROOT_PATH%\gen\jrd\build_no.h ) do (
143 echo Setting %%a to %%~b
144 SET %%a=%%~b
145 )
146
147 :: Set our package number at 0 and increment every
148 :: time we rebuild in a single session
149 @if not defined FBBUILD_PACKAGE_NUMBER (
150 set FBBUILD_PACKAGE_NUMBER=0
151 ) else (
152 set /A FBBUILD_PACKAGE_NUMBER+=1
153 )
154 @echo Setting FBBUILD_PACKAGE_NUMBER to %FBBUILD_PACKAGE_NUMBER%
155
156 :: If a suffix is defined (usually for an RC) ensure it is prefixed correctly.
157 @if defined FBBUILD_FILENAME_SUFFIX (
158 if not "%FBBUILD_FILENAME_SUFFIX:~0,1%"=="-" (
159 set FBBUILD_FILENAME_SUFFIX=-%FBBUILD_FILENAME_SUFFIX%
160 )
161 )
162
163 :: Set up our final destination
164 @set FBBUILD_INSTALL_IMAGES=%FB_ROOT_PATH%\builds\install_images
165 @if not exist "%FBBUILD_INSTALL_IMAGES%" ( mkdir "%FBBUILD_INSTALL_IMAGES%" )
166
167 :: Determine Product Status
168 @if %FB_BUILD_TYPE%==V (
169 set FBBUILD_PROD_STATUS=PROD
170 ) else (
171 set FBBUILD_PROD_STATUS=DEV
172 )
173
174 @set FBBUILD_FILE_ID=%PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER%-%FB_TARGET_PLATFORM%
175
176 @setlocal
177 @echo.
178 @if not exist %FB_GEN_DIR%\readmes ( mkdir %FB_GEN_DIR%\readmes )
179 @set SED_COMMAND=sed -e s/\$MAJOR/%FB_MAJOR_VER%/g ^
180 -e s/\$MINOR/%FB_MINOR_VER%/g ^
181 -e s/\$RELEASE/%FB_REV_NO%/g
182 @echo Processing version strings in Readme_%FBBUILD_PROD_STATUS%.txt
183 @%SED_COMMAND% Readme_%FBBUILD_PROD_STATUS%.txt > %FB_GEN_DIR%\readmes\Readme.txt
184 @for %%f in ( installation_readme.txt installation_scripted.txt ) do (
185 echo Processing version strings in %%f
186 %SED_COMMAND% %%f > %FB_GEN_DIR%\readmes\%%f
187 )
188 @for %%d in (ba cz de es fr hu it pl pt ru si ja ) do (
189 if not exist %FB_GEN_DIR%\readmes\%%d ( mkdir %FB_GEN_DIR%\readmes\%%d )
190 for %%f in ( %%d\*.txt ) do (
191 echo Processing version strings in %%f
192 %SED_COMMAND% %%f > %FB_GEN_DIR%\readmes\%%f
193 )
194 )
195
196 @endlocal
197
198 :: Dump env vars to file for later testing.
199 @set > %FB_ROOT_PATH%\builds\install\arch-specific\win32\test_installer\fb_build_vars_%PROCESSOR_ARCHITECTURE%.txt
200
201 ::End of SET_VERSION
202 ::----------------
203 @goto :EOF
204
205
206 :COPY_XTRA
207 :: system dll's we need
208 :: MSVC should be installed with redistributable packages.
209 ::=====================
210
211 :: We are forced to set this because the runtime library now (MSVC15)
212 :: has a different version to the compiler. And sometimes they use 141
213 :: and sometimes 140.
214 @if %MSVC_VERSION% EQU 15 (
215 set MSVC_RUNTIME_MAJOR_VERSION=14
216 set MSVC_RUNTIME_MINOR_VERSION_0=0
217 set MSVC_RUNTIME_MINOR_VERSION_1=1
218
219 ) else (
220 set MSVC_RUNTIME_VERSION=%MSVC_VERSION%0
221 )
222
223
224 @echo Copying MSVC runtime libraries...
225 @if not exist %FB_OUTPUT_DIR%\system32 (
226 mkdir %FB_OUTPUT_DIR%\system32
227 )
228 @for %%f in ( msvcp%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_0%.dll vcruntime%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_0%.dll ) do (
229 echo Copying "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f"
230 copy "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f" %FB_OUTPUT_DIR%\ >nul
231 if ERRORLEVEL 1 (
232 call :ERROR Copying "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f" failed with error %ERRORLEVEL% & goto :EOF
233 )
234 )
235
236 @if "%VSCMD_ARG_TGT_ARCH%"=="x86" (
237 echo Generating fbclient_bor.lib
238 where /Q implib.exe
239 if not ERRORLEVEL 1 (
240 implib %FB_OUTPUT_DIR%\lib\fbclient_bor.lib %FB_OUTPUT_DIR%\fbclient.dll > nul
241 ) else (
242 call :WARNING implib not found
243 )
244 )
245
246 @if "%FBBUILD_SHIP_PDB%"=="ship_pdb" (
247 echo Copying pdb files...
248 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\chacha\chacha.pdb %FB_OUTPUT_DIR%\plugins\ > nul
249 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\engine\engine*.pdb %FB_OUTPUT_DIR%\plugins\ > nul
250 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\fb_lock_print\fb_lock_print.pdb %FB_OUTPUT_DIR%\ > nul
251 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\fbserver\firebird.pdb %FB_OUTPUT_DIR%\ > nul
252 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\fbsvcmgr\fbsvcmgr.pdb %FB_OUTPUT_DIR%\ > nul
253 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\fbtrace\fbtrace.pdb %FB_OUTPUT_DIR%\plugins\ > nul
254 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\fbtracemgr\fbtracemgr.pdb %FB_OUTPUT_DIR%\ > nul
255 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\gbak\gbak.pdb %FB_OUTPUT_DIR%\ > nul
256 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\gfix\gfix.pdb %FB_OUTPUT_DIR%\ > nul
257 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\gstat\gstat.pdb %FB_OUTPUT_DIR%\ > nul
258 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\ib_util\ib_util.pdb %FB_OUTPUT_DIR%\ > nul
259 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\intl\fbintl.pdb %FB_OUTPUT_DIR%\intl\ > nul
260 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\isql\isql.pdb %FB_OUTPUT_DIR%\ > nul
261 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\legacy_auth\legacy_auth.pdb %FB_OUTPUT_DIR%\plugins\ > nul
262 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\legacy_usermanager\legacy_usermanager.pdb %FB_OUTPUT_DIR%\plugins\ > nul
263 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\nbackup\nbackup.pdb %FB_OUTPUT_DIR%\ > nul
264 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\srp\srp.pdb %FB_OUTPUT_DIR%\plugins\ > nul
265 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\udf_compat\udf_compat.pdb %FB_OUTPUT_DIR%\plugins\udr\ > nul
266 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\udrcpp_example\udrcpp_example.pdb %FB_OUTPUT_DIR%\plugins\udr\ > nul
267 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\udr_engine\udr_engine.pdb %FB_OUTPUT_DIR%\plugins\ > nul
268 copy %FB_TEMP_DIR%\%FBBUILD_BUILDTYPE%\yvalve\fbclient.pdb %FB_OUTPUT_DIR%\ > nul
269 )
270
271 @echo Started copying docs...
272 @rmdir /S /Q %FB_OUTPUT_DIR%\doc 2>nul
273 @mkdir %FB_OUTPUT_DIR%\doc
274 @copy %FB_ROOT_PATH%\*.md %FB_OUTPUT_DIR%\doc\ > nul
275 @copy %FB_ROOT_PATH%\doc\*.* %FB_OUTPUT_DIR%\doc\ > nul
276 @if ERRORLEVEL 1 (
277 call :ERROR COPY of main documentation tree failed.
278 goto :EOF
279 )
280
281
282 @echo Copy various upgrade scripts and docs
283 @for %%d in ( v3.0 v4.0 ) do (
284 mkdir %FB_OUTPUT_DIR%\misc\upgrade\%%d 2>nul
285 copy %FB_ROOT_PATH%\src\misc\upgrade\%%d\*.* %FB_OUTPUT_DIR%\misc\upgrade\%%d > nul
286 if ERRORLEVEL 1 (
287 call :ERROR copy %FB_ROOT_PATH%\src\misc\upgrade\%%d\*.* %FB_OUTPUT_DIR%\misc\upgrade\%%d failed.
288 goto :EOF
289 )
290 )
291
292 @echo Copy INTL script
293 @copy %FB_ROOT_PATH%\src\misc\intl.sql %FB_OUTPUT_DIR%\misc\ > nul
294 @if ERRORLEVEL 1 (
295 call :ERROR copy %FB_ROOT_PATH%\src\misc\intl.sql %FB_OUTPUT_DIR%\misc failed.
296 goto :EOF
297 )
298
299 @echo Copying other documentation...
300 @copy %FB_GEN_DIR%\readmes\installation_readme.txt %FB_OUTPUT_DIR%\doc\installation_readme.txt > nul
301
302 @mkdir %FB_OUTPUT_DIR%\doc\sql.extensions 2>nul
303 @if ERRORLEVEL 2 ( ( call :ERROR MKDIR for doc\sql.extensions dir failed) & ( goto :EOF ) )
304 @copy %FB_ROOT_PATH%\doc\sql.extensions\*.* %FB_OUTPUT_DIR%\doc\sql.extensions\ > nul
305 @if ERRORLEVEL 1 ( ( call :ERROR Copying doc\sql.extensions failed ) & ( goto :EOF ) )
306
307 :: External docs aren't necessary for a snapshot build, so we don't throw
308 :: an error if FB_EXTERNAL_DOCS is not defined. On the other hand,
309 :: if the docs are available then we must include them.
310 @if defined FB_EXTERNAL_DOCS (
311 echo Copying essential pdf docs...
312 for %%v in ( Firebird_v%FB_MAJOR_VER%.%FB_MINOR_VER%.%FB_REV_NO%.ReleaseNotes.pdf ) do (
313 echo ... %FB_EXTERNAL_DOCS%\%%v to %FB_OUTPUT_DIR%\doc\%%v
314 copy /Y %FB_EXTERNAL_DOCS%\%%v %FB_OUTPUT_DIR%\doc\%%v > nul
315 if ERRORLEVEL 1 (
316 call :ERROR Copying %FB_EXTERNAL_DOCS%\%%v to %FB_OUTPUT_DIR%\doc\%%v FAILED. & goto :EOF
317 )
318 )
319
320 echo Copying optional pdf docs...
321 for %%v in ( Firebird-%FB_MAJOR_VER%.%FB_MINOR_VER%-QuickStart.pdf ) do (
322 echo ... %%v
323 copy /Y %FB_EXTERNAL_DOCS%\%%v %FB_OUTPUT_DIR%\doc\%%v > nul
324 if ERRORLEVEL 1 (
325 call :WARNING Copying %FB_EXTERNAL_DOCS%\%%v to %FB_OUTPUT_DIR%\doc\%%v FAILED.
326 )
327 )
328
329 echo Finished copying pdf docs...
330 echo.
331 )
332
333 @echo Cleaning irrelevant files...
334 :: Clean out text notes that are either not relevant to Windows or
335 :: are only of use to engine developers.
336 @for %%v in ( README.makefiles README.user.embedded README.user.troubleshooting README.build.mingw.html README.build.msvc.html fb2-todo.txt cleaning-todo.txt install_win32.txt README.coding.style emacros-cross_ref.html firebird_conf.txt *.*~) do (
337 @del %FB_OUTPUT_DIR%\doc\%%v 2>nul
338 )
339
340 @echo Copy license...
341 :: Add license
342 for %%v in (IPLicense.txt IDPLicense.txt ) do (
343 @copy %FB_ROOT_PATH%\builds\install\misc\%%v %FB_OUTPUT_DIR%\%%v > nul
344 )
345
346 :: And readme
347 @copy %FB_GEN_DIR%\readmes\Readme.txt %FB_OUTPUT_DIR%\ > nul
348
349 :: Walk through all docs and transform any that are not .txt, .pdf or .html to .txt
350 @echo Setting .txt filetype to ascii docs.
351 @for /R %FB_OUTPUT_DIR%\doc %%v in ( * ) do (
352 if /I not "%%~xv" == ".md" (
353 if /I not "%%~xv" == ".txt" (
354 if /I not "%%~xv" == ".pdf" (
355 if /I not "%%~xv" == ".htm" (
356 if /I not "%%~xv" == ".html" (
357 ren %%v %%~nxv.txt
358 )
359 )
360 )
361 )
362 )
363 )
364
365 @if %FB2_SNAPSHOT% EQU 1 (
366 copy %FB_ROOT_PATH%\builds\install\arch-specific\win32\readme_snapshot.txt %FB_OUTPUT_DIR%\readme_snapshot.txt > nul
367 )
368
369 @echo Completed copying docs.
370
371 :: Examples were already copied by make_examples
372
373 ::End of COPY_XTRA
374 ::----------------
375 @goto :EOF
376
377
378 :BUILD_CRT_MSI
379 :: Generate runtimes as an MSI file.
380 :: This requires WiX 3.0 to be installed
381 ::============
382 @if %MSVC_VERSION% EQU 15 (
383 if not exist %FB_OUTPUT_DIR%\system32\vccrt%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%_%FB_TARGET_PLATFORM%.msi (
384 "%WIX%\bin\candle.exe" -v -sw1091 %FB_ROOT_PATH%\builds\win32\msvc%MSVC_VERSION%\VCCRT_%FB_TARGET_PLATFORM%.wxs -out %FB_GEN_DIR%\vccrt_%FB_TARGET_PLATFORM%.wixobj
385 if ERRORLEVEL 1 (
386 ( call :ERROR Could not generate wixobj for MSVC Runtime MSI ) & ( goto :EOF )
387 ) else (
388 "%WIX%\bin\light.exe" -sw1076 %FB_GEN_DIR%\vccrt_%FB_TARGET_PLATFORM%.wixobj -out %FB_OUTPUT_DIR%\system32\vccrt%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%_%FB_TARGET_PLATFORM%.msi
389 if ERRORLEVEL 1 ( (call :ERROR Could not generate MSVCC Runtime MSI ) & (goto :EOF))
390 )
391 ) else (
392 echo Using an existing build of %FB_OUTPUT_DIR%\system32\vccrt%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%_%FB_TARGET_PLATFORM%.msi
393 )
394 )
395
396 ::End of BUILD_CRT_MSI
397 ::--------------------
398 @goto :EOF
399
400
401 :INCLUDE_DIR
402 ::==========
403 :: Prepare other files needed for deployment to /include dir
404 @setlocal
405 :: grab some missing bits'n'pieces from different parts of the source tree
406 ::=========================================================================
407 @echo Copying ib_util etc
408 @copy %FB_ROOT_PATH%\src\extlib\ib_util.h %FB_OUTPUT_DIR%\include > nul || (call :ERROR Copying ib_util.h failed. & goto :EOF )
409 @copy %FB_ROOT_PATH%\lang_helpers\ib_util.pas %FB_OUTPUT_DIR%\include > nul || (call :ERROR Copying ib_util.pas failed. & goto :EOF )
410
411 @echo Copying other include files required for development...
412 @set OUTPATH=%FB_OUTPUT_DIR%\include
413 @copy %FB_ROOT_PATH%\src\yvalve\perf.h %OUTPATH%\ > nul
414 @copy %FB_ROOT_PATH%\src\include\gen\firebird.pas %OUTPATH%\firebird\ > nul || (@call :ERROR Failure executing copy %FB_ROOT_PATH%\src\include\gen\firebird.pas %OUTPATH%\firebird\ )
415 @if ERRORLEVEL 1 goto :END
416
417 @endlocal
418
419 ::End of INCLUDE_DIR
420 ::------------------
421 @goto :EOF
422
423
424 :DB_CONF
425 :: Generate sample databases file
426 ::===============================
427 @echo Creating sample databases.conf
428 @copy %FB_ROOT_PATH%\builds\install\misc\databases.conf %FB_OUTPUT_DIR%\databases.conf > nul
429
430 ::End of DB_CONF
431 ::-----------------
432 @goto :EOF
433
434
435 :MISC
436 ::==============================================
437 :: Make sure that qli's help.fdb is available
438 ::===============================================
439 @if not exist %FB_OUTPUT_DIR%\help\help.fdb (
440 (@echo Copying help.fdb for qli support)
441 (@copy %FB_GEN_DIR%\dbs\help.fdb %FB_OUTPUT_DIR%\help\help.fdb > nul)
442 (@if %ERRORLEVEL% GEQ 1 ( (call :ERROR Could not copy qli help database ) & (goto :EOF)))
443 )
444
445
446 ::End of MISC
447 ::-----------------
448 @goto :EOF
449
450
451 :FB_MSG
452 ::=================================================================
453 :: firebird.msg is generated as part of the build process
454 :: in builds\win32 by build_msg.bat. Copying from there to output dir
455 ::=================================================================
456 @if not exist %FB_OUTPUT_DIR%\firebird.msg (
457 copy %FB_GEN_DIR%\firebird.msg %FB_OUTPUT_DIR%\firebird.msg > nul
458 if ERRORLEVEL 1 ( call :ERROR Could not copy firebird.msg & goto :EOF )
459 )
460
461 ::End of FB_MSG
462 ::-------------
463 @goto :EOF
464
465
466 :SET_CRLF
467 :: Get a list of all files in the tree make sure
468 :: that and they all have windows EOL
469 ::===============================================
470 @for /R %FB_OUTPUT_DIR% %%W in ( *.txt *.conf *.sql *.c *.cpp *.hpp *.h *.bat *.pas *.e *.def *.rc *.md *.html ) do (
471 unix2dos --safe %%W > nul 2>&1 || exit /b 1
472 )
473
474 ::End of SET_CRLF
475 ::-------------
476 @goto :EOF
477
478
479 :ZIP_PACK
480 ::=======
481 :: Forcefully disable delayed expansion because of exclamation marks in 7z switches
482 @setlocal DisableDelayedExpansion
483
484 @set SKIP_FILES=-x!installation_readme.txt
485
486 @if "%FBBUILD_SHIP_PDB%" == "ship_pdb" (
487 set FBBUILD_ZIPFILE=%FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%-pdb%FBBUILD_FILENAME_SUFFIX%.zip
488 ) else (
489 set FBBUILD_ZIPFILE=%FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%%FBBUILD_FILENAME_SUFFIX%.zip
490 set SKIP_FILES=%SKIP_FILES% -x!*.pdb
491 )
492
493 :: No need to ship this file with the msi runtime
494 @set SKIP_FILES=%SKIP_FILES% -x!*.wixpdb
495
496 @if "%FB2_EXAMPLES%" == "0" set SKIP_FILES=%SKIP_FILES% -xr-!examples
497
498 @if exist %FBBUILD_ZIPFILE% del %FBBUILD_ZIPFILE%
499
500 @%SEVENZIP%\7z.exe a -r -tzip -mx9 %SKIP_FILES% %FBBUILD_ZIPFILE% %FB_OUTPUT_DIR%\*
501
502 @endlocal
503
504 ::End of ZIP_PACK
505 ::----------------
506 @goto :EOF
507
508
509 :ISX_PACK
510 ::=======
511 :: Now let's go and build the installable .exe
512 ::
513 :: Note - define INNO6_SETUP_PATH with double quotes if it is installed into a path string using spaces.
514 :: eg set INNO6_SETUP_PATH="C:\Program Files\Inno Setup 6"
515 ::
516 ::=================================================
517 @echo.
518 @call %ISCC_COMMAND% %FB_ROOT_PATH%\builds\install\arch-specific\win32\FirebirdInstall.iss
519 @echo.
520
521 ::End of ISX_PACK
522 ::---------------
523 @goto :EOF
524
525
526 :DO_MD5SUMS
527 ::=========
528 :: Generate the md5sum checksum file
529 ::==================================
530 @if not defined MD5_COMMAND (
531 call :WARNING md5sum utility not found. Cannot generate md5 sums.
532 goto :EOF
533 )
534 @echo Generating md5sums for Firebird-%PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER%
535
536 :: write sums into temporary file to avoid including it into the process
537 @pushd %FBBUILD_INSTALL_IMAGES%
538 @call %MD5_COMMAND% Firebird-%PRODUCT_VER_STRING%?%FBBUILD_PACKAGE_NUMBER%*.* > md5sum.tmp
539
540 :: then rename it to the proper name
541 @if not ERRORLEVEL 1 (
542 del Firebird-%PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER%.md5sum >nul 2>nul
543 ren md5sum.tmp Firebird-%PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER%.md5sum
544 ) else (
545 echo Error calling %0 & popd & @goto :END
546 )
547 @popd
548
549 ::End of DO_MD5SUMS
550 ::-----------------
551 @goto :EOF
552
553
554 :HELP
555 ::===
556 @echo.
557 @echo.
558 @echo Parameters can be passed in any order.
559 @echo Currently the recognised params are:
560 @echo.
561 @echo DEBUG Use binaries from 'debug' dir, not 'release' dir.
562 @echo (Requires a debug build. NOTE: A debug build is
563 @echo not required to create packages with debug info.)
564 @echo.
565 @echo PDB Include pdb files.
566 @echo (These files roughly double the size of the package.)
567 @echo.
568 @echo ISX Create installable binary from InnoSetup Extensions compiler.
569 @echo (You need to set the INNO6_SETUP_PATH environment variable.)
570 @echo.
571 @echo ZIP Create Zip package.
572 @echo (SEVENZIP is currently used and the SEVENZIP env var must be set.)
573 @echo.
574 @echo ALL Build InnoSetup and Zip packages.
575 @echo.
576 @echo HELP This help screen.
577 @echo.
578 @echo In addition, the following environment variables are checked by ISS script:
579 @echo.
580 @echo FB2_ISS_DEBUG=1 - Prepare an InnoSetup script that is
581 @echo easier to debug
582 @echo.
583 @echo FB2_EXAMPLES=0 - Don't include examples in the install kit.
584 @echo.
585 @echo.
586 @echo Required Files
587 @echo.
588 @echo To successfully package Firebird you will need to make sure several
589 @echo packages are installed and correctly configured on your system.
590 @echo.
591 @echo o InnoSetup is needed to create the binary installer. See the header
592 @echo of the .iss file to see which minimum version is required.
593 @echo.
594 @echo o 7ZIP is required to create the zip package
595 @echo.
596 @echo o sed is required for packaging. Use the sed provided by
597 @echo gnuwin32. The cygwin one is not guaranteed to work.
598 @echo.
599 @echo o WiX v3.0 is required to build installable msi packages of the
600 @echo MS runtime libraries.
601 @echo.
602
603 ::End of HELP
604 ::-----------
605 @goto :EOF
606
607
608 :ERROR
609 ::====
610 :: errorlevel gets reset automatically so capture it before we lose it.
611 @set ERRLEV=%ERRORLEVEL%
612 @echo.
613 @echo Error code %ERRLEV% in %SCRIPT_SHORT_NAME%
614 @echo %*
615 @echo.
616 ::End of ERROR
617 ::------------
618 @goto :END
619
620
621 :WARNING
622 ::======
623 @set ERRLEV=%ERRORLEVEL%
624 @echo.
625 @echo **** WARNING - Execution of a non-critical component failed with error level %ERRLEV%. ****
626 @echo %*
627 @echo.
628 @if "%FBBUILD_PROD_STATUS%" == "PROD" (
629 echo.
630 echo Production status is Final or Release Candidate
631 echo Error %ERRLEV% must be fixed before continuing
632 echo.
633 ) else (
634 set ERRLEV=
635 ver > nul
636 )
637 ::End of WARNING
638 ::--------------
639 @goto :EOF
640
641
642 :MAIN
643 ::====
644 ::Check if on-line help is required
645 @for %%v in ( %1 %2 %3 %4 %5 %6 %7 %8 %9 ) do (
646 if /I "%%v"=="-h" ( goto :HELP & goto :EOF )
647 if /I "%%v"=="/h" ( goto :HELP & goto :EOF )
648 if /I "%%v"=="HELP" ( goto :HELP & goto :EOF )
649 )
650
651 pushd ..\..\..\win32
652 ::This must be called from the directory it resides in.
653 @call setenvvar.bat
654 @if ERRORLEVEL 1 ( popd & ( call :ERROR Failure after calling setenvvar.bat ) & goto :END )
655 popd
656
657 @if not defined FB2_ISS_DEBUG (set FB2_ISS_DEBUG=0)
658
659 @echo.
660 @echo Reading command-line parameters...
661 @(call :SET_PARAMS %* )
662 @if ERRORLEVEL 1 (call :ERROR Calling SET_PARAMS & goto :END)
663
664 @echo.
665 @echo Checking that all required components are available...
666 @( call :CHECK_ENVIRONMENT ) || ( echo Error calling CHECK_ENVIRONMENT & goto :END )
667 @echo.
668
669 @echo Setting version number...
670 @( call :SET_VERSION ) || ( echo Error calling SET_VERSION & goto :END )
671 @echo.
672
673 @echo Copying additional files needed for installation, documentation etc.
674 @( call :COPY_XTRA ) || ( echo Error calling COPY_XTRA & goto :END )
675 @echo.
676
677 :: WIX is not necessary for a snapshot build, so we don't throw
678 :: an error if WIX is not defined. On the other hand,
679 :: if it is there anyway, use it.
680 @if defined WIX (
681 echo Building MSI runtimes
682 ( call :BUILD_CRT_MSI ) || ( echo Error calling BUILD_CRT_MSI & goto :END )
683 echo.
684 )
685
686 @echo Prepare include directory
687 @( call :INCLUDE_DIR ) || ( echo Error calling INCLUDE_DIR & goto :END )
688 @echo.
689
690 @echo Writing databases conf
691 @( call :DB_CONF ) || ( echo Error calling DB_CONF & goto :END )
692 @echo.
693 @echo Copying miscellany such as the QLI help database
694 @( call :MISC ) || ( echo Error calling MISC & goto :END)
695 @echo.
696 @echo Copying firebird.msg
697 @( call :FB_MSG ) || ( echo Error calling FB_MSG & goto :END )
698 @echo.
699
700 @echo Fix up line endings...
701 @( call :SET_CRLF ) || ( echo Error calling SET_CRLF & goto :EOF )
702 @echo.
703
704 @if %FBBUILD_ZIP_PACK% EQU 1 (
705 echo Zipping files for zip pack
706 ( call :ZIP_PACK ) || ( echo Error calling ZIP_PACK & goto :END )
707 echo.
708 )
709
710 @if %FBBUILD_ISX_PACK% EQU 1 (
711 echo Now let's compile the InnoSetup scripts
712 ( call :ISX_PACK ) || ( echo Error calling ISX_PACK & goto :END )
713 echo.
714 )
715
716 @( call :DO_MD5SUMS ) || ( echo Error calling DO_MD5SUMS & goto :END)
717
718 @echo.
719 @echo Completed building installation kit(s)
720 @echo.
721
722 :: If we got this far then be sure to reset ERRLEV
723 :: because run_all.bat will check for ERRLEV
724 @set ERRLEV=
725
726 ::End of MAIN
727 ::-----------
728 @goto :END
729
730
731 :END
732
733 exit /b %ERRLEV%
734
735