From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-03-19 09:46:08
since you've asked, I'm about to describe how library order to gcc can be
First of all, where this should be done. builtin.jam has link-action class,
and its 'adjust-properties' method gathers the list of all libraries. It's
ready on line 514 in CVS head and is stored in "libraries" variable.
I think at this point some rule must be called (e.g "order-libraries") which
will do the interesting things.
Second, how do you find the list of dependency libraries. If 'l' is
virtual-target object corresponding to a library (that's what is stored in
"libraries" variable above), then you can do:
local a = [ $(l).action ] ;
local p = [ $(a).properties-ps ] ;
local other-libraries =
[ feature.get-values <library> : [ $(p).raw ] ] ;
ECHO [ $(l).str ] " : depends on " $(other-libraries) ;
If you remove the girst (i.e. $(other-libraries:G=), you'll get the list of
virtual targets for other libraries that this one depend on.
Third, given this list of libraries, you can compute the right order. The
exact algorithm is not important, but something like topological sort might
be ok. You select a library without dependencies and put it in
the list of ordered libs. Then you remove this selected list from the
dependencies of other libs. And repeat process. When it stops, you
reverse the list of ordered libs and you've done.
Storing all those dependencies list can be done about like that (it's a bit
rule order-libraries ( libraries * )
for local l in $(libraries)
..deps.$(l) = [ get-dependencies $(l) ] ;
where 'get-dependences' is a new rule, which is to be added. The
'set.difference' rule can be used to remove elements from the list.
I hope this is sufficient information. If not, I can clarify further.
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