build: finer grained rpath checking for binary/install
authorAndrew Tridgell <tridge@samba.org>
Tue, 23 Mar 2010 14:00:48 +0000 (10:00 -0400)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:27:01 +0000 (20:27 +1000)
buildtools/wafsamba/samba_utils.py
buildtools/wafsamba/wafsamba.py
lib/replace/wscript

index 564b5b82e319d9620d9e6afdd20a859d002582f1..8bd913f7202f90cabe4cdf12f2435b0b590f7c0e 100644 (file)
@@ -59,23 +59,26 @@ def runonce(function):
     return wrapper
 
 
-
-def set_rpath(bld):
-    '''setup the default rpath'''
-    if bld.env.RPATH_ON_BUILD:
-        rpath = os.path.normpath('%s/%s' % (bld.env['BUILD_DIRECTORY'], LIB_PATH))
-        bld.env.append_value('RPATH', '-Wl,-rpath=%s' % rpath)
-    else:
-        os.environ['LD_LIBRARY_PATH'] = os.path.normpath('%s/../shared' % bld.srcnode.abspath(bld.env))
-Build.BuildContext.set_rpath = set_rpath
-
 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 []
 
 
+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]
+    os.environ['LD_LIBRARY_PATH'] = rpath
+    return []
+
+
 #############################################################
 # return a named build cache dictionary, used to store
 # state inside the following functions
index 8a37edfb885924f9aa3c3eb6b2340f0ae14685f4..90006e46cfba46b44e352d2a9cbd9b7fba3cfcad 100644 (file)
@@ -121,7 +121,8 @@ def SAMBA_LIBRARY(bld, libname, source,
         samba_includes  = includes,
         local_include   = local_include,
         vnum            = vnum,
-        install_path    = None
+        install_path    = None,
+        ldflags         = build_rpath(bld)
         )
 
     if install_path is None:
@@ -151,8 +152,8 @@ def SAMBA_LIBRARY(bld, libname, source,
             vnum            = vnum,
             install_as     = libname,
             install_path    = None,
+            ldflags         = install_rpath(bld)
             )
-        t.env['RPATH'] = install_rpath(bld)
 
     if install:
         if vnum:
@@ -235,7 +236,8 @@ def SAMBA_BINARY(bld, binname, source,
         samba_modules  = modules,
         top            = True,
         samba_subsystem= subsystem_name,
-        install_path   = None
+        install_path   = None,
+        ldflags        = build_rpath(bld)
         )
 
     if install_path is None:
@@ -264,9 +266,9 @@ def SAMBA_BINARY(bld, binname, source,
             samba_modules  = modules,
             top            = True,
             samba_subsystem= subsystem_name,
-            install_path   = None
+            install_path   = None,
+            ldflags        = install_rpath(bld)
             )
-        t.env['RPATH'] = install_rpath(bld)
 
     if install:
         bld.install_as(os.path.join(install_path, binname),
index 39e75c06c7a72f4e1ba4bdf4a0e64da824508a07..d8d690f5e14ef0f550e004f73de656c58da1f31a 100644 (file)
@@ -374,8 +374,6 @@ def configure(conf):
 
 
 def build(bld):
-    bld.set_rpath()
-
     # libreplace needs to put the library in the right build groups
     # as libreplace is a base library for everything, even for our
     # compilers, we need libreplace to build very early