summaryrefslogtreecommitdiffstats
path: root/meta/classes/relocatable.bbclass
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2010-02-11 16:11:01 +0000
committerJoshua Lock <josh@linux.intel.com>2010-02-11 16:21:09 +0000
commit6e1cc7ca104b78ebb34a15eb4a41e33c7186d2fd (patch)
tree0f47b358ce2f5e26c43777c79409274eeb218a17 /meta/classes/relocatable.bbclass
parenta0795895e317fddb212dc531e2ac8943f433c562 (diff)
downloadpoky-6e1cc7ca104b78ebb34a15eb4a41e33c7186d2fd.tar.gz
relocatable.bbclass: remove hard-coded rpaths from native binaries
The relocatable path will pre-process built binaries in SYSROOT_DESTDIR and replace any harcoded dynamic link rpaths with relative paths. Add an inherit of class in native.bbclass to make our native packages relocatable and tweak the chrpath recipe so that the native package can make itself relocatable with the just built chrpath binary. Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'meta/classes/relocatable.bbclass')
-rw-r--r--meta/classes/relocatable.bbclass24
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 @@
1SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
2
3CHRPATH_BIN ?= "chrpath"
4
5def 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
16python 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}