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