diff options
-rw-r--r-- | meta/classes/relocatable.bbclass | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/meta/classes/relocatable.bbclass b/meta/classes/relocatable.bbclass index ca36e5b263..25eb99ecff 100644 --- a/meta/classes/relocatable.bbclass +++ b/meta/classes/relocatable.bbclass | |||
@@ -3,27 +3,28 @@ SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess" | |||
3 | CHRPATH_BIN ?= "chrpath" | 3 | CHRPATH_BIN ?= "chrpath" |
4 | PREPROCESS_RELOCATE_DIRS ?= "" | 4 | PREPROCESS_RELOCATE_DIRS ?= "" |
5 | 5 | ||
6 | def rpath_replace (path, d): | 6 | def process_dir (directory, d): |
7 | import subprocess as sub | 7 | import subprocess as sub |
8 | 8 | ||
9 | cmd = bb.data.expand('${CHRPATH_BIN}', d) | 9 | cmd = bb.data.expand('${CHRPATH_BIN}', d) |
10 | |||
11 | bindirs = bb.data.expand("${bindir} ${sbindir} ${base_sbindir} ${base_bindir} ${libdir} ${base_libdir} ${PREPROCESS_RELOCATE_DIRS}", d).split() | ||
12 | tmpdir = bb.data.getVar('TMPDIR', d) | 10 | tmpdir = bb.data.getVar('TMPDIR', d) |
13 | basedir = bb.data.expand('${base_prefix}', d) | 11 | basedir = bb.data.expand('${base_prefix}', d) |
14 | 12 | ||
15 | for d in bindirs: | 13 | bb.debug("Checking %s for binaries to process" % directory) |
16 | dir = path + "/" + d | 14 | if not os.path.exists(directory): |
17 | bb.debug("Checking %s for binaries to process" % dir) | 15 | return |
18 | if not os.path.exists(dir): | 16 | |
19 | continue | 17 | dirs = os.listdir(directory) |
20 | for file in os.listdir(dir): | 18 | for file in dirs: |
21 | fpath = dir + "/" + file | 19 | fpath = directory + "/" + file |
22 | if os.path.islink(fpath): | 20 | if os.path.islink(fpath): |
23 | fpath = os.readlink(fpath) | 21 | fpath = os.readlink(fpath) |
24 | if not os.path.isabs(fpath): | 22 | if not os.path.isabs(fpath): |
25 | fpath = os.path.normpath(os.path.join(dir, fpath)) | 23 | fpath = os.path.normpath(os.path.join(directory, fpath)) |
26 | 24 | ||
25 | if os.path.isdir(fpath): | ||
26 | process_dir(fpath, d) | ||
27 | else: | ||
27 | #bb.note("Testing %s for relocatability" % fpath) | 28 | #bb.note("Testing %s for relocatability" % fpath) |
28 | p = sub.Popen([cmd, '-l', fpath],stdout=sub.PIPE,stderr=sub.PIPE) | 29 | p = sub.Popen([cmd, '-l', fpath],stdout=sub.PIPE,stderr=sub.PIPE) |
29 | err, out = p.communicate() | 30 | err, out = p.communicate() |
@@ -65,6 +66,14 @@ def rpath_replace (path, d): | |||
65 | #bb.note("Setting rpath to " + args) | 66 | #bb.note("Setting rpath to " + args) |
66 | sub.call([cmd, '-r', args, fpath]) | 67 | sub.call([cmd, '-r', args, fpath]) |
67 | 68 | ||
69 | def rpath_replace (path, d): | ||
70 | bindirs = bb.data.expand("${bindir} ${sbindir} ${base_sbindir} ${base_bindir} ${libdir} ${base_libdir} ${PREPROCESS_RELOCATE_DIRS}", d).split() | ||
71 | |||
72 | for bindir in bindirs: | ||
73 | bb.note ("Processing directory " + bindir) | ||
74 | directory = path + "/" + bindir | ||
75 | process_dir (directory, d) | ||
76 | |||
68 | python relocatable_binaries_preprocess() { | 77 | python relocatable_binaries_preprocess() { |
69 | rpath_replace(bb.data.expand('${SYSROOT_DESTDIR}', d), d) | 78 | rpath_replace(bb.data.expand('${SYSROOT_DESTDIR}', d), d) |
70 | } | 79 | } |