summaryrefslogtreecommitdiff
path: root/meta/classes/relocatable.bbclass
blob: 582812c1cfd26ad2d41a1b5bb95a96b250907445 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
inherit chrpath

SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess relocatable_native_pcfiles"

python relocatable_binaries_preprocess() {
    rpath_replace(d.expand('${SYSROOT_DESTDIR}'), d)
}

relocatable_native_pcfiles () {
	if [ -d ${SYSROOT_DESTDIR}${libdir}/pkgconfig ]; then
		rel=${@os.path.relpath(d.getVar('base_prefix'), d.getVar('libdir') + "/pkgconfig")}
		sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" ${SYSROOT_DESTDIR}${libdir}/pkgconfig/*.pc
	fi
	if [ -d ${SYSROOT_DESTDIR}${datadir}/pkgconfig ]; then
		rel=${@os.path.relpath(d.getVar('base_prefix'), d.getVar('datadir') + "/pkgconfig")}
		sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" ${SYSROOT_DESTDIR}${datadir}/pkgconfig/*.pc
	fi
}