relocatable.bbclass 737 B

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