This file documents building Bacula for Microsoft Windows using the cross-compiler tools on a Linux or FreeBSD system (other Unix systems remain to be tested). The basic directory structure you need to have is: bacula-top top level directory -- any name bacula top level Bacula source directory -- any name src win32 main directory where the Windows version is built. depkgs-mingw32 3rd Party Dependencies bin -- include | lib | man | Created by script nsis |-- ..../bacula/src/win32/build-depkgs-mingw32 scons | share | src | ssl -- vss inc A copy of the Windows VSS/inc directory cross-tools Cross compilation tools (gcc, g++, mingw32, ...) binutils-mingw32 -- gcc-mingw32 | Created by script mingw32 |-- ..../bacula/src/win32/build-win32-cross-tools mingw-utils | source -- One-time Setup ============== If you're reading this file you've probably already enlisted in the CVS tree or extracted the contents of the source tar. If not you need to do that first. Once the source is on your system, change to the win32 directory cd ..../bacula/src/win32 Download and build the cross compiler tools ./build-win32-cross-tools Download and build the 3rd party dependencies ./build-depkgs-mingw32 You need the header files from the Microsoft VSS SDK. Unfortunately the SDK can only be downloaded and installed on a Windows system. You can find it on Microsoft's web-site at: http://www.microsoft.com/downloads/details.aspx?FamilyID=0b4f56e4-0ccc-4626-826a-ed2c4c95c871&DisplayLang=en If that link doesn't work then go to http://www.microsoft.com and search for "download volume shadow copy service sdk" Normally the files will be installed in: c:/Program Files/Microsoft/VSSSDK72 You only need to copy everything under the c:/Program Files/Microsoft/VSSSDK72/inc directory into ..../depkgs-mingw32/vss/inc. The above only needs to be done once unless we change the cross-tools or the dependencies versions. In general, you can run the script multiple times with no problem. For it to work, you must have at a minimum the following: gcc g++ wget texinfo bison man2html (in man rpm on Fedora, not available on SuSE, must manually build and install) and possibly other packages. Building ======== Finally, to build the Microsoft Windows version of Bacula, do the following: cd ..../bacula/src/win32 make If all goes well, you will end with all the executables in the ..../bacula/src/win32/release directory. If you have an older build environment, you might do the following to ensure that you pick up all the new Win32 changes: cd make clean cvs update cd src/win32 make Building the Installer ====================== The installer isn't built as part of the default rule, you need to do a make in the src/win32/installer directory or type: cd src/win32 make installer This was done because building the installer takes a bit of time and if you are working on the individual executables it's a pain to wait for it. If you want to build everything in one step you can always type: cd src/win32 make all installer Updating the 3rd party package patches ====================================== If one of the patches change in src/win32/patches, you shouldn't need to update the cross-tools or dependencies for it to build. You can install new patches by doing the following (we assume the patch in question is for openssl): cd /src/win32 ./build-depkgs-mingw32 -C openssl NOTE: The -C means clobber. Any local changes to the source code in the depkgs-mingw32/src directory will be lost. The source will be reextracted from the archive and the current patches will be applied. If you add a new subroutine or global symbol in the CATS library ================================================================= Edit src/win32/cats/bacula_cats.def and update it appropriately. The output of a link will tell you the C++ mangled subroutine name to add, and for global symbols, it is rather easy. See the file. Structure of the new Win32 build environment ============================================ The basic strategy is each Makefile in the various subdirectories includes Makefile.inc, defines variables and rules specific to what is being built, then includes Makefile.rules which defines all the rules. Makefile.inc defines the locations of all the dependencies and the compiler and linker flags. It is automatically created from Makefile.inc.in. Any changes must be made to Makefile.inc.in not Makefile.inc or they will be overwritten the next time Makefile.inc.in is updated. Makefile.rules defines a bunch of macros to simplify building. It also includes all the basic rules for building objects, GUI and console executables, etc. Makefile.template is a template for creating new Makefiles, if you are creating a new directory, copy Makefile.template to Makefile in that directory and edit to suit.