Currently this guide is written assuming you are either developing
on something like Unix (probably either Linux or OS X). You can use
software suchas Virtual Box to run
a ‘virtual’ Linux machine on another operating system; in this case
we recommend using the most recent Ubuntu LTS
release.

It should be possible to build and develop Xapian on Windows,
but we currently don’t have any documentation on doing so, or
any active developers with suitable experience.

First off, let’s make sure you have a copy of the Xapian source and
can build it and run the tests. This is generally a little different
to if you’re just installing Xapian to use it, because you’ll be
working with the entire source tree rather than individual pieces. The
Xapian build system has some support for this, but let’s get you a
copy of everything first:

$ git clone git://git.xapian.org/xapian
$ cd xapian

This will ‘clone’ a complete copy of the Xapian source code, including
not only the core library but also the variable language bindings (for
use from Python, Lua, Ruby and so on) and the self-contained web
search system ‘Omega’. It also contains all the tests for those
various components.

Xapian needs to set up a few things with a fresh clone of the code, as
well as downloading and building some tools for which we require very
precise versions. You should run this command in the xapian
directory that was created earlier when you cloned the source code:

$ ./bootstrap

To download tools, bootstrap will use wget, curl or
lwp-request if installed. If not, it will give an error telling
you the URL to download from by hand and where to copy the file to.

Note

As well as installing some tools, bootstrap will also run
autoreconf on each of the checked-out subdirectories, and
generate a top-level configure script. This configure script
allows you to configure xapian-core and any other modules you’ve
checked out with a single simple command, such that the other modules
link against the uninstalled xapian-core (which is very handy for
development work and a bit fiddly to set up by hand). It
automatically passes --enable-maintainer-mode to the
subprojects so that the autotools will be rerun if
configure.ac, Makefile.am, etc are modified.

Warning

If you are tracking development in git, there will sometimes be
changes to the build system sources which require regeneration of
the generated makefiles and associated machinery. We aim to make
the build system automatically regenerate the necessary files, but
in the event that a build fails after an update, it may be worth
re-running the bootstrap script to regenerate the build system from
scratch, before looking for the cause of the error elsewhere.

Configuring the code is mostly about Xapian’s build system
automatically detecting where all its dependencies are on your
computer, so it knows how to use them. However there are various
options that allow you to either override the
autodetection (for instance if you wanted to build python bindings
against a particular version of python) or change some defaults. For
now, however, we’ll just run it accepting all its defaults:

$ ./configure

Note that on OS X you probably want to turn off the Perl and TCL8
bindings when developing, as there are some complexities when
developing against the system versions, and the homebrew versions are
slightly awkward:

First it will build xapian-core, the core library. Then it will build
Omega and the language bindings, using the version of xapian-core
you’ve just built, but not yet installed. (This is the bit that causes
some problems on OS X if you use system versions of any of the
languages.)