• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bacula/H10-Dec-2020-226225

cats/H10-Dec-2020-3,3873,072

compat/H10-Dec-2020-6,0593,973

console/H10-Dec-2020-354320

dird/H10-Dec-2020-1,3481,213

filed/H10-Dec-2020-10,1187,843

full_win32_installer/H03-May-2022-3,3392,814

lib/H10-Dec-2020-256171

libbac/H10-Dec-2020-2,3582,264

libwin32/H03-May-2022-2,1991,413

patches/H10-Dec-2020-17,35016,529

pebuilder/H10-Dec-2020-12876

scripts/H10-Dec-2020-1,044935

stored/H10-Dec-2020-5,5034,751

tools/H10-Dec-2020-2,4832,181

win32_installer/H03-May-2022-3,3502,753

win64_installer/H03-May-2022-3,2832,732

wx-console/H10-Dec-2020-475437

External-mingw-w64H A D10-Dec-20204.4 KiB7573

External-mingw32H A D10-Dec-20204.3 KiB7170

External-msvcH A D10-Dec-20203.3 KiB6059

MakefileH A D10-Dec-20204.7 KiB169133

Makefile.fullH A D10-Dec-20203.1 KiB11495

Makefile.inc.inH A D10-Dec-20204 KiB162130

Makefile.rulesH A D10-Dec-20201.8 KiB8057

README.mingwH A D10-Dec-202012.3 KiB377273

README.vc8H A D10-Dec-20209.3 KiB247176

bacula.slnH A D10-Dec-202027.5 KiB404402

build-depkgs-mingw-w64H A D10-Dec-202012.6 KiB452380

build-depkgs-mingw32H A D10-Dec-202018.9 KiB660567

cygwin.NET.bashrcH A D10-Dec-20202.7 KiB6462

makeallH A D10-Dec-202092 83

winapi.hH A D10-Dec-20207.5 KiB207114

README.mingw

1
2Instructions for cross compiling the Win32/64 FD on Linux
3=======================================================
4This part of the file documents the tools (scripts) we use for building Bacula for
5Microsoft Windows using the cross-compiler tools on a Linux system.  We
6use Ubuntu 14.04 so building on that system should definitely work.  But there
7shouldn't be any issues on other Linux distributions.
8
9We don't officially support this method, but it is what we use, and it should
10build on any Linux machine if you carefully follow the instructions and have
11all the prerequisite programs loaded on your machine.
12
13We expect that there may be problems on systems other than Linux where you
14are pretty much on your own.  However, we will try to provide responses to
15your questions on the bacula-devel list, but we can't guarantee anything.
16
17Note: the environment variable DEPKGS must point to a directory that
18contains: depkgs-mingw32 depkgs-mingw-w64 and cross-tools
19
20Directory Structure
21=====================
22The new directory structure is:
23
24 xxx  (any directory)
25    bacula                   Top level Bacula source directory -- any name
26      src
27        win32                Main directory where Windows version is built.
28
29    docs                     Top level Bacula documentation directory
30
31 yyy (any directory, but pointed to by the DEPKGS environment variable)
32    depkgs-mingw32 (MinGW32) 3rd Party Dependencies for MinGW32 build
33      bin              --    NOTE!  depkgs-msvc is no longer suppored
34      include            |
35      lib                |
36      man                |   Created by script
37      nsis               |-- .../bacula/src/win32/build-depkgs-mingw32
38      scons              |
39      share              |
40      src                |
41      ssl              --
42      vss
43        inc                  A copy of the Windows VSS/inc directory
44
45
46    depkgs-mingw-w64 (MinGW64) 3rd Party Dependencies for MinGW64 build
47      bin              --
48      include            |
49      lib                |
50      man                |   Created by script
51      nsis               |-- .../bacula/src/win32/build-depkgs-mingw-w64
52      scons              |
53      share              |
54      src                |
55      ssl              --
56      vss
57        inc                  A copy of the Windows VSS/inc directory
58
59One-time Setup
60==============
61
62If you're reading this file you've probably already cloned the GIT source tree or
63extracted the contents of the source tar. If not you need to do that first.
64
65You also need to download one of the doc tar balls and extract to your
66top level Bacula directory.
67
68The extracted doc directory name will be bacula-docs-version where version
69is the version number.  The directory must be renamed to docs (ie remove
70the leading bacula- and the -version portion of the name).
71
72An alternative to setting up the old documents that are needed by the Win32
73installer, you may comment out the following lines in
74src/win32/win32_installer/Makefile:
75
76#DOC_FILES := \
77#       manual/bacula.pdf \
78#       manual/bacula/*.html \
79#       manual/bacula/*.png  \
80#       manual/bacula/*.css
81
82Note, a number of packages must be installed to build the the depkgs files.
83Most are rather standard such as gcc, g++,
84make, ...  However a few that you may not have are:
85
86  wget
87  texinfo
88  flex
89  bison
90  patch (Debian)
91  m4
92  postgresql (at least client)
93  mysql (at least client)
94  SQLite3 (from depkgs or as package)
95  readline (readlineN-dev on Debian)
96  ...
97
98NB: On Debian, I had to remove /usr/bin/lorder for
99postresql to build correctly.
100
101Install the cross compiler and makensis
102    apt-get install g++-mingw-w64-i686 g++-mingw-w64-x86-64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 nsis
103
104For OpenSSL 1.0.2n, I have commented out the fstat() definition in /usr/share/mingw-w64/include/sys/stat.h
105with #ifdef 0 / #endif
106
107Download and build the 3rd party dependencies
108        ./build-depkgs-mingw32
109        ./build-depkgs-mingw64
110
111Files are also available on bsweb:/var/www/dl/Depkgs-mingw32-6.6-paa9aiMa/
112
113
114Make sure that libgcc and libstdc++ mingw files are copied to depkgs-mingw32/bin and depkgs-mingw-w64/bin
115   /usr/lib/gcc/i686-w64-mingw32/*-posix/libgcc_s_sjlj-1.dll
116   /usr/lib/gcc/i686-w64-mingw32/*-posix/libstdc++-6.dll
117   /usr/i686-w64-mingw32/lib/libwinpthread-1.dll
118
119   /usr/lib/gcc/x86_64-w64-mingw32/*-posix/libgcc_s_seh-1.dll
120   /usr/lib/gcc/x86_64-w64-mingw32/*-posix/libstdc++-6.dll
121   /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll
122
123Note, that during the build process you will see a moderate amount of
124output and some warnings.  If something more serious happens
125and the build fails, it is probably because you don't have one
126of the build dependencies (hopefully all mentioned above) loaded on your
127system. To find out what is going wrong, do the following:
128
129  cd .../depkgs-mingw32/src/<package-name>
130
131where <package-name> is where the package is unpacked and built. Normally
132it is relatively obvious when looking at the src directory.
133
134In that directory, you should find a make.log, which has the full details
135of the compiles, links, and installs done for that package.
136
137===
138
139For the QT part, you must download QT binaries from
140QT website
141
142the http://download.qt-project.org/archive/qt/4.8/4.8.4/
143
144Then, copy Qt*dll files to depkgs-mingw32/bin and headers to
145depkgs-mingw32/include
146
147===
148
149See External-mingw-w64 for download location
150
151You need the header files from the Microsoft VSS SDK.  Unfortunately the SDK
152can only be downloaded and installed on a Windows system.  We do not have
153the right to distribute it, so you must download it yourself.
154You can find it on Microsoft's web-site at:
155
156http://www.microsoft.com/downloads/details.aspx?FamilyID=0b4f56e4-0ccc-4626-826a-ed2c4c95c871&DisplayLang=en
157
158If that link doesn't work then go to http://www.microsoft.com and search for
159
160        "download volume shadow copy service sdk"
161
162we are currently using version 7.2 released 8/3/2005 (a bit old, but it
163works).
164
165Normally the files will be installed in:
166
167        c:\Program Files\Microsoft\VSSSDK72
168
169You only need to copy everything under the c:\Program Files\Microsoft\VSSSDK72\inc
170directory into .../depkgs-mingw32/vss/inc. and .../depkgs-mingw-w64/vss/inc
171In doing so, please ensure that
172the case in maintained on the directory and filenames -- some contain uppercase
173characters !!!
174
175Some definitions are already defined in other headers, it produces warnings
176and the depkgs-mingw-w64.tar.bz2 archive contains fixes with #ifndef
177
178The above only needs to be done once unless we change the cross-tools
179or the dependencies versions.  In general, you can run the script multiple
180times with no problem.  For it to work, you must have at a minimum the
181following:
182
183        gcc
184        g++
185        patch
186        wget
187        texinfo
188        bison
189        flex
190        python
191        unzip
192        tar
193
194and possibly other packages.
195
196
197Building
198========
199
200Finally, to build the Microsoft Windows version of Bacula, do the following:
201
202   cd .../bacula/src/win32
203   make clean
204   ./makeall
205
206or
207  cd .../bacula/src/win32
208  make clean
209  make
210  make win64=yes
211
212This builds both the 32 bit version and the 64 bit version.
213The binaries are in the release32 and release64 directories.
214
215
216
217Updating the 3rd party package patches
218======================================
219
220If one of the patches changes in .../bacula/src/win32/patches, you will
221need to update the corresponding dependency.
222
223Adding a new global function or global data
224===========================================
225
226bacula.dll
227----------
228
229The code from the following directories is built into bacula.dll:
230
231   .../bacula/src/lib
232   .../bacula/src/libfind
233   .../bacula/src/win32/compat
234
235A new function or data variable which must be accessed from outside
236of bacula.dll requires special treatment.  It must be specifically
237exported.
238
239New data variables are exported by adding the macro DLL_IMP_EXP to
240the variable declaration in the header file.  All exported variables
241must be declared in a header file and MUST NOT be declared in a
242source file referencing the variable. Example, src/lib/runscript.h:
243
244extern DLL_IMP_EXP bool (*console_command)(JCR *jcr, const char *cmd);
245
246or src/jcr.h
247
248extern int DLL_IMP_EXP num_jobs_run;
249extern DLL_IMP_EXP dlist * last_jobs;
250...
251
252
253Exporting functions is now more or less automated.  If you find that
254a function name has been added, changed, or an argument modified,
255simply do the following:
256
257   cd .../bacula/src/win32/lib
258   make                  (to build the .o files, note the link will fail)
259   ./make_def >bacula64.def   or >bacula64.def
260
261This should rebuild the bacula.def file, but it uses relative paths
262and assumes you have the directory structure noted above. If you
263are using something different, you can set the NM variable at the
264top of the make_def file to use an absolute path to the correct
265directory.
266
267===== manual changing of bacula32.def or bacula64.def no longer necessary =====
268If you want to do it manually, please see below:
269Exporting a function requires a bit more work.  You must determine the
270C++ mangled name of the new function.
271
272   strings .../bacula/src/win32/lib/<file>.o | grep <symbol>
273
274Note, strings often will not show the desired symbol. In that case,
275use:
276
277   nm .../bacula/src/win32/lib/<file>.o
278
279Replace <file> with the base part of the name of the source code file
280which contains the new function.  Replace <symbol> with the name of
281the new function.  Remove the leading underscore and place the result
282in the file
283
284   .../bacula/src/win32/lib/bacula64.def
285=== end manual changing of bacula64.def ==========
286
287If you add a new file, you will need to specify its name in
288
289   .../bacula/src/win32/lib/Makefile
290and
291   .../bacula/src/win32/libbac/Makefile
292
293
294Running gdb on the Win32 files
295==================================================
296You can use the mingw64 gdb to debug Bacula on Win64 by downloading
297it from Source Forge:
298
299http://sourceforge.net/project/showfiles.php?group_id=202880&package_id=311650
300
301
302Download one of their .exe versions, which is an installer that you
303can run on Win32 to install gdb.  This gdb is built with mingw64 so will
304run independently of any cygwin installation.  Note, not all the releases
305come with an installer. I had to go back 3 or 4 versions to find it.  Otherwise
306you can download the source and build it.  Thanks to Eric Bollengier for
307this tip.
308
309Build Trial version
310===================
311
312To build trial version, just add the HAVES=-DBEEF_DEMO_ENABLED=1 environment
313variable before compiling everything.
314
315Structure of the MinGW64/32 build environment
316==========================================
317
318The basic strategy is each Makefile in the various subdirectories includes
319Makefile.inc, defines variables and rules specific to what is being built,
320then includes Makefile.rules which defines all the rules.
321
322Makefile.inc defines the locations of all the dependencies and the compiler
323and linker flags.  It is automatically created from Makefile.inc.in.  Any
324changes must be made to Makefile.inc.in not Makefile.inc or they will be
325overwritten the next time Makefile.inc.in is updated.
326
327Makefile.rules defines a bunch of macros to simplify building.  It also
328includes all the basic rules for building objects, GUI and console
329executables, etc.
330
331Makefile.template is a template for creating new Makefiles, if you are
332creating a new directory, copy Makefile.template to Makefile in that
333directory and edit to suit.
334
335Upgrading the system mingw
336==================================
337Every time you upgrade the system mingw, for example when changing from
338Ubuntu 12.04 to Ubuntu 14.04, you much update the system library dll
339files in your build environment.
340
341Do so by running from src/win32
342
343./build-depkgs-mingw32 mingw
344./build-depkgs-mingw-w64 mingw
345
346All that does is copy the system .dll files into the appropriate
347depkgs directory.  Then while building the installer, these files
348are copied from the depkgs directory into the installer binary.
349
350Alternatively, you can look at the build-depkgs-xxx script and
351manually run the code in the function process_mingw().
352
353
354Upgrading your depkgs mingw
355====================================
356
357mkdir old
358mv cross-tools old
359mv depkgs-mingw32 old
360mv depkgs-mingw-w64 old
361
362# from src/win32
363./build-depkgs-mingw32
364./build-depkgs-mingw-w64
365
366# from new depkgs-mingw32 dir
367cp ../old/depkgs-mingw32/bin/libgcc_s_dw2-1.dll bin/
368cp ../old/depkgs-mingw32/bin/Qt* bin/
369cp -r ../old/depkgs-mingw32/lib/qt lib
370cp -r ../old/depkgs-mingw32/include/qt include/
371cp -r ../old/depkgs-mingw32/include/src include/
372cp -r ../old/depkgs-mingw32/vss .
373
374
375# from new depkgs-mingw-w64
376cp -r ../old/depkgs-mingw-w64/vss .
377

README.vc8

1Instructions to build Bacula with Microsoft Visual C++ 2005
2===========================================================
3
4NOTE: These instructions are probably quite accurate as several people
5have used them.  However, the project no longer maintains the files necessary
6to build using MSVC.  As a consequence, some of the file and scripts may
7be out of date, and you will almost surely need to manually update the
8MSVC project files.  We do not supply any support on this.
9
10The project uses Mingw to cross-compile.  Those files are kept up to date though
11during development, they may sometimes be broken for a few days ...
12
13Using 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
68One-time Setup
69==============
70
71If you're reading this file you've probably already enlisted in the CVS
72tree or extracted the contents of the source tar.  If not you need to do
73that first.
74
75You also need to download one of the doc tar balls and extract to your
76top level Bacula directory.  It is referred to as bacula-top in the
77diagram located in README.win32.  It will be signified in this file as ...
78
79The extracted doc directory name will be bacula-docs-version where
80version is the version number.  The directory must be renamed to docs
81(ie remove the leading bacula- and the trailing -version portion of the
82name).
83
84The script build-depkgs-msvc.cmd is used to download and build all the
85third party dependencies required by Bacula.  In order to build the
86dependencies you need the following utilities.  Only the binaries listed
87in parenthesis are required.  Perl must be listed in the PATH, the other
88utilities 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
120Once the utilities are installed continue with the next steps.
121
122Start VC++ 2005 command prompt (in the start menu)
123
124   cd ...\bacula\src\win32 directory.
125
126Only if you are using Microsoft Visual C++ Express
127
128   "%VCINSTALLDIR%\PlatformSDK\SetEnv"
129
130The following step should only need to be done the first time and
131whenever the dependencies change.
132
133   build-depkgs-msvc
134
135At this point all of the dependencies should have been downloaded and
136built.
137The above only needs to be done once unless we change the cross-tools or
138the dependencies versions.  In general, you can run the script multiple
139times with no problem.
140
141
142Building
143========
144
145Start VC++ 2005 command prompt (in the start menu)
146
147   cd ...\bacula\src\win32
148
149If you are using Microsoft Visual C++ Express
150
151   "%VCINSTALLDIR%\PlatformSDK\SetEnv"
152
153To build the debug version
154
155   build-msvc "Debug|Win32"
156
157To build the release version
158
159   build-msvc "Release|Win32"
160
161To cleanup all the built files
162
163   build-msvc /c
164
165To cleanup only the debug built files
166
167   build-msvc /c "Debug|Win32"
168
169To rebuild the debug version
170
171   build-msvc /r "Debug|Win32"
172
173
174Updating the 3rd party package patches
175======================================
176
177If one of the patches changes in ...\bacula\src\win32\patches, you will
178need to update the corresponding dependency.  You can install new patches
179by 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
186NOTE: 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
192Adding a new global function or global data
193===========================================
194
195bacula.dll
196----------
197
198The 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
204A new function or data variable which must be accessed from outside
205of bacula.dll requires special treatment.  It must be specifically
206exported.
207
208New data variables are exported by adding the macro DLL_IMP_EXP to
209the variable declaration in the header file.  All exported variables
210must be declared in a header file and MUST NOT be declared in a
211source file referencing the variable.
212
213Exporting a function requires a bit more work.  You must determine the
214C++ mangled name of the new function.  Fortunately it is displayed in
215parentheses in the linker error message.  Place it in the
216.../bacula/src/win32/libbac/bacula.def file.
217
218In .../bacula/src/win32/libbac/msvc there is a shell "make_def_msvc" that creates
219a def file (not really clean way).
220In cygwin,  one has to type ./make_def_msvc > bacula.def
221
222bacula_cats.dll
223---------------
224
225The code from the src/cats directory is built into database provider
226specific libraries of the form cats_<db>.dll.
227
228The database specific portion <db> is mysql for MySQL, pgsql for
229PostgreSQL, sqlite for SQLite, and bdb for the built-in Bacula database.
230
231During installation of the Director, one of the database libraries is
232copied to the system and renamed bacula_cats.dll.
233
234A new function or data variable which must be accessed from outside
235of bacula_cats.dll requires special treatment.  It must be specifically
236exported.
237
238New data variables and functions are exported by placing their mangled
239name in the file .../bacula/src/win32/cats/bacula_cats/bacula_cats.def.
240
241The mangled name is printed, surrounded by parentheses, in the Linker
242error message.
243
244In .../bacula/src/win32/bacula_cats/ there is a shell "make_def_msvc" that creates
245a def file (not really clean way).
246In cygwin,  one has to type ./make_def_msvc > bacula_cats.def
247