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