mirror of
https://git.yoctoproject.org/poky
synced 2026-04-04 23:02:22 +02:00
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>
25 lines
766 B
Plaintext
25 lines
766 B
Plaintext
SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
|
|
|
|
CHRPATH_BIN ?= "chrpath"
|
|
|
|
def rpath_replace (paths, d):
|
|
chrpath = bb.data.expand('${CHRPATH_BIN}', d)
|
|
|
|
for path in paths:
|
|
for root, dirs, files in os.walk(path):
|
|
for f in files:
|
|
if 'usr' in path:
|
|
os.system("%s -r $ORIGIN/../lib:$ORIGIN/../../lib %s/%s" % (chrpath, path,f))
|
|
else:
|
|
os.system("%s -r $ORIGIN/../lib %s/%s" % (chrpath, path, f))
|
|
|
|
python relocatable_binaries_preprocess() {
|
|
paths = []
|
|
target = bb.data.expand("${SYSROOT_DESTDIR}${TMPDIR}/sysroots/${TARGET_ARCH}-${TARGET_OS}", d)
|
|
|
|
paths.append(target + "/bin")
|
|
paths.append(target + "/usr/bin")
|
|
|
|
rpath_replace(paths, d)
|
|
}
|