In part 1, we installed the build tools. In part 2, we built Qt and the PostgreSQL libraries from source. In this part, let’s see how to use these to finally build the Manitou-Mail user interface.
The starting point is the set of sources as fetched from the SF.net subversion repository. The latest version can be checked out with for example, Tortoise SVN, as shown in this screenshot:
Source checkout with Tortoise
The difference between a source tarball and sources from the repository is mostly that the configure script and Makefile.in inside each directory are present in the tarball but not in the repository: these files are to be generated by autoconf and automake.
Here are the steps from the checkout of the source to getting the executable file:
Make sure that Qt binaries are in the path:
Generate configure script and Makefile.in files:
automake -a -c
./configure --with-pgsql-includes=/usr/local/pgsql/include --with-pgsql-libs=/usr/local/pgsql/lib
The compilation produces the final executable, manitou.exe, in the src/ directory. While it’s possible to run ‘make install’ at this point as we would do in an Unix environment, personally I don’t use it. This is because I just want to package the executable along with libraries inside an installer that is targeted at Windows systems that generally don’t have MSYS with its Unix-like filiesystem layout.
To package the Manitou-Mail interface for Windows along with the required Qt, PostgreSQL and MingW libraries into a self-contained installer program, I currently use NSIS. The current NSIS script is available on the wiki.
In part 1, we installed the tools that are required to build from source.
This post shows how to use them to compile Qt and the PostgreSQL libraries we need.
Qt is huge and building it from scratch takes a long time, typically several hours on a current desktop machine. Using pre-compiled binaries as available on the Qt site can be preferred, although it is only since quite recently (4.5.2?) that the pre-compiled version can be used to build manitou-mail (As I mentioned in this message to qt-interest, there was a problem with the pre-compiled qmake that precluded its use with autotools scripts launched in MSYS. But this appears to have been fixed).
If however a custom compilation is chosen, here are the steps to follow:
- Download Qt sources into c:\qt\4.5.2 or similar
- Open CMD.EXE and make sure g++ is in the PATH. Add it manually if necessary.
- Inside, c:\qt\4.5.2, run configure.exe -platform win32-g++.
- Run mingw32-make as told at the end of configure, and don’t expect the result before several hours
Beware: contrary to the Unix way of installing from source, no make install is necessary nor possible with Qt/Windows : the build must happen directly inside the destination directory.
- Grab postgresql source tar archive and untar it. I’ve used version 8.4.0, the latest available at the time of this post.
- If /mingw/include/libz.h doesn’t exist, grab and unpack the zlib dev archive in /mingw.
- cd into postgresql source directory and run ./configure
- cd into src/interfaces/libpq
- run make && make install
Once this is done, the headers files to be found in /usr/local/pgsql/include and the libraries (.a and .dll) in /usr/local/pgsql/lib
Conclusion of part 2
Now that Qt and PostgreSQL are built, in the next and final part of this series we’ll compile the manitou-mail application itself for windows, with the toolchain that we installed in part 1.