Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-04-25 08:38:20


On Tuesday 25 April 2006 01:41, Walter Landry wrote:
> Greetings,

Hi Walter,

> 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.

What are those 'framework.require' lines, what do they do?

> 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/libx
>ml2.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.

I'm concerned about the complexity of the code:

Take a look at this:

  if self.framework.argDB.has_key('with-libxml2-include'):
      if not os.path.isdir(self.framework.argDB['with-libxml2-include']):
        raise RuntimeError('Invalid libxml2 include directory specified by
--with-libxml2-include='+os.path.abspath(self.framework.argDB['with-libxml2-include']))
      includeDir = self.framework.argDB['with-libxml2-include']
      foundInclude = 1
    else:
      testInclude = 'libxml/tree.h'

      if self.checkPreprocess('#include <'+testInclude+'>\n'):
        foundInclude = 1
      # Check standard paths
      if not foundInclude:
        for dir in includeDirs:
          if os.path.isfile(os.path.join(dir, testInclude)):
            foundInclude = 1
            includeDir = dir

This code basically tries to find includes directory that contains some
header. Should not this be as simple as:

  path = find_header('libxml/tree.h', list_of_possible_paths,
                     "with-libxml2-include")

?

Likewise, checking for library 'xml2' containing function 'xmlCleanupParser'
should be a one-liner. I believe it's one liner in autoconf.

I guess my primary concerns are those:

1. The code size is large, and I don't see what's the point of this
complexity. Basically, we need to be able to run an application and catch
it's error status. On top of that, we need to run compiler, and linker,
and on top of that we need to find location of some library. I would say this
can be done in 500 lines of straight-forward code. There certainly some
reason for extra complexity, but I can't see it. Can you explain?

2. Is it possible to run configuration checks only if something changed in the
check or in the environment?

- Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2

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