$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r74912 - trunk/tools/build/v2/tools
From: ghost_at_[hidden]
Date: 2011-10-11 04:22:47
Author: vladimir_prus
Date: 2011-10-11 04:22:45 EDT (Tue, 11 Oct 2011)
New Revision: 74912
URL: http://svn.boost.org/trac/boost/changeset/74912
Log:
Fix library_path.py in BoostBuild/Python.
Patch from Georgy Gritsenko.
Text files modified: 
   trunk/tools/build/v2/tools/builtin.py |    50 ++++++++++++++++++++------------------- 
   trunk/tools/build/v2/tools/stage.py   |     2                                         
   2 files changed, 27 insertions(+), 25 deletions(-)
Modified: trunk/tools/build/v2/tools/builtin.py
==============================================================================
--- trunk/tools/build/v2/tools/builtin.py	(original)
+++ trunk/tools/build/v2/tools/builtin.py	2011-10-11 04:22:45 EDT (Tue, 11 Oct 2011)
@@ -565,9 +565,8 @@
         generators.Generator.__init__ (self, id, composing, source_types, target_types_and_names, requirements)
         
     def run (self, project, name, prop_set, sources):
-       
-        lib_sources = prop_set.get('<library>')
-        sources.extend(lib_sources)
+
+        sources.extend(prop_set.get('<library>'))
         
         # Add <library-path> properties for all searched libraries
         extra = []
@@ -576,38 +575,41 @@
                 search = s.search()
                 extra.extend(property.Property('<library-path>', sp) for sp in search)
 
-        orig_xdll_path = []
-                   
-        if prop_set.get('<hardcode-dll-paths>') == ['true'] \
-               and type.is_derived(self.target_types_ [0], 'EXE'):
-            xdll_path = prop_set.get('<xdll-path>')
-            orig_xdll_path = [ replace_grist(x, '<dll-path>') for x in xdll_path ]
-            # It's possible that we have libraries in sources which did not came
-            # from 'lib' target. For example, libraries which are specified
-            # just as filenames as sources. We don't have xdll-path properties
-            # for such target, but still need to add proper dll-path properties.
-            for s in sources:
+        # It's possible that we have libraries in sources which did not came
+        # from 'lib' target. For example, libraries which are specified
+        # just as filenames as sources. We don't have xdll-path properties
+        # for such target, but still need to add proper dll-path properties.   
+        extra_xdll_path = []                            
+        for s in sources:
                 if type.is_derived (s.type (), 'SHARED_LIB') and not s.action ():
                     # Unfortunately, we don't have a good way to find the path
                     # to a file, so use this nasty approach.
                     p = s.project()
-                    location = path.root(s.name(), p.get('source-location'))
-                    xdll_path.append(path.parent(location))
-                          
-            extra.extend(property.Property('<dll-path>', sp) for sp in xdll_path)
+                    location = path.root(s.name(), p.get('source-location')[0])
+                    extra_xdll_path.append(os.path.dirname(location))
+
+        # Hardcode DLL paths only when linking executables.
+        # Pros: do not need to relink libraries when installing.
+        # Cons: "standalone" libraries (plugins, python extensions) can not
+        # hardcode paths to dependent libraries.            
+        if prop_set.get('<hardcode-dll-paths>') == ['true'] \
+              and type.is_derived(self.target_types_ [0], 'EXE'):
+                xdll_path = prop_set.get('<xdll-path>')
+                extra.extend(property.Property('<dll-path>', sp) \
+                     for sp in extra_xdll_path)
+                extra.extend(property.Property('<dll-path>', sp) \
+                     for sp in xdll_path)
         
         if extra:
-            prop_set = prop_set.add_raw (extra)
-                        
+            prop_set = prop_set.add_raw (extra)                
         result = generators.Generator.run(self, project, name, prop_set, sources)
-
+        
         if result:
             ur = self.extra_usage_requirements(result, prop_set)
-            ur = ur.add(property_set.create(orig_xdll_path))
+            ur = ur.add(property_set.create(['<xdll-path>' + p for p in extra_xdll_path]))
         else:
             return None
-        
-        return(ur, result)
+        return (ur, result)
     
     def extra_usage_requirements (self, created_targets, prop_set):
         
Modified: trunk/tools/build/v2/tools/stage.py
==============================================================================
--- trunk/tools/build/v2/tools/stage.py	(original)
+++ trunk/tools/build/v2/tools/stage.py	2011-10-11 04:22:45 EDT (Tue, 11 Oct 2011)
@@ -224,7 +224,7 @@
     return virtual_target.FileTarget(name, source.type(), project, a, exact=True)
 
 def relink_file(project, source, ps):
-    action = source.action()
+    action = source[0].action()
     cloned_action = virtual_target.clone_action(action, project, "", ps)
     targets = cloned_action.targets()
     # We relink only on Unix, where exe or shared lib is always a single file.