diff options
Diffstat (limited to 'meta/classes/relocatable.bbclass')
-rw-r--r-- | meta/classes/relocatable.bbclass | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/meta/classes/relocatable.bbclass b/meta/classes/relocatable.bbclass new file mode 100644 index 0000000000..81fe8c518d --- /dev/null +++ b/meta/classes/relocatable.bbclass | |||
@@ -0,0 +1,24 @@ | |||
1 | SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess" | ||
2 | |||
3 | CHRPATH_BIN ?= "chrpath" | ||
4 | |||
5 | def rpath_replace (paths, d): | ||
6 | chrpath = bb.data.expand('${CHRPATH_BIN}', d) | ||
7 | |||
8 | for path in paths: | ||
9 | for root, dirs, files in os.walk(path): | ||
10 | for f in files: | ||
11 | if 'usr' in path: | ||
12 | os.system("%s -r $ORIGIN/../lib:$ORIGIN/../../lib %s/%s" % (chrpath, path,f)) | ||
13 | else: | ||
14 | os.system("%s -r $ORIGIN/../lib %s/%s" % (chrpath, path, f)) | ||
15 | |||
16 | python relocatable_binaries_preprocess() { | ||
17 | paths = [] | ||
18 | target = bb.data.expand("${SYSROOT_DESTDIR}${TMPDIR}/sysroots/${TARGET_ARCH}-${TARGET_OS}", d) | ||
19 | |||
20 | paths.append(target + "/bin") | ||
21 | paths.append(target + "/usr/bin") | ||
22 | |||
23 | rpath_replace(paths, d) | ||
24 | } | ||