Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-10-15 02:40:47


Hi Peter,

> Does that mean, that for BBv2 Vladimir is the man to ask?
>
> From superficially looking at the sources I guess I'd have to do
> something like:
> - declaring a type (where?) like it is done in builtin.jam
> - write a rule like register-c-compiler (where?)
> - write a rule (and register it) that strips my executables (in my
> toolset-file?)
>
> Am I on the right track?

Almost. The first caveat is that you don't need to write a rule like
register-c-compiler. If you want to add new transformation, you have to
declare new generator. The 'register-c-compiler' is just a convenience
wrapper which declares new generator with some predefined properties.

The process of declaring a new generator is documented at

http://boost.sourceforge.net/boost-build2/doc/extending.html

and it fact, stripping a binary is a simple transformation, so the process is
just as described. I attach a working example.

How for the second caveat. The Jamfile looks like:

exe a : a.cpp ;
stripped-exe stripped_a : a ;

As you see, the name of stripped executable is different. That's because V2
assumes that a single Jamfile cannot generate two targets with the same
filename and the same properties --- naturally, it's not clear where to put
them.
Rene, could you tell how this problem is solved in V1? Will stripped "a" end
in "bin/stipped_a/.....". And won't the code that you've posted create
executable with name "stripped_a"?

There's another solution for your problem: make the feature that determines if
the target is stripped or not.

First, the feature:

feature.feature strip : off on : composite ;
feature.compose <strip>on : <linkflags>-s ;

This will cause Boost.Build to pass "-s" flag for linker if <strip> if "on" --
that flag causes gcc to strip the binary.

Next, the main target:

exe a : a.cpp : : : <strip>off <strip>on ;

This will cause Boost.Build to build "a" both with <strip>off and <strip>on,
unless specific value of <strip> is explicitly requested.

I attach the working example of this as well. It would be interesting to know
this approach you find better.

I actually have a third variant which works just like first, only places
stripped "a" to a different location, without changing the name. I uses a
kluge in one place, however, so I'd prefer some discussion about the right
way.

- Volodya
 --Boundary-00=_/nPj/DyeYifvhS4 Content-Type: application/x-tbz;
name="strip.tar.bz2"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="strip.tar.bz2"

[Attachment content not displayed.] --Boundary-00=_/nPj/DyeYifvhS4 Content-Type: application/x-tbz;
name="strip2.tar.bz2"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="strip2.tar.bz2"

[Attachment content not displayed.] --Boundary-00=_/nPj/DyeYifvhS4--


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