blob: d0a623fb0a98ecacf4f84a473d1bcfbdd5fe49b3 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007inherit chrpath
8
Brad Bishop6e60e8b2018-02-01 10:27:11 -05009SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess relocatable_native_pcfiles"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010
11python relocatable_binaries_preprocess() {
12 rpath_replace(d.expand('${SYSROOT_DESTDIR}'), d)
13}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050014
Andrew Geisslerd25ed322020-06-27 00:28:28 -050015relocatable_native_pcfiles() {
16 for dir in ${libdir}/pkgconfig ${datadir}/pkgconfig; do
17 files_template=${SYSROOT_DESTDIR}$dir/*.pc
18 # Expand to any files matching $files_template
19 files=$(echo $files_template)
20 # $files_template and $files will differ if any files were found
21 if [ "$files_template" != "$files" ]; then
22 rel=$(realpath -m --relative-to=$dir ${base_prefix})
23 sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" $files
24 fi
25 done
Brad Bishop6e60e8b2018-02-01 10:27:11 -050026}