]> code.ossystems Code Review - openembedded-core.git/commitdiff
relocatable: Make native .pc files relocatable
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 30 Jan 2017 23:08:38 +0000 (23:08 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 31 Jan 2017 23:47:27 +0000 (23:47 +0000)
The native .pc files currently have hardcoded paths in them meaning each has
to be relocated at final install time. pkg-config has built in functionality
to avoid this, namely the pcfiledir variable.

This function translates .pc files to use the variable meaning further
relocation later is unnecessary.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/relocatable.bbclass

index 4ca9981f44de2fac747398d6a87a5486a6613d58..582812c1cfd26ad2d41a1b5bb95a96b250907445 100644 (file)
@@ -1,7 +1,18 @@
 inherit chrpath
 
-SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess"
+SYSROOT_PREPROCESS_FUNCS += "relocatable_binaries_preprocess relocatable_native_pcfiles"
 
 python relocatable_binaries_preprocess() {
     rpath_replace(d.expand('${SYSROOT_DESTDIR}'), d)
 }
+
+relocatable_native_pcfiles () {
+       if [ -d ${SYSROOT_DESTDIR}${libdir}/pkgconfig ]; then
+               rel=${@os.path.relpath(d.getVar('base_prefix'), d.getVar('libdir') + "/pkgconfig")}
+               sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" ${SYSROOT_DESTDIR}${libdir}/pkgconfig/*.pc
+       fi
+       if [ -d ${SYSROOT_DESTDIR}${datadir}/pkgconfig ]; then
+               rel=${@os.path.relpath(d.getVar('base_prefix'), d.getVar('datadir') + "/pkgconfig")}
+               sed -i -e "s:${base_prefix}:\${pcfiledir}/$rel:g" ${SYSROOT_DESTDIR}${datadir}/pkgconfig/*.pc
+       fi
+}