pkg-config: allow kernel to be build with esdk
PATCH 1/1 pkg-config: 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 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.
This script also replaces the default pkg-config-native script.
[YOCTO #11155]
--- .../pkgconfig/pkgconfig/pkg-config.in | 22 ++++++++++++++++++++++ meta/recipes-devtools/pkgconfig/pkgconfig_git.bb | 14 ++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in
meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in new file +22 -0
@@ -0,0 +1,22 @@ +#!/bin/sh + +do_native=0 + +parentpid=`ps -o ppid= -p $$` +parentpid_info=`ps -wo comm= -o args= -p $parentpid` + +# in this case we are in the esdk and being called from +# the kernel's make menuconfig +if [ "pkg-config-native" = "`basename $0`" ] || + ([ "$OE_SKIP_SDK_CHECK" = "1" ] && + ( echo $parentpid_info | grep -q check-lxdialog )) ; then + do_native=1 +fi + +if [ $do_native -eq 1 ] ; then + PKG_CONFIG_PATH="@PATH_NATIVE@" + PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@" + unset PKG_CONFIG_SYSROOT_DIR +fi + +pkg-config.real "$@"
meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +10 -4
@@ -12,6 +12,7 @@ SRCREV = "edf8e6f0ea77ede073f07bff0d2ae1fc7a38103b" PV = "0.29.2+git${SRCPV}" SRC_URI = "git://anongit.freedesktop.org/pkg-config \ + file://pkg-config.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 \
@@ -47,11 +48,16 @@ FILES_${PN} += "${datadir}/aclocal/pkg.m4" # specifying an appropriate provide. RPROVIDES_${PN} += "pkgconfig(pkg-config)" +do_install_append () { + 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.in > ${B}/pkg-config + install -m755 ${B}/pkg-config ${D}${bindir}/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 + install -m755 ${B}/pkg-config ${D}${bindir}/pkg-config-native }
Signature · 1 line
2.7.4
Ping on this patch?
It has been tested with a variety of shells (sh, bash, dash, ash). Is there any further concerns?
Sau!
Quoted 99 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 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.This script also replaces the default pkg-config-native script.
[YOCTO #11155]
Signed-off-by Saul Wold <[email protected]>---
.../pkgconfig/pkgconfig/pkg-config.in | 22
++++++++++++++++++++++
meta/recipes-devtools/pkgconfig/pkgconfig_git.bb | 14 ++++++++++
----2 files changed, 32 insertions(+), 4 deletions(-)create mode 100644 meta/recipes-devtools/pkgconfig/pkgconfig/pkg- config.in
meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in new file +22
-0@@ -0,0 +1,22 @@ +#!/bin/sh + +do_native=0 + +parentpid=`ps -o ppid= -p $$` +parentpid_info=`ps -wo comm= -o args= -p $parentpid` + +# in this case we are in the esdk and being called from +# the kernel's make menuconfig +if [ "pkg-config-native" = "`basename $0`" ] || + ([ "$OE_SKIP_SDK_CHECK" = "1" ] && + ( echo $parentpid_info | grep -q check-lxdialog )) ; then + do_native=1 +fi + +if [ $do_native -eq 1 ] ; then + PKG_CONFIG_PATH="@PATH_NATIVE@" + PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@" + unset PKG_CONFIG_SYSROOT_DIR +fi + +pkg-config.real "$@"meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +0
-0@@ -12,6 +12,7 @@ SRCREV = "edf8e6f0ea77ede073f07bff0d2ae1fc7a38103b"PV = "0.29.2+git${SRCPV}"
SRC_URI = "git://anongit.freedesktop.org/pkg-config\
+ file://pkg-config.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 +0
-0@@ -47,11 +48,16 @@ FILES_${PN} += "${datadir}/aclocal/pkg.m4" # specifying an appropriate provide.RPROVIDES_${PN} += "pkgconfig(pkg-config)"
meta/recipes-devtools/pkgconfig/pkgconfig_git.bb +8
-0+do_install_append () { + 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.in > ${B}/pkg-config + install -m755 ${B}/pkg-config ${D}${bindir}/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- nativemeta/recipes-devtools/pkgconfig/pkgconfig_git.bb +1
-0+ install -m755 ${B}/pkg-config ${D}${bindir}/pkg-config-native
}
--
2.7.4
Quoted 10 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 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.
Quoted 6 lines
This script also replaces the default pkg-config-native script.
[YOCTO #11155]
Signed-off-by Saul Wold <[email protected]>---
To be honest, I'm scared of adding this kind of complexity to the system. I appreciate the problem you're trying to solve but I worry adding this kind of change is complex, invasive and introduces too much risk.
I have some specific worries with this implementation too, in particular that it changes on target pkg-config, it really should only change nativesdk-pkgconfig? If we have risk, we want to minimise that risk and adding this wrapper everywhere doesn't seem to do that...
Cheers,
Richard
Quoted 27 lines · Richard Purdie
Quoted 13 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 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.Quoted 6 lines
This script also replaces the default pkg-config-native script.
[YOCTO #11155]
Signed-off-by Saul Wold <[email protected]>---
To be honest, I'm scared of adding this kind of complexity to the system. I appreciate the problem you're trying to solve but I worry adding this kind of change is complex, invasive and introduces too much
risk.
Quoted 6 lines
I have some specific worries with this implementation too, in particular that it changes on target pkg-config, it really should only
change nativesdk-pkgconfig? If we have risk, we want to minimise that risk and adding this wrapper everywhere doesn't seem to do that...
There is no nativesdk-pkgconfig, but I had some confusion around the pkg-config-native and it's usage of a pkg-config binary. I was getting some recursion initially and my feeble brain thought it was the target version :-(.
I have rebuilt this patch and will send a V2 that ONLY affects the pkg- config-native, basically expands the script to check if it's being called as -native or from the Kernel's check-lxdialog.
I am also going to change the script such that it checks it's base name of pkg-config and only then add the parent pid name checking.
I hope that will mitigate the risk.
Sau!
Quoted 5 lines
Cheers,
Richard