Skip to contentSkip to conversation

pkg-config-native: allow kernel to be build with esdk

PATCH Superseded Saul Wold 2 participants 2 messages Jun 27, 2017 – Jul 9, 2017

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Saul Wold

author
#0 lore raw

PATCH v3 1/1 pkg-config-native: allow kernel to be build with esdk

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.

The pkg-config-esdk is only installed as pkg-config inside the eSDK, which is why we use the sstate post install script and check for if we are in the esdk environment.

Added an SDK_ARCH conversion to handle older 32bit installs since I now use the ARCH based name for pkg-config

[YOCTO #11155]

---
 .../pkgconfig/pkgconfig/pkg-config-esdk.in         | 24 ++++++++++++++++++++++
 .../pkgconfig/pkgconfig/pkg-config-native.in       |  2 +-
 meta/recipes-devtools/pkgconfig/pkgconfig_git.bb   | 17 +++++++++++++++
 3 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-esdk.in
meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-esdk.in new file +24 -0
new file mode 100644
index 0000000..948cc7a
@@ -0,0 +1,24 @@
+#! /bin/sh
+
+# 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`
+
+		# 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
+
+@SDK_ARCH@-pc-linux-gnu-pkg-config "$@"
meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in +1 -1
index 5e44bb4..3490d24 100644
@@ -4,4 +4,4 @@ PKG_CONFIG_PATH="@PATH_NATIVE@"
 PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@"
 unset PKG_CONFIG_SYSROOT_DIR
 
-pkg-config "$@"
+@SDK_ARCH@-pc-linux-gnu-pkg-config "$@"
meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +17 -0
index e634021..980c613 100644
@@ -12,6 +12,7 @@ SRCREV = "edf8e6f0ea77ede073f07bff0d2ae1fc7a38103b"
 PV = "0.29.2+git${SRCPV}"
 
 SRC_URI = "git://anongit.freedesktop.org/pkg-config \
+           file://pkg-config-esdk.in \
            file://pkg-config-native.in \
            file://fix-glib-configure-libtool-usage.patch \
            file://0001-glib-gettext.m4-Update-AM_GLIB_GNU_GETTEXT-to-match-.patch \
@@ -52,6 +53,22 @@ RPROVIDES_${PN} += "pkgconfig(pkg-config)"
 do_install_append_class-native () {
     sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
         -e "s|@LIBDIR_NATIVE@|${PKG_CONFIG_LIBDIR}|" \
+        -e "s|@SDK_ARCH@|${SDK_ARCH}|" \
         < ${WORKDIR}/pkg-config-native.in > ${B}/pkg-config-native
     install -m755 ${B}/pkg-config-native ${D}${bindir}/pkg-config-native
+    sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
+        -e "s|@LIBDIR_NATIVE@|${PKG_CONFIG_LIBDIR}|" \
+        -e "s|@SDK_ARCH@|${SDK_ARCH}|" \
+        < ${WORKDIR}/pkg-config-esdk.in > ${B}/pkg-config-esdk
+    install -m755 ${B}/pkg-config-esdk ${D}${bindir}/pkg-config-esdk
+}
+
+PKGCONFIGBIN = "${COMPONENTS_DIR}/${BUILD_ARCH}/${PN}/${bindir_native}"
+
+pkgconfig_sstate_postinst () {
+	if [ "$OE_SKIP_SDK_CHECK" = "1" -a "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ] ; then
+		rm -rf ${PKGCONFIGBIN}/pkg-config
+		lnr ${PKGCONFIGBIN}/pkg-config-esdk ${PKGCONFIGBIN}/pkg-config
+	fi
 }
+SSTATEPOSTINSTFUNCS += "pkgconfig_sstate_postinst"
Signature · 1 line
2.7.5
#1 lore raw

Ping, I believe I have addressed the issues with this, are there still some concerns or issues with this patch?

Quoted 128 lines · Saul Wold

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.

The pkg-config-esdk is only installed as pkg-config inside the eSDK, which
is why we use the sstate post install script and check for if we are in the
esdk environment.

Added an SDK_ARCH conversion to handle older 32bit installs since I now
use the ARCH based name for pkg-config

[YOCTO #11155]

---
 .../pkgconfig/pkgconfig/pkg-config-esdk.in         | 24
++++++++++++++++++++++
 .../pkgconfig/pkgconfig/pkg-config-native.in       |  2 +- meta/recipes-devtools/pkgconfig/pkgconfig_git.bb   | 17
+++++++++++++++

 3 files changed, 42 insertions(+), 1 deletion(-)

 create mode 100644 meta/recipes-devtools/pkgconfig/pkgconfig/pkg- config-esdk.in

(quoted diff) +0 -0

esdk.in b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config- esdk.in
new file mode 100644
index 0000000..948cc7a

meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-esdk.in new file +15 -0
@@ -0,0 +1,24 @@
+#! /bin/sh
+
+# 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`
+
+		# check if we are being called from  the kernel's

make menuconfig

meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-esdk.in new file +1 -0
+		if ( echo $parentpid_info | grep -q check-lxdialog )

; then

meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-esdk.in new file +8 -0
+			PKG_CONFIG_PATH="@PATH_NATIVE@"
+			PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@"
+			unset PKG_CONFIG_SYSROOT_DIR
+		fi
+	fi
+fi
+
+@SDK_ARCH@-pc-linux-gnu-pkg-config "$@"
(quoted diff) +0 -0

native.in b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config- native.in
index 5e44bb4..3490d24 100644

meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in +0 -0
@@ -4,4 +4,4 @@ PKG_CONFIG_PATH="@PATH_NATIVE@"

 PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@"
 unset PKG_CONFIG_SYSROOT_DIR

meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in +1 -1
-pkg-config "$@"
+@SDK_ARCH@-pc-linux-gnu-pkg-config "$@"
meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +0 -0
index e634021..980c613 100644
@@ -12,6 +12,7 @@ SRCREV = "edf8e6f0ea77ede073f07bff0d2ae1fc7a38103b"

 PV = "0.29.2+git${SRCPV}"

 SRC_URI = "git://anongit.freedesktop.org/pkg-config \
+           file://pkg-config-esdk.in \
            file://pkg-config-native.in \
            file://fix-glib-configure-libtool-usage.patch \
            file://0001-glib-gettext.m4-Update-AM_GLIB_GNU_GETTEXT- to-match-.patch \

meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +1 -0
@@ -52,6 +53,22 @@ RPROVIDES_${PN} += "pkgconfig(pkg-config)"
  do_install_append_class-native () {
      sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
          -e "s|@LIBDIR_NATIVE@|${PKG_CONFIG_LIBDIR}|" \
+        -e "s|@SDK_ARCH@|${SDK_ARCH}|" \

         < ${WORKDIR}/pkg-config-native.in > ${B}/pkg-config-native install -m755 ${B}/pkg-config-native ${D}${bindir}/pkg-config- native
+    sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
+        -e "s|@LIBDIR_NATIVE@|${PKG_CONFIG_LIBDIR}|" \
+        -e "s|@SDK_ARCH@|${SDK_ARCH}|" \
+        < ${WORKDIR}/pkg-config-esdk.in > ${B}/pkg-config-esdk +    install -m755 ${B}/pkg-config-esdk ${D}${bindir}/pkg-config-esdk

meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +3 -0
+}
+
+PKGCONFIGBIN =

"${COMPONENTS_DIR}/${BUILD_ARCH}/${PN}/${bindir_native}"

meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +3 -0
+
+pkgconfig_sstate_postinst () {
+	if [ "$OE_SKIP_SDK_CHECK" = "1" -a "${BB_CURRENTTASK}" =

"populate_sysroot" -o "${BB_CURRENTTASK}" =
"populate_sysroot_setscene" ] ; then

meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +2 -0
+		rm -rf ${PKGCONFIGBIN}/pkg-config
+		lnr ${PKGCONFIGBIN}/pkg-config-esdk

${PKGCONFIGBIN}/pkg-config

meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +1 -0
+	fi

 }
+SSTATEPOSTINSTFUNCS += "pkgconfig_sstate_postinst" --
2.7.5