Recently, we changed the build system of Bongo – we’ve moved away from autotools. This isn’t to say that autotools is necessarily that deficient, but the new CMake system we’re using is a lot more suitable for our kind of project. This has brought some immediate benefits – much simpler build system, much quicker compiles and installations (‘make install’ in particular is now much faster), and a slightly simpler source tree. We can also now build binaries out-of-source, which is a huge boon.

However, we haven’t yet really documented properly all the different build options and how it works. So here it is – your primer to the new Bongo build system.

Once you’ve checked out Bongo, you’ll see a source tree which looks something like this:

$ ls
ABOUT-NLS  cmake           COPYING  import   INSTALL  po      TODO
AUTHORS    CMakeLists.txt  doxygen  include  man      README  zoneinfo
ChangeLog  config.h.cmake  HACKING  init     NEWS     src

The first thing we should do is create a new directory to do our build in: this stops all our build files from littering the source tree.

$ mkdir build
$ cd build/

Now we need to configure the build. There are two ways of doing this, and I use both! One way is good to start off, the other way is good for tweaking. You’ll see what I mean, but let’s start with the initial configuration. This is how I usually start:


The first argument points to the Bongo source directory. Because I made a ‘build’ directory in the source tree and went into it, we’re just pointing at our parent directory. Then come some other options. Every option is prefixed with “-D”, and some of them are CMake options and others are Bongo options. In full:

  • CMAKE_INSTALL_PREFIX: where we want to install to. I use /tmp/build for testing, and /usr/local/bongo when I want to run it in production.
  • BONGO_USER: which user you want Bongo to run as. I use my user account for testing, “bongo” for production. You can also run as “root” if brave (not recommended!)
  • CMAKE_BUILD_TYPE: set this to Debug to generate information for gdb, otherwise leave this option out.
  • DEBUG: enable code paths which generate debugging messages. Both this option and the previous are for either advanced users or developers, really.

There are other options to the Bongo build, but these are the main ones. However, once you’ve configured Bongo, you may want to tweak something: perhaps turn on debugging, or change one of the file paths, or something different. The easiest way to do that is simply:

$ ccmake ./

Note that it’s “ccmake”, not “cmake”. This starts an interactive application where you can change each configuration item. You point it at the build directory, not the source, and it gives you all the various tweakable options. You’ll see that they are the same options that we pass to cmake – and indeed, you can pass them to cmake! There’s even an advanced mode with even more knobs (press ‘t’). When you’re done, press ‘c’ to configure the build and then ‘q’ to quit.

Once you have configured the build, you have access to the usual make commands:

$ make
$ make install
$ make clean

The first builds Bongo, the second installs it to your prefix, the last removes the built files.