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