[OE-core] [PATCH 2/3] pkgconfig.bblcass: remove PKG_CONFIG_SYSROOT_DIR from installed .pc files

Enrico Scholz enrico.scholz at sigma-chemnitz.de
Thu Dec 18 11:04:22 UTC 2014


Having ${PKG_CONFIG_SYSROOT_DIR} in installed .pc files is nearly
everytime an error because it next 'pkgconfig' call will prepend
${PKG_CONFIG_SYSROOT_DIR} environment variable again resulting into a
duplication and invalidation of paths.

Patch removes this string from installed .pc files.

Signed-off-by: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
---
 meta/classes/pkgconfig.bbclass | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/meta/classes/pkgconfig.bbclass b/meta/classes/pkgconfig.bbclass
index ad1f84f..459a871 100644
--- a/meta/classes/pkgconfig.bbclass
+++ b/meta/classes/pkgconfig.bbclass
@@ -1,2 +1,19 @@
 DEPENDS_prepend = "pkgconfig-native "
 
+PKGCONFIG_FILE_PATTERN ?= "-path '*/pkgconfig/*' -name '*.pc' -type f"
+PKGCONFIG_FILE_PATTERN[doc] = "Options given to the 'find' utility to \
+ iterate over pkgconfig files"
+
+pkgconfig_mangle_pc() {
+    if test -n '${PKG_CONFIG_SYSROOT_DIR}'; then
+	# find .pc files, check and give out whether they contain
+	# the sysroot dir and remove this string
+	find '${D}' ${PKGCONFIG_FILE_PATTERN} \
+	     -exec grep '${PKG_CONFIG_SYSROOT_DIR}' '{}' \; \
+	     -printf "NOTE: removing PKG_CONFIG_SYSROOT_DIR from %P\n" \
+	     -exec sed -i \
+	               -e 's!${PKG_CONFIG_SYSROOT_DIR}!!g' \
+	           '{}' \;
+    fi
+}
+do_install[postfuncs] += "pkgconfig_mangle_pc"
-- 
1.9.3




More information about the Openembedded-core mailing list