HOWTO Compile Box Backup from source under Windows MingW/Cygwin

This article explain step by step how to compile Box Backup from source as a native Windows binary under MingW/Cygwin.

Install Cygwin

Install Cygwin by downloading the installer from http://www.cygwin.com/setup.exe (2.738 as of October 2011) and select the following packages (and the automatic dependencies that get added once you select the packages):

  • Archive/unzip
  • Devel/autoconf
  • Devel/automake
  • Devel/gcc-mingw
  • Devel/gcc-mingw-g++
  • Devel/gdb
  • Devel/gettext-devel
  • Devel/libtool
  • Devel/make
  • Devel/pkg-config
  • Devel/subversion
  • Lib/libxml2
  • Lib/libxslt
  • Mingw/mingw-zlib-devel
  • Perl/Perl
  • Web/wget

Zlib

The Mingw/mingw-zlib-devel package installed in step one eliminates the need to self-compile: some work saved!

OpenSSL

Version 1.0.0h of OpenSSL compiles perfectly under MingW. We compile our standalone versions with the following steps:
cd /usr/local/src
wget http://www.openssl.org/source/openssl-1.0.0h.tar.gz
tar xzvf openssl-1.0.0h.tar.gz
cd openssl-1.0.0h
./Configure --prefix=/usr/i686-pc-mingw32/ mingw
make
make install_sw

PCRE

The existing Cygwin package of PCRE introduces a GPL requirement because of its cygwin1.dll dependency, as per the discussion with Chris on mailing list. We therefore want to compile our own standalone version with the following steps:
cd /usr/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
tar xvzf pcre-8.30.tar.gz
cd pcre-8.30
./configure --prefix=/usr/i686-pc-mingw32 --enable-utf --enable-unicode-properties \
--disable-shared CFLAGS="-mno-cygwin" CXXFLAGS="-mno-cygwin"
make
make install

Compile and install Readline

Readline enables editing and completion of commands in bbackupquery. It is optional, but it makes bbackupquery easier to use. However, please do not enable readline if you intend to distribute the resulting Box Backup binaries, as this would be a violation of the GPL license of readline.
cd /usr/src
wget http://downloads.sourceforge.net/project/pdcurses/pdcurses/3.4/PDCurses-...
tar xzvf PDCurses-3.4.tar.gz
cd PDCurses-3.4/win32
make -f gccwin32.mak CC="gcc -mno-cygwin" LINK="gcc -mno-cygwin"
cp pdcurses.a /usr/i686-pc-mingw32/lib/libpdcurses.a

cd /usr/src
wget ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz
tar xzvf readline-6.2.tar.gz
cd readline-6.2
./configure --prefix=/usr/i686-pc-mingw32 \
CFLAGS="-mno-cygwin" \
CPPFLAGS="-mno-cygwin" \
LDFLAGS="-mno-cygwin" \
LIBS="-lpdcurses" \
--with-curses --disable-shared

make
make install

Compile Box Backup

You can choose to use the bleeding edge version of Box Backup directly from SVN with the following steps:

cd /usr/src
svn co https://www.boxbackup.org/svn/box/trunk/ boxbackup
cd boxbackup

or use the more stable offical releases that might lack some new features:

cd /usr/src
wget http://www.boxbackup.org/svn/box/packages/boxbackup-0.11.1.tgz
tar xvzf boxbackup-0.11.1.tgz
cd boxbackup-0.11.1.tgz

Now configure and build the client, optionally with [--enable-gnu-readline]:

./infrastructure/mingw/configure.sh [--enable-gnu-readline]
make build-backup-client

The last command compiles the Box Backup client for Windows. You will find the resulting binaries in the parcels sub-directory inside a folder called something like boxbackup-trunk_3086-backup-client-mingw32: the actual SVN revision (3086 in this case) might vary!

Since the server does not work under Win32 anyway, we save ourselves the time by not compiling it. You can type make above (instead of make build-backup-client) if you want to compile both client and server components.