Boost logo

Boost :

Subject: [boost] [BCP] Script for global renaming Boost Namespace
From: Artyom (artyomtnk_at_[hidden])
Date: 2009-05-25 04:14:59


Hello,

Today Boost does not provide any backward binary compatibility. This
makes big problems in shipping 3rd part libraries that depend on Boost
because library user must use the same version of Boost as that 3rd
part library was compiled with.

The problem is become even more critical for ELF platforms (UNIXes)
where all symbols are exported by default.

I had written a small Python script that switches boost namespace
to other, allowing 3rd part project include it without collisions
with primary Boost namespace.

The script passes over the source tree of boost and changes each
include path from <boost/foo/bar.hpp> too <newnamespace/foo/bar.hpp>
and renames all macros and identifiers from some_BOOST_something to
some_NEWNAMESPACE_something and some_boost_something to
some_newnamespace_something.

It does not touch comments (copyright) and strings unless the string
is in form "boost/.*" which is usually some reference for include.

I've run this script on the 1.39 version of boost and
successfully build full boost release and run some of regression tests
like Boost.Asio, Boost.Regex, Boost.Function and others,

The source code is available at:
http://art-blog.no-ip.info/files/rename.py

You run it as:

   ./rename /path/to/boost/source new_namespace_name

It renames all macros and namespaces to new namespace, and renames
main include directory to new_namespace_na,e.

Few points:

1. It is only alpha version script, I just want to see feedback and
   proposals
2. I do not update build scripts. I assume that each library that
   tryes to import its own version of Boost would provide its own
   build system.
3. The build scripts should be updated differently because they have
   different syntax and grammar. The required changes are to
   fix different build defines

Please, give feedback proposal. If there someone who is familiar
with Boost.Build systems can actually help, this would be very good.

Today there is a big problem with working with different versions of
Boost. It should be solved.

I think this script may be a valuable addition to Boost.BCP utility
that allows extracting a subset of boost for integration in 3rd part
tools and libraries.

Thanks,
  Artyom

      


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk