aboutsummaryrefslogtreecommitdiffstats
path: root/classes/relocatable.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/relocatable.bbclass')
-rw-r--r--classes/relocatable.bbclass21
1 files changed, 11 insertions, 10 deletions
diff --git a/classes/relocatable.bbclass b/classes/relocatable.bbclass
index eb5b9e62ed..2af3a7a1c4 100644
--- a/classes/relocatable.bbclass
+++ b/classes/relocatable.bbclass
@@ -55,27 +55,28 @@ def process_dir (directory, d):
# If the rpath shares a root with base_prefix determine a new dynamic rpath from the
# base_prefix shared root
if rpath.find(basedir) != -1:
- depth = fpath.partition(basedir)[2].count('/')
- libpath = rpath.partition(basedir)[2].strip()
+ fdir = os.path.dirname(fpath.partition(basedir)[2])
+ ldir = rpath.partition(basedir)[2].strip()
# otherwise (i.e. cross packages) determine a shared root based on the TMPDIR
# NOTE: This will not work reliably for cross packages, particularly in the case
# where your TMPDIR is a short path (i.e. /usr/poky) as chrpath cannot insert an
# rpath longer than that which is already set.
else:
- depth = fpath.rpartition(tmpdir)[2].count('/')
- libpath = rpath.partition(tmpdir)[2].strip()
+ fdir = os.path.dirname(fpath.rpartition(tmpdir)[2])
+ ldir = rpath.partition(tmpdir)[2].strip()
- base = "$ORIGIN"
- while depth > 1:
- base += "/.."
- depth-=1
- new_rpaths.append("%s%s" % (base, libpath))
+ try:
+ new_rpaths.append("$ORIGIN/%s" % oe.path.relative(fdir, ldir))
+ except ValueError:
+ # Some programs link in non-existant RPATH directories.
+ continue
# if we have modified some rpaths call chrpath to update the binary
if len(new_rpaths):
args = ":".join(new_rpaths)
#bb.note("Setting rpath for %s to %s" %(fpath,args))
- sub.call([cmd, '-r', args, fpath])
+ oe_system(d, [cmd, '-r', args, fpath], shell=False,
+ stdout=open("/dev/null", "a"))
if perms:
os.chmod(fpath, perms)