How to compile Bacula FD 2.2.8 on Mac OS X 10.6 Snow Leopard

First patch the original source code with this:

--- ./src/filed/restore.c-orig 2009-11-06 10:20:57.000000000 +0100
+++ ./src/filed/restore.c 2009-11-06 10:22:43.000000000 +0100
@@ -153,7 +153,7 @@
uint32_t buf_size; /* client buffer size */
int stat;
ATTR *attr;
- intmax_t rsrc_len = 0; /* Original length of resource fork */
+ int64_t rsrc_len = 0; /* Original length of resource fork */
r_ctx rctx;
/* ***FIXME*** make configurable */
crypto_digest_t signing_algorithm = have_sha2 ?
@@ -547,7 +547,7 @@
continue;
}

- rctx.fork_size = rsrc_len;
+ rctx.fork_size = (intmax_t)rsrc_len;
Dmsg0(30, "Restoring resource fork\n");
}

--- ./src/findlib/find.c-orig 2009-11-06 10:23:34.000000000 +0100
+++ ./src/findlib/find.c 2009-11-06 10:24:18.000000000 +0100
@@ -67,13 +67,13 @@

/* Get system path and filename maximum lengths */
path_max = pathconf(".", _PC_PATH_MAX);
- if (path_max < 1024) { - path_max = 1024; + if (path_max < 2048) { + path_max = 2048; } name_max = pathconf(".", _PC_NAME_MAX); - if (name_max < 1024) { - name_max = 1024; + if (name_max < 2048) { + name_max = 2048; } path_max++; /* add for EOS */ name_max++; /* add for EOS */ --- ./src/lib/base64.c-orig 2009-11-06 10:17:36.000000000 +0100 +++ ./src/lib/base64.c 2009-11-06 10:19:12.000000000 +0100 @@ -74,9 +74,9 @@ * stored (not including the EOS). */ int -to_base64(intmax_t value, char *where) +to_base64(int64_t value, char *where) { - uintmax_t val; + uint64_t val; int i = 0; int n; @@ -98,7 +98,7 @@ val = value; where[i] = 0; do { - where[--i] = base64_digits[val & (uintmax_t)0x3F]; + where[--i] = base64_digits[val & (uint64_t)0x3F]; val >>= 6;
} while (val);
return n;
@@ -112,9 +112,9 @@
* Returns the value.
*/
int
-from_base64(intmax_t *value, char *where)
+from_base64(int64_t *value, char *where)
{
- uintmax_t val = 0;
+ uint64_t val = 0;
int i, neg;

if (!base64_inited)
@@ -131,7 +131,7 @@
val += base64_map[(uint8_t)where[i++]];
}

- *value = neg ? -(intmax_t)val : (intmax_t)val;
+ *value = neg ? -(int64_t)val : (int64_t)val;
return i;
}

--- ./src/lib/protos.h-orig 2009-11-06 10:19:28.000000000 +0100
+++ ./src/lib/protos.h 2009-11-06 10:28:46.000000000 +0100
@@ -42,8 +42,8 @@

/* base64.c */
void base64_init (void);
-int to_base64 (intmax_t value, char *where);
-int from_base64 (intmax_t *value, char *where);
+int to_base64 (int64_t value, char *where);
+int from_base64 (int64_t *value, char *where);
int bin_to_base64 (char *buf, int buflen, char *bin, int binlen,
int compatible);

Then configure using

./configure --prefix=/usr/local --enable-client-only --with-openssl --with-working-dir=/var/db/bacula --with-pid-dir=/var/run

Run make && sudo make install

Configuration and the like can be found here

Enjoy!