Boost logo

Boost-Build :

From: Chad Carr (ccarr_at_[hidden])
Date: 2006-06-13 16:02:26


> Chad Carr wrote:
>> I am attempting to build a pam module that works on OS X and cannot
>> figure out for the life of me how to get the -bundle option to link.dll
>> in the darwin toolset. Indeed, the -dynamiclib option appears to be
>> hardcoded in the toolset,
>
> You will need to modify the darwin toolset:

Thanks for the very detailed description. I have done the needful and
produced the attached patch. It is exactly as you said except that I
changed the feature values to true and false (defaulting to false) to
more closely match the core boost build features and the feature name to
<bundle> since it is likely that the Jamfile writer will end up writing
a line like this anyway:

lib foo : foo.c : <toolset>darwin:<bundle>true ;

Additionally, I did not make the feature propagated. A library that
uses -bundle seems to be the top of the chain, that is nothing else can
link to it using normal means. This is what happened when I used one
bundle elsewhere in the project in the sources list of my new bundle:

ld: libfoo.dylib is input for the dynamic link editor, is not
relocatable by the static link editor again

(libfoo.dylib is the input bundle, not the output bundle)

So it seems that propagating -bundle up the chain is not a good idea. I
guess that the library can only be dlopened? Needs more research.

But, I have some more questions.

I had assumed that I could get what I needed by modifying the darwin
toolset (I had pinpointed the problem quite a while ago). First
question: is it normal to need to override core toolset functionality?
After all, I am writing a piece of software for public release (probably
a few months from now) and planned to depend on boost build v2 for
distribution. With this minor exception, so far, it has proved to be a
vastly superior alternative to autotools. I am a happy camper.

Second question: if override is normal, then what is the recommended way
to distribute the changes? I.e. should I patch the user's darwin.jam in
my configure script, distribute a totally new file (both of these seem
horribly rude), embed the entire boost build system in my project (du
-sh shows 3.6 M, plus I am pretty sure that is not what is intended), or
somehow override the darwin.jam toolset with my own file? The last
option certainly seems like the best, but I cannot for the life of me
figure out how to create a file darwin.jam in my project that can be
found by the toolset.using rule instead of the default in the tools
directory. I have read quite a bit of documentation and cannot seem to
find instructions anywhere. No problem looking at source, mind you, but
I have done a bit of that as well to no avail.

Third question: if it is not normal, and the functionality should be
included in the base boost build system, I'd like to kindly submit the
patch attached for your review. I notice that the v1 system had similar
functionality (although much more complex; I can only assume that this
is a function of the much simpler v2 syntax).

Additionally, I need to answer the second question anyway to cover
distribution until such time as the patch becomes available in general
distribution.

Thanks in advance,
Chad


--- ../../sw/boost-build/tools/darwin.jam Fri Oct 29 06:45:35 2004
+++ darwin.jam Tue Jun 13 14:06:45 2006
@@ -35,6 +35,7 @@
 type.register-suffixes dylib : SHARED_LIB ;
 
 feature framework : : free ;
+feature bundle : false true ;
 
 flags darwin.compile OPTIONS <link>shared : -dynamic ;
 flags darwin.compile OPTIONS : -Wno-long-double -no-cpp-precomp ;
@@ -46,6 +47,9 @@
 # uncomment to see what libtool is doing under the hood
 # flags darwin.link.dll OPTIONS : -Wl,-v ;
 
+flags darwin.link.dll OPTIONS <bundle>false : -dynamiclib ;
+flags darwin.link.dll OPTIONS <bundle>true : -bundle ;
+
 actions link bind LIBRARIES
 {
     $(CONFIG_COMMAND) $(ST_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) -framework$(_)$(FRAMEWORK) $(OPTIONS)
@@ -58,7 +62,7 @@
 
 actions link.dll bind LIBRARIES
 {
- $(CONFIG_COMMAND) -dynamiclib -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) -framework$(_)$(FRAMEWORK) $(OPTIONS)
+ $(CONFIG_COMMAND) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) -framework$(_)$(FRAMEWORK) $(OPTIONS)
 }
 
 actions piecemeal archive


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