Boost logo

Boost-Build :

From: Walter Landry (wlandry_at_[hidden])
Date: 2006-04-24 17:41:19


Greetings,

As promised, I am giving a brief overview of how I use BuildSystem
[1]. First of all, I did not develop BuildSystem, I just use it.
Also, it is not a finished product. But it is the only configuration
system I know of that runs on Windows without installing Cygwin or
mingw [2]. It's autodetection is not as developed on Windows as on
Unix.

BuildSystem is meant to be a replacement for Autoconf. It runs a
number of tests on your machine to see what compilers, libraries,
headers, executables, etc there are. It has a facility for generating
files for inclusion into make files, and can also generate headers. I
do not, at present, use either of those two facilities. Rather, I use
the ability to perform substitutions in files. I use SCons to build
the software, so I perform substitutions on SContruct.in.

BuildSystem is written almost entirely in Python. The only exceptions
are two shell scripts: config.guess and config.sub. Those would have to be replaced

For an example of using BuildSystem, go to

  http://geodynamics.org/svn/cig/long/3D/Gale/configure.py

In that file, the real meat is in a try...except block most of the way
down. The rest checks for bad pythons, bad threading libraries,
option parsing, error handling, etc.

In that try...except block, there are a number of calls to
addArgumentSubstition. Those calls tell configure which variables to
do substitutions for. The line with "framework.configure" does the
actual configurations and substitions. That jumps us to the configure
function in Configure.py

  http://geodynamics.org/svn/cig/long/3D/Gale/trunk/python/Gale/Configure.py

The interesting part there is in setupDependencies which enumerates
which packages to configure. For this code, we need libxml2, petsc,
and mpi. So we will look at the libxml2 package in

  http://geodynamics.org/svn/cig/long/3D/Gale/trunk/python/Gale/packages/libxml2.py

The meat of that work is done in configureLibrary(). This is where
the rubber meets the road and tests really get written. It starts by
checking for includes, and can optionally take common directories to
look in. It does a similar thing for libraries, though it really
checks whether you can link with that library. Finally, if include
and library directories are found, then it writes out the
substitutions.

The libxml2 package derives from Package.package.Package

  http://geodynamics.org/svn/cig/long/3D/Gale/trunk/python/petsc/python/PETSc/package.py

which implements some of these library and include checks. So
libxml2.py could probably be shortened.

I realize that this is a brief introduction. So if you have any
questions, please ask.

Cheers,
Walter Landry
wlandry_at_[hidden]

[1] http://sidl.bkbits.net:8080/BuildSystem

[2] MPC, which has been mentioned elsewhere, does not seem to do
    autodetection.


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk