HOWTO Compile Boxi from source under Windows MingW/Cygwin

This article explain step by step how to compile Boxi, a graphical user interface for Box Backup from source a native Windows binary under MingW/Cygwin.

Install requirements for Box Backup

First of all, please head over to the Box Backup HOWTO and follow all steps before "Compile Box Backup". As a result you will install MingW/Cygwin, compile and install PCRE, and compile and install OpenSSL. Please follow the instructions by the letter, ideally via copy&paste. Then come back.

Welcome back!

Compile and install CPPUnit

The existing Cygwin package of CPPUnit introduces a GPL requirement because of its cygwin1.dll dependency, as per the discussion with Chris on mailing list. In addition, we can compile CPPUnit to be statically linked, i.e. there is no need for the cygcppunit-1-12-1.dll library anymore. We therefore compile our own standalone static version with the following steps:
cd /usr/src
wget http://downloads.sourceforge.net/project/cppunit/cppunit/1.12.1/cppunit-...
tar xvzf cppunit-1.12.1.tar.gz
cd cppunit-1.12.1
./configure --enable-shared=no CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" --prefix="/usr/i686-pc-mingw32/"
make && make install

Compile and install wxWidgets 2.8.12

Compile and install our own standalone version of the latest wxWidgets version with the following steps:
cd /usr/src
wget ftp://ftp.wxwidgets.org/pub/2.8.12/wxWidgets-2.8.12.tar.gz
tar xvzf wxWidgets-2.8.12.tar.gz
cd wxWidgets-2.8.12

Now change setup.h.in to have

#define wxUSE_STACKWALKER 1
#define wxUSE_FSVOLUME 1

Each type of build should be in its own subdirectory separate from the source code. One common convention is 'build-release' and 'build-debug'. We configure wxWidgets to be statically linked, thereby eliminating the need for separate DLL files:

mkdir build-release && cd build-release
../configure \
CFLAGS="-mno-cygwin -O4" CXXFLAGS="-mno-cygwin -O4" CPPFLAGS="-mno-cygwin" LDFLAGS="-mno-cygwin -mwindows" \
--enable-unicode --disable-shared \
--with-msw \
--without-expat \
--disable-precomp-headers \
--prefix="/usr/i686-pc-mingw32/"

If you want to build the debug libraries (note the additional options enable-debug and enable-debug_gdb below), use the following commands:

mkdir build-debug && cd build-debug
../configure \
CFLAGS="-mno-cygwin -O4" CXXFLAGS="-mno-cygwin -O4" CPPFLAGS="-mno-cygwin" LDFLAGS="-mno-cygwin -mwindows" \
--enable-debug --enable-debug_gdb \
--enable-unicode --disable-shared \
--with-msw \
--without-expat \
--disable-precomp-headers \
--prefix="/usr"

Finally compile and install WxWidgets:
make && make install

Compile Boxi

We are now ready to compile Boxi. Please note that Boxi relies heavily on the Box Backup sources, so if you get Boxi from SVN as outlined below, it will automatically pull the latest version of Box Backup as well. This also means that as a nice side effect, in addition to the Boxi binaries you get the stand-alone Box Backup binaries as well.

cd /usr/src
svn co https://boxi.svn.sourceforge.net/svnroot/boxi/trunk/boxi/ boxi
cd boxi
./make-image-headers.pl
./configure-mingw.sh

Finally build the binary:

make

You will find the resulting boxi.exe binary in the sub-directory src/.libs/. Copy boxi.exe into a directory that already contains mgwz.dll and mingwm10.dll, launch boxi.exe and enjoy!