Boost logo

Boost-Build :

Subject: [Boost-build] Bundles (plugins) and rpath install
From: J. van der Wulp (jwulp_at_[hidden])
Date: 2008-10-21 08:28:52


Hello everyone,

I have compiled a small patch (against trunk) for darwin.jam to allow:
 - building of bundles (uses -bundle option instead of -dynamiclib)
 - rpath installation

The bundle part introduces a feature bundle that is used to choose
between the -bundle and -dynamiclib options. The bundle feature may not
be the most optimal way of doing this.

The RPATH installation with the trunk version did not work as I would
expect from doing the same thing on different platforms e.g. Linux. The
problem is that apple's linker does not offer RPATH support. My
libraries are installed in non-standard locations so at runtime they are
not found unless library search path information is available. I'm not
sure of the details but the darwin linker seems to inspect the install
name of libraries and copies this name inside everything that links
against those libraries.

The install name of a library (-install_name linker option) is the only
way I could find to embed the full path into the library. The patch adds
prepends $(RPATH[1])/ to the argument of -install_name (used to be just
$(<:B)$(<:S)).

The patch is actually the set of changes currently needed to be able to
use Boost Build v2 to build our toolset. Can these changes in one way or
another be incorporated into Boost Build v2? Should it be necessary, I
can help testing.

Thanks,

Jeroen

Index: tools/build/v2/tools/darwin.jam
===================================================================
--- tools/build/v2/tools/darwin.jam (revision 49401)
+++ tools/build/v2/tools/darwin.jam (working copy)
@@ -19,6 +19,7 @@
 
 ## Use a framework.
 feature framework : : free ;
+feature bundle : no yes : incidental ;
 
 ## The MacOSX versions we can target.
 .macosx-versions =
@@ -323,6 +324,9 @@
 # Add the framework names to use.
 flags darwin.link FRAMEWORK <framework> ;
 
+flags darwin.link.dll BUNDLE <bundle>no : -dynamiclib ;
+flags darwin.link.dll BUNDLE <bundle>yes : -bundle ;
+
 # This is flag is useful for debugging the link step
 # uncomment to see what libtool is doing under the hood
 #~ flags darwin.link.dll OPTIONS : -Wl,-v ;
@@ -367,7 +371,7 @@
 
 actions link.dll bind LIBRARIES
 {
- "$(CONFIG_COMMAND)" -dynamiclib -Wl,-single_module -install_name "$(<:B)$(<:S)" -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(FRAMEWORK_PATH) -framework$(_)$(FRAMEWORK:D=:S=) $(OPTIONS) $(USER_OPTIONS)
+ "$(CONFIG_COMMAND)" $(BUNDLE) -Wl,-single_module -install_name"$(RPATH[1])/$(<:B)$(<:S)" -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(FRAMEWORK_PATH) -framework$(_)$(FRAMEWORK:D=:S=) $(OPTIONS) $(USER_OPTIONS)
 }
 
 # We use libtool instead of ar to support universal binary linking


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