relocatable.bbclass 661 B

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