|
Boost-Build : |
Subject: Re: [Boost-build] Updating a single object in a static lib, then creating a shared lib
From: Phillip Seaver (phil_at_[hidden])
Date: 2009-10-20 09:18:15
Jim Gallagher wrote:
> Hi,
>
> We are customizing a COTS product. One of the provided extension
> points is a shared library. The vendor provides an archive lib
> containing all the objects in the shared lib, but only a subset of the
> source code. We found we need to update the shared lib, and would like
> to do so within the context of our existing boost-build project, which
> we use to create builds on both win32 and hp-ux ia64.
>
> The vendor's basic instructions are:
> - extract objects from static lib
> - rebuild appropriate objects
> - link all objects into shared lib
>
> Here is what I think I need to do:
> - Create a notfile rule and corresponding action to extract the
> objects. How can I have them extracted to the correct build variant
> directory? E.g., bin/acc/Debug64
> - Create a lib rule that will use my .c file and the extracted objects
> as sources. How do I tell the rule to use the objects down in the
> correct build dir? E.g, bin/acc/Debug64/*.o
>
> Is there just a better way to this?
>
> Thanks,
> Jim
I haven't tried this particular case, but the make rule creates files in
the build tree. You should then be able to use those targets in your
lib rule. Something like this might work.
local objs = foo bar baz ;
local vendor_lib = vendor.dll ;
local old_objs ;
for local o in $(objs) {
make $(o) : $(vendor_lib) : @extract_obj ;
old_objs += $(o) ;
}
lib new_vendor : $(old_objs) my_new.c ;
actions extract_obj
{
lib /extract:$(>:B).obj /out:$(>).obj $(<)
}
This is msvc-specific code, but it shouldn't be hard to make it more
generic. Unfortunately, I don't recall how to get the full path to the
lib command out of the toolset, so this code will only work if you have
msvc in your path. I may figure that out later when I have more time.
Phillip
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