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" && make
make install

Compile and install wxWidgets 2.8.11

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.11/wxWidgets-2.8.11.tar.gz
tar xvzf wxWidgets-2.8.11.tar.gz
cd wxWidgets-2.8.11

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'. So for example:

mkdir build-debug
cd build-debug

Then configure wxWidgets to be statically linked, thereby eliminating the need for separate DLL files:
export CFLAGS="-mno-cygwin -O4" CXXFLAGS="-mno-cygwin -O4" CPPFLAGS="-mno-cygwin" LDFLAGS="-mno-cygwin -mwindows"
../configure --enable-unicode --enable-debug --disable-shared \
--enable-debug_gdb --with-msw \
--without-expat \
--disable-precomp-headers

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

This last command will eventually abort with an error message:

configure: creating ./config.status
config.status: error: cannot find input file: `Makefile.in'
Error: configure failed, aborting.

due to a problem with wxchart. We need to remove all references to wxchart from Makefile.am by issuing the following command

sed -i 's/wxchart//g' Makefile.am

and finally we can finalise the configuration and build the binary:

automake Makefile
./config.status
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!