[OE-core] [PATCH v2] pkg-config-native: allow kernel to be build with esdk

Saul Wold sgw at linux.intel.com
Sat Jun 24 00:24:12 UTC 2017


When the kernel's menuconfig target is called while using the esdk or an
esdk-based container, the pkg-config info that is found is not correct.
The pkg-config info is for the target, but we need the eSDK's information
in order to build the host based menuconfig.

The new pkg-config-native script checks both that it's in SDK and being
called from the check-lxdialog script in order to limit the scope of when
the pkg-config automagically switches to pkg-config-native.

[YOCTO #11155]

Signed-off-by: Saul Wold <sgw at linux.intel.com>
---
 .../pkgconfig/pkgconfig/pkg-config-native.in       | 25 ++++++++++++++++++----
 meta/recipes-devtools/pkgconfig/pkgconfig_git.bb   | 10 +++++----
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in
index 5e44bb4..26da5b6 100644
--- a/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in
+++ b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in
@@ -1,7 +1,24 @@
 #! /bin/sh
 
-PKG_CONFIG_PATH="@PATH_NATIVE@"
-PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@"
-unset PKG_CONFIG_SYSROOT_DIR
+# Orignal pkg-config-native action when called as pkg-config-native
+# NO Change here
+if [ "pkg-config-native" = "`basename $0`" ] ; then
+	PKG_CONFIG_PATH="@PATH_NATIVE@"
+	PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@"
+	unset PKG_CONFIG_SYSROOT_DIR
+else
+	# in this case we are in the esdk
+	if [ "$OE_SKIP_SDK_CHECK" = "1" ] ; then
+		parentpid=`ps -o ppid= -p $$`
+		parentpid_info=`ps -wo comm= -o args= -p $parentpid`
 
-pkg-config "$@"
+		# check if we are being called from  the kernel's make menuconfig
+		if ( echo $parentpid_info | grep -q check-lxdialog ) ; then
+			PKG_CONFIG_PATH="@PATH_NATIVE@"
+			PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@"
+			unset PKG_CONFIG_SYSROOT_DIR
+		fi
+	fi
+fi
+
+pkg-config.real "$@"
diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
index e634021..37f1f74 100644
--- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
+++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
@@ -50,8 +50,10 @@ RPROVIDES_${PN} += "pkgconfig(pkg-config)"
 # Install a pkg-config-native wrapper that will use the native sysroot instead
 # of the MACHINE sysroot, for using pkg-config when building native tools.
 do_install_append_class-native () {
-    sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
-        -e "s|@LIBDIR_NATIVE@|${PKG_CONFIG_LIBDIR}|" \
-        < ${WORKDIR}/pkg-config-native.in > ${B}/pkg-config-native
-    install -m755 ${B}/pkg-config-native ${D}${bindir}/pkg-config-native
+	mv ${D}${bindir}/pkg-config ${D}${bindir}/pkg-config.real
+	sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
+		-e "s|@LIBDIR_NATIVE@|${PKG_CONFIG_LIBDIR}|" \
+		< ${WORKDIR}/pkg-config-native.in > ${B}/pkg-config-native
+	install -m755 ${B}/pkg-config-native ${D}${bindir}/pkg-config-native
+	ln -s pkg-config-native ${D}${bindir}/pkg-config
 }
-- 
2.7.5




More information about the Openembedded-core mailing list