4 \chapter{Bacula Porting Notes}
6 \index{Notes!Bacula Porting}
7 \index{Bacula Porting Notes}
8 \addcontentsline{toc}{section}{Bacula Porting Notes}
10 This document is intended mostly for developers who wish to port Bacula to a
11 system that is not {\bf officially} supported.
13 It is hoped that Bacula clients will eventually run on every imaginable system
14 that needs backing up (perhaps even a Palm). It is also hoped that the Bacula
15 Directory and Storage daemons will run on every system capable of supporting
18 \section{Porting Requirements}
19 \index{Requirements!Porting}
20 \index{Porting Requirements}
21 \addcontentsline{toc}{section}{Porting Requirements}
23 In General, the following holds true:
26 \item {\bf Bacula} has been compiled and run on Linux RedHat, FreeBSD, and
28 \item In addition, clients exist on Win32, and Irix
29 \item It requires GNU C++ to compile. You can try with other compilers, but
30 you are on your own. The Irix client is built with the Irix complier, but, in
31 general, you will need GNU.
32 \item Your compiler must provide support for 64 bit signed and unsigned
34 \item You will need a recent copy of the {\bf autoconf} tools loaded on your
35 system (version 2.13 or later). The {\bf autoconf} tools are used to build
36 the configuration program, but are not part of the Bacula source
38 \item There are certain third party packages that Bacula needs. Except for
39 MySQL, they can all be found in the {\bf depkgs} and {\bf depkgs1} releases.
40 \item To build the Win32 binaries, we use Microsoft VC++ standard
41 2003. Please see the instructions in
42 bacula-source/src/win32/README.win32 for more details. If you
43 want to use VC++ Express, please see README.vc8. Our build is
44 done under the most recent version of Cygwin, but Cygwin is
45 not used in the Bacula binaries that are produced.
46 Unfortunately, we do not have the resources to help you build
47 your own version of the Win32 FD, so you are pretty much on
48 your own. You can ask the bacula-devel list for help, but
49 please don't expect much.
50 \item {\bf Bacula} requires a good implementation of pthreads to work.
51 \item The source code has been written with portability in mind and is mostly
52 POSIX compatible. Thus porting to any POSIX compatible operating system
53 should be relatively easy.
56 \section{Steps to Take for Porting}
57 \index{Porting!Steps to Take for}
58 \index{Steps to Take for Porting}
59 \addcontentsline{toc}{section}{Steps to Take for Porting}
62 \item The first step is to ensure that you have version 2.13 or later of the
63 {\bf autoconf} tools loaded. You can skip this step, but making changes to
64 the configuration program will be difficult or impossible.
65 \item The run a {\bf ./configure} command in the main source directory and
66 examine the output. It should look something like the following:
70 Configuration on Mon Oct 28 11:42:27 CET 2002:
71 Host: i686-pc-linux-gnu -- redhat 7.3
72 Bacula version: 1.27 (26 October 2002)
73 Source code location: .
74 Install binaries: /sbin
75 Install config files: /etc/bacula
78 Compiler flags: -g -O2
81 Statically Linked Tools: no
83 Database type: Internal
85 Job Output Email: root@localhost
86 Traceback Email: root@localhost
87 SMTP Host Address: localhost
90 Storage daemon Port 9103
91 Working directory /etc/bacula/working
92 SQL binaries Directory
93 Large file support: yes
95 cweb support: yes /home/kern/bacula/depkgs/cweb
96 TCP Wrappers support: no
98 enable-smartalloc: yes
104 The details depend on your system. The first thing to check is that it
105 properly identified your host on the {\bf Host:} line. The first part (added
106 in version 1.27) is the GNU four part identification of your system. The part
107 after the -- is your system and the system version. Generally, if your system
108 is not yet supported, you must correct these.
109 \item If the {\bf ./configure} does not function properly, you must determine
110 the cause and fix it. Generally, it will be because some required system
111 routine is not available on your machine.
112 \item To correct problems with detection of your system type or with routines
113 and libraries, you must edit the file {\bf
114 \lt{}bacula-src\gt{}/autoconf/configure.in}. This is the ``source'' from
115 which {\bf configure} is built. In general, most of the changes for your
116 system will be made in {\bf autoconf/aclocal.m4} in the routine {\bf
117 BA\_CHECK\_OPSYS} or in the routine {\bf BA\_CHECK\_OPSYS\_DISTNAME}. I have
118 already added the necessary code for most systems, but if yours shows up as
119 {\bf unknown} you will need to make changes. Then as mentioned above, you
120 will need to set a number of system dependent items in {\bf configure.in} in
121 the {\bf case} statement at approximately line 1050 (depending on the Bacula
123 \item The items to in the case statement that corresponds to your system are
127 \item DISTVER -- set to the version of your operating system. Typically some
128 form of {\bf uname} obtains it.
129 \item TAPEDRIVE -- the default tape drive. Not too important as the user can
131 \item PSCMD -- set to the {\bf ps} command that will provide the PID in the
132 first field and the program name in the second field. If this is not set
133 properly, the {\bf bacula stop} script will most likely not be able to stop
135 \item hostname -- command to return the base host name (non-qualified) of
136 your system. This is generally the machine name. Not too important as the
137 user can correct this in his configuration file.
138 \item CFLAGS -- set any special compiler flags needed. Many systems need a
139 special flag to make pthreads work. See cygwin for an example.
140 \item LDFLAGS -- set any special loader flags. See cygwin for an example.
141 \item PTHREAD\_LIB -- set for any special pthreads flags needed during
142 linking. See freebsd as an example.
143 \item lld -- set so that a ``long long int'' will be properly edited in a
145 \item llu -- set so that a ``long long unsigned'' will be properly edited in
147 \item PFILES -- set to add any files that you may define is your platform
148 subdirectory. These files are used for installation of automatic system
149 startup of Bacula daemons.
152 \item To rebuild a new version of {\bf configure} from a changed {\bf
153 autoconf/configure.in} you enter {\bf make configure} in the top level Bacula
154 source directory. You must have done a ./configure prior to trying to rebuild
155 the configure script or it will get into an infinite loop.
156 \item If the {\bf make configure} gets into an infinite loop, ctl-c it, then
157 do {\bf ./configure} (no options are necessary) and retry the {\bf make
158 configure}, which should now work.
159 \item To rebuild {\bf configure} you will need to have {\bf autoconf} version
160 2.57-3 or higher loaded. Older versions of autoconf will complain about
161 unknown or bad options, and won't work.
162 \item After you have a working {\bf configure} script, you may need to make a
163 few system dependent changes to the way Bacula works. Generally, these are
164 done in {\bf src/baconfig.h}. You can find a few examples of system dependent
165 changes toward the end of this file. For example, on Irix systems, there is
166 no definition for {\bf socklen\_t}, so it is made in this file. If your
167 system has structure alignment requirements, check the definition of BALIGN
168 in this file. Currently, all Bacula allocated memory is aligned on a {\bf
170 \item If you are having problems with Bacula's type definitions, you might
171 look at {\bf src/bc\_types.h} where all the types such as {\bf uint32\_t},
172 {\bf uint64\_t}, etc. that Bacula uses are defined.