Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | inherit chrpath |
| 8 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess relocatable_native_pcfiles" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 10 | |
| 11 | python relocatable_binaries_preprocess() { |
| 12 | rpath_replace(d.expand('${SYSROOT_DESTDIR}'), d) |
| 13 | } |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 14 | |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 15 | relocatable_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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | } |