xref: /OK3568_Linux_fs/yocto/poky/meta/classes/relocatable.bbclass (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1inherit chrpath
2
3SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess relocatable_native_pcfiles"
4
5python relocatable_binaries_preprocess() {
6    rpath_replace(d.expand('${SYSROOT_DESTDIR}'), d)
7}
8
9relocatable_native_pcfiles() {
10	for dir in ${libdir}/pkgconfig ${datadir}/pkgconfig; do
11		files_template=${SYSROOT_DESTDIR}$dir/*.pc
12		# Expand to any files matching $files_template
13		files=$(echo $files_template)
14		# $files_template and $files will differ if any files were found
15		if [ "$files_template" != "$files" ]; then
16			rel=$(realpath -m --relative-to=$dir ${base_prefix})
17			sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" $files
18		fi
19	done
20}
21