From 6d1e8c58350803f2c380a332c13edc4528faa417 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 3 May 2010 16:37:33 +0200 Subject: build: use the waf patterns for RPATH 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 | 14 +++++++------- buildtools/wafsamba/samba_utils.py | 6 ++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/buildtools/wafsamba/samba_install.py b/buildtools/wafsamba/samba_install.py index 55aab26a50..9030c19c14 100644 --- a/buildtools/wafsamba/samba_install.py +++ b/buildtools/wafsamba/samba_install.py @@ -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 diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py index b989f91252..335313e5dc 100644 --- a/buildtools/wafsamba/samba_utils.py +++ b/buildtools/wafsamba/samba_utils.py @@ -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 [] -- cgit