summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/native.bbclass3
-rw-r--r--meta/classes/relocatable.bbclass24
-rw-r--r--meta/packages/chrpath/chrpath_0.13.bb5
3 files changed, 32 insertions, 0 deletions
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
index 01f886294e..9d678fd802 100644
--- a/meta/classes/native.bbclass
+++ b/meta/classes/native.bbclass
@@ -1,3 +1,6 @@
1# We want native packages to be relocatable
2inherit relocatable
3
1# Native packages are built indirectly via dependency, 4# Native packages are built indirectly via dependency,
2# no need for them to be a direct target of 'world' 5# no need for them to be a direct target of 'world'
3EXCLUDE_FROM_WORLD = "1" 6EXCLUDE_FROM_WORLD = "1"
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}
diff --git a/meta/packages/chrpath/chrpath_0.13.bb b/meta/packages/chrpath/chrpath_0.13.bb
index e843de6872..012897d575 100644
--- a/meta/packages/chrpath/chrpath_0.13.bb
+++ b/meta/packages/chrpath/chrpath_0.13.bb
@@ -2,6 +2,7 @@ DESCRIPTION = "chrpath allows you to change the rpath (where the application \
2looks for libraries) in an application. It does not (yet) allow you to add an \ 2looks for libraries) in an application. It does not (yet) allow you to add an \
3rpath if there isn't one already." 3rpath if there isn't one already."
4LICENSE = "GPL" 4LICENSE = "GPL"
5PR = "r1"
5 6
6SRC_URI = "${DEBIAN_MIRROR}/main/c/chrpath/chrpath_${PV}.orig.tar.gz" 7SRC_URI = "${DEBIAN_MIRROR}/main/c/chrpath/chrpath_${PV}.orig.tar.gz"
7 8
@@ -9,4 +10,8 @@ inherit autotools
9 10
10S = "${WORKDIR}/chrpath-${PV}" 11S = "${WORKDIR}/chrpath-${PV}"
11 12
13# We don't have a staged chrpath-native for ensuring our binary is relocatable
14# so must use the one we've just built
15CHRPATH_BIN = "${S}/chrpath"
16
12BBCLASSEXTEND = "native" 17BBCLASSEXTEND = "native"