build: use the waf patterns for RPATH
authorAndrew Tridgell <tridge@samba.org>
Mon, 3 May 2010 14:37:33 +0000 (16:37 +0200)
committerAndrew Tridgell <tridge@samba.org>
Mon, 3 May 2010 15:16:48 +0000 (17:16 +0200)
Use the self.env.RPATH variable to set the RPATH for each target. This
gives consistent ordering of the link command, ensuring that we don't
get rebuilds if we ask for a --targets= build after a normal build.

This also means we are now using the RPATH_ST pattern, which means we
can potentially support compilers that don't use -Wl,xxx as the
command line for rpath support

buildtools/wafsamba/samba_install.py
buildtools/wafsamba/samba_utils.py

index 55aab26a503fa7e2953223958a80eb19ad17089d..9030c19c142d73b4ce9b0a6ddcb42a4569fd4fac 100644 (file)
@@ -11,7 +11,7 @@ O755 = 493
 
 @feature('install_bin')
 @after('apply_core')
-@before('apply_link')
+@before('apply_link', 'apply_obj_vars')
 def install_binary(self):
     '''install a binary, taking account of the different rpath varients'''
     bld = self.bld
@@ -22,7 +22,7 @@ def install_binary(self):
 
     if not Options.is_install or not self.samba_install:
         # just need to set rpath if we are not installing
-        self.env.append_value('LINKFLAGS', build_ldflags)
+        self.env.RPATH = build_ldflags
         return
 
     # work out the install path, expanding variables
@@ -38,7 +38,7 @@ def install_binary(self):
         self.target += '.inst'
 
     # setup the right rpath link flags for the install
-    self.env.append_value('LINKFLAGS', install_ldflags)
+    self.env.RPATH = install_ldflags
 
     # tell waf to install the right binary
     bld.install_as(os.path.join(install_path, orig_target),
@@ -49,7 +49,7 @@ def install_binary(self):
 
 @feature('install_lib')
 @after('apply_core')
-@before('apply_link')
+@before('apply_link', 'apply_obj_vars')
 def install_library(self):
     '''install a library, taking account of the different rpath varients'''
     if getattr(self, 'done_install_library', False):
@@ -62,7 +62,7 @@ def install_library(self):
 
     if not Options.is_install or not self.samba_install:
         # just need to set the build rpath if we are not installing
-        self.env.append_value('LINKFLAGS', build_ldflags)
+        self.env.RPATH = build_ldflags
         return
 
     # setup the install path, expanding variables
@@ -76,11 +76,11 @@ def install_library(self):
         self.done_install_library = True
         t = self.clone('default')
         t.target += '.inst'
-        self.env.append_value('LINKFLAGS', build_ldflags)
+        self.env.RPATH = build_ldflags
     else:
         t = self
 
-    t.env.append_value('LINKFLAGS', install_ldflags)
+    t.env.RPATH = install_ldflags
 
     dev_link     = None
 
index b989f912523bcd9bcb4577406abcf59f4dc6cd5f..335313e5dc6b1356a0c8710e4e10cee088769b39 100644 (file)
@@ -64,9 +64,8 @@ def ADD_LD_LIBRARY_PATH(path):
 def install_rpath(bld):
     '''the rpath value for installation'''
     bld.env['RPATH'] = []
-    bld.env['RPATH_ST'] = []
     if bld.env.RPATH_ON_INSTALL:
-        return ['-Wl,-rpath=%s/lib' % bld.env.PREFIX]
+        return ['%s/lib' % bld.env.PREFIX]
     return []
 
 
@@ -74,9 +73,8 @@ def build_rpath(bld):
     '''the rpath value for build'''
     rpath = os.path.normpath('%s/%s' % (bld.env.BUILD_DIRECTORY, LIB_PATH))
     bld.env['RPATH'] = []
-    bld.env['RPATH_ST'] = []
     if bld.env.RPATH_ON_BUILD:
-        return ['-Wl,-rpath=%s' % rpath]
+        return [rpath]
     ADD_LD_LIBRARY_PATH(rpath)
     return []