## VisualStudio build Notes

Last Update: May 27 2006
Author: Blas Rodriguez Somoza blas@puertareal.com

### 0.-Introduction

> There are two VisualStudio builds, msvc6 and msvc7. The msvc7 build is the official build of FB in win32.

> Under the directory where you put Firebird2 sources you will see the following directories

> - builds
> - mac_os_x (Mac os X build scripts)
> - posix (Posix build scripts)
> - win32 (Msvc build scripts)
> - .....
> - doc
> - sql.extensions
> - src
> - ....
> - lang_helpers
> - ....
> - examples
> - ....

> After you build Firebird you also will see the following temporary directories

> - gen (cpp files generated from epp, exe and fdb's.)
> - temp (compiler temporary)
> - output (build output)

### 1.-TODO

### 2.-Prerrequisites

> To prepare the standard msvc build of FB you need:

> - Microsoft VisualStudio 6 or 7.
> - sed unix utility

> If you intend to modify the dsql parser file (parse.y) you will need a parser generator, bison or byacc (Berkeley yacc). At this time byacc 1.9 is the official parser generator although in the future it will be switched to bison. The tested versions of byacc are 1.9 or newer and for bison 1.28 or newer.

> If you intend to prepare an installable build, you will need innosetup.

> To download the utilities use the following links

> - My Inno setup extensions 3.0.6.2 http://www.wintax.nl/isx/
> - Sed and Bison 1.35 http://gnuwin32.sourceforge.net/
> - Byacc 1.9 ftp://garbo.uwasa.fi/pc/unix/

### 2.-Installing the utilities

> #### 2.1.-Visual Studio

> 1. Install VisualStudio 6/7
> 2. If you use VisualStudio 6, before building Firebird and its tools, you need to apply some patches from the following site
>    http://www.dinkumware.com/vc_fixes.html

> #### 2.2.-Sed and bison

> #### 2.3.-Inno setup

### 4.- Building

> #### 4.1.-Standard build

> 1. Open a command line window.
> 2. Go to the firebird2\builds\win32 directory.
> 3. Run the following batches in order (your version of VisualStudio is detected automatically)
> 1. make_icu.bat [DEBUG] [CLEAN]
> 2. make_boot.bat [DEBUG] [CLEAN]
> 3. make_all.bat [DEBUG] [CLEAN]

> After the build finish, an output directory with the binaries is created below your firebird2 directory.

> - To make a clean build from scratch after making changes to the code use the clean_all.bat script

> #### 4.2.-Parser rebuild

> Remember, you need sed and bison or yacc in the path to rebuild the parser

> If you change parser.y or parser.sed you will need to rebuild parser.cpp, to do so use parse.bat

> #### 4.3.-Examples build

> The examples build prepare two databases that will be needed to compile the examples in a distribution. If you intend to prepare a distribution then run the examples batch before:

> 1. make_examples.bat

> #### 4.4.-Installer build

> Remember, you need sed and innosetup in the path to build the installer

> - Open a command line window.
> - Go to the firebird2\builds\install\arch-specific\win32 directory.
> - The batch to build the installer is
>   BuildExecutableInstall.bat [DEBUG] [CS]
>   Where DEBUG means if the build is a debug one or not and CS means classic server installer.
> - After you start the batch, you will get a InnoSetup window. To build the install exe select the option compile, and a new exe will appear in builds/win32/install_image

> #### 4.5.-Building samples

> After the standard build is finished, an output directory with the same structure as the installed FB directory is created.

> If you want to build the examples just cd to firebird2\output\examples\build_win32 and run run_all.bat

> Run_all.bat calls four other bats to make the example sets. Any example set can be build independently with its make_XXX script.

> The example sets are:

> - api (API Interface)
> - dyn (embedded dynamic SQL)
> - stat (embedded static SQL)
> - udf (User defined functions)