]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/README.vc8
Zeroth integration of plugins
[bacula/bacula] / bacula / src / win32 / README.vc8
1 Instructions to build Bacula with Microsoft Visual C++ 2005
2 ===========================================================
3
4 Using the Express Edition (free version)
5 ----------------------------------------
6   Download instructions:
7     - Visual C++ 2005 Express Edition (2MB + 66MB)
8       http://msdn.microsoft.com/vstudio/express/visualc/download/
9       NOTE: You may want to download the whole CD for offline usage
10       instead of the web installer, as Microsoft will
11       start to charge for VC++ one year after the product launch
12       (launch was in November 2005, see VC++ FAQ).
13       NOTE: last modifications in order to compile have been tested with 
14       Visual C++ Standard Edition, not with Express Edition, but this shouldn't change anything.
15
16        - Microsoft VSS SDK.  You can find it on Microsoft's web-site at:
17       http://www.microsoft.com/downloads/details.aspx?FamilyID=0b4f56e4-0ccc-4626-826a-ed2c4c95c871&DisplayLang=en
18       If that link doesn't work then go to http://www.microsoft.com and search for
19       "download volume shadow copy service sdk"
20
21     - Windows Server 2003 SP1 Platform SDK Full Download (385MB)
22       http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en
23       NOTE: choose "Full Download" version on the bottom of that page.
24
25   Installation instructions:
26     - Visual C++ Express Edition Beta 2:
27       + Run vcsetup.exe.
28       + When asked for Installation Options, only check "Graphical IDE"
29         (MSDN Library is NOT needed).
30       + Remember where you install it (e.g. E:\Microsoft Visual Studio 8\)
31
32     - Windows Server 2003 SP1 Platform SDK Full Download
33       + Run psdk-full.exe, type the directory where you downloaded the cab
34         files.
35       + In a command prompt, run "PSDK-full.bat <temp directory>"
36         (e.g. "PSDK-full.bat E:\temp")
37       + Run <temp directory>\setup.exe
38       + When asked for the installation directory, choose
39         <vc++ install dir>\VC\PlatformSDK (e.g.
40         E:\Microsoft Visual Studio 8\VC\PlatformSDK\)
41       + When asked for components, you can safely remove documentation,
42         samples, and all 64-bit tools and libs if you want to save disk
43         space.
44       NOTE: Just after having installed "Windows® Server 2003 SP1 Platform SDK Full Download", 
45       my XP was no more considered as "genuine". You are warned.
46       That's why it is recommended to download "volume shadow copy service sdk" before installing SDK
47
48     - Microsoft VSS SDK
49       + Normally the files will be installed in:  C:\Program Files\Microsoft\VSSSDK72
50       + You only need to copy everything under the C:\Program Files\Microsoft\VSSSDK72\inc
51         directory into .../depkgs-msvc/vss/inc.
52
53     - Verify what you've got in your system variables :
54       + %INCLUDE% (echo %INCLUDE%) must contain 
55         <vc++ install dir>\VC\include;<vc++ install dir>\VC\PlatformSDK\Include;
56       + %LIB% (echo %LIB%) must contain 
57         <vc++ install dir>\VC\lib;<vc++ install dir>\VC\PlatformSDK\Lib
58
59 One-time Setup
60 ==============
61
62 If you're reading this file you've probably already enlisted in the CVS
63 tree or extracted the contents of the source tar.  If not you need to do
64 that first.
65
66 You also need to download one of the doc tar balls and extract to your
67 top level Bacula directory.  It is referred to as bacula-top in the
68 diagram located in README.win32.  It will be signified in this file as ...
69
70 The extracted doc directory name will be bacula-docs-version where
71 version is the version number.  The directory must be renamed to docs
72 (ie remove the leading bacula- and the trailing -version portion of the
73 name).
74
75 The script build-depkgs-msvc.cmd is used to download and build all the
76 third party dependencies required by Bacula.  In order to build the
77 dependencies you need the following utilities.  Only the binaries listed
78 in parenthesis are required.  Perl must be listed in the PATH, the other
79 utilities can either be on the PATH or copied to ...\depkgs-msvc\tools.
80
81   Perl (Normal Install, with binaries in the PATH)
82     http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.819-MSWin32-x86-267479.msi
83
84   7-Zip (7z.exe)
85     http://prdownloads.sourceforge.net/sevenzip/7za443.zip?download
86
87   NASM (nasmw.exe)
88     http://prdownloads.sourceforge.net/nasm/nasm-0.98.39-win32.zip?download
89
90   patch (patch.exe)
91     http://prdownloads.sourceforge.net/gnuwin32/patch-2.5.9-6-bin.zip?download
92
93   sed (sed.exe) Depends on libintl, libiconv
94     http://prdownloads.sourceforge.net/gnuwin32/sed-4.1.4-bin.zip?download
95
96   tee (tee.exe) Depends on libintl, libiconv
97     http://prdownloads.sourceforge.net/gnuwin32/coreutils-5.3.0-bin.zip?download
98
99   wget (wget.exe) Depends on libintl, libiconv, openssl
100     http://prdownloads.sourceforge.net/gnuwin32/wget-1.10.1-bin.zip?download
101
102   libintl (libintl3.dll) Dependency of sed, tee, wget
103     http://prdownloads.sourceforge.net/gnuwin32/libintl-0.14.4-bin.zip?download
104
105   libiconv (libiconv2.dll) Dependency of sed, tee, wget
106     http://prdownloads.sourceforge.net/gnuwin32/libiconv-1.9.2-1-bin.zip?download
107
108   openssl (libeay32.dll, ssleay32.dll) Dependency of wget
109     http://prdownloads.sourceforge.net/gnuwin32/openssl-0.9.7c-bin.zip?download
110
111 Once the utilities are installed continue with the next steps.
112
113 Start VC++ 2005 command prompt (in the start menu)
114
115    cd ...\bacula\src\win32 directory.
116
117 Only if you are using Microsoft Visual C++ Express
118
119    "%VCINSTALLDIR%\PlatformSDK\SetEnv"
120
121 The following step should only need to be done the first time and
122 whenever the dependencies change.
123
124    build-depkgs-msvc
125
126 At this point all of the dependencies should have been downloaded and
127 built.  
128 The above only needs to be done once unless we change the cross-tools or
129 the dependencies versions.  In general, you can run the script multiple
130 times with no problem.
131
132
133 Building
134 ========
135
136 Start VC++ 2005 command prompt (in the start menu)
137
138    cd ...\bacula\src\win32
139
140 If you are using Microsoft Visual C++ Express
141
142    "%VCINSTALLDIR%\PlatformSDK\SetEnv"
143
144 To build the debug version
145
146    build-msvc "Debug|Win32"
147
148 To build the release version
149
150    build-msvc "Release|Win32"
151
152 To cleanup all the built files
153
154    build-msvc /c
155
156 To cleanup only the debug built files
157
158    build-msvc /c "Debug|Win32"
159
160 To rebuild the debug version
161
162    build-msvc /r "Debug|Win32"
163
164
165 Updating the 3rd party package patches
166 ======================================
167
168 If one of the patches changes in ...\bacula\src\win32\patches, you will
169 need to update the corresponding dependency.  You can install new patches
170 by doing the following (we assume the patch in question is for openssl).
171
172    cd ...\bacula\src\win32
173    set CLOBBER_SOURCE=true
174    build-depkgs-msvc openssl
175    set CLOBBER_SOURCE=
176
177 NOTE: Setting CLOBBER_SOURCE=true means that any local changes to the
178       source code in the .../depkgs-msvc/src directory will be lost.
179       The source will be reextracted from the archive and the current
180       patches will be applied.
181
182
183 Adding a new global function or global data
184 ===========================================
185
186 bacula.dll
187 ----------
188
189 The code from the following directories is built into bacula.dll:
190
191    .../bacula/src/lib
192    .../bacula/src/libfind
193    .../bacula/src/win32/compat
194
195 A new function or data variable which must be accessed from outside
196 of bacula.dll requires special treatment.  It must be specifically
197 exported.
198
199 New data variables are exported by adding the macro DLL_IMP_EXP to
200 the variable declaration in the header file.  All exported variables
201 must be declared in a header file and MUST NOT be declared in a
202 source file referencing the variable.
203
204 Exporting a function requires a bit more work.  You must determine the
205 C++ mangled name of the new function.  Fortunately it is displayed in
206 parentheses in the linker error message.  Place it in the
207 .../bacula/src/win32/libbac/bacula.def file.
208
209 In .../bacula/src/win32/libbac/msvc there is a shell "make_def_msvc" that creates 
210 a def file (not really clean way). 
211 In cygwin,  one has to type ./make_def_msvc > bacula.def 
212
213 bacula_cats.dll
214 ---------------
215
216 The code from the src/cats directory is built into database provider
217 specific libraries of the form cats_<db>.dll.
218
219 The database specific portion <db> is mysql for MySQL, pgsql for
220 PostgreSQL, sqlite for SQLite, and bdb for the built-in Bacula database.
221
222 During installation of the Director, one of the database libraries is
223 copied to the system and renamed bacula_cats.dll.
224
225 A new function or data variable which must be accessed from outside
226 of bacula_cats.dll requires special treatment.  It must be specifically
227 exported.
228
229 New data variables and functions are exported by placing their mangled
230 name in the file .../bacula/src/win32/cats/bacula_cats/bacula_cats.def.
231
232 The mangled name is printed, surrounded by parentheses, in the Linker
233 error message.
234
235 In .../bacula/src/win32/bacula_cats/ there is a shell "make_def_msvc" that creates 
236 a def file (not really clean way). 
237 In cygwin,  one has to type ./make_def_msvc > bacula_cats.def