Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] pkg-config: allow kernel to be build with esdk
@ 2017-06-14 14:03 Saul Wold
  2017-06-20 14:03 ` Saul Wold
  2017-06-23 14:47 ` Richard Purdie
  0 siblings, 2 replies; 4+ messages in thread
From: Saul Wold @ 2017-06-14 14:03 UTC (permalink / raw)
  To: openembedded-core, richard.purdie

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 <sgw@linux.intel.com>
---
 .../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

diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in
new file mode 100644
index 0000000..dabec47
--- /dev/null
+++ b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in
@@ -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 "$@"
diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
index e634021..3ec7458 100644
--- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
+++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
@@ -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
 }
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pkg-config: allow kernel to be build with esdk
  2017-06-14 14:03 [PATCH] pkg-config: allow kernel to be build with esdk Saul Wold
@ 2017-06-20 14:03 ` Saul Wold
  2017-06-23 14:47 ` Richard Purdie
  1 sibling, 0 replies; 4+ messages in thread
From: Saul Wold @ 2017-06-20 14:03 UTC (permalink / raw)
  To: openembedded-core, richard.purdie


Ping on this patch?

It has been tested with a variety of shells (sh, bash, dash, ash).  Is
there any further concerns?

Sau!


On Wed, 2017-06-14 at 07:03 -0700, Saul Wold wrote:
> 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 <sgw@linux.intel.com>
> ---
>  .../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
> 
> diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in
> b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in
> new file mode 100644
> index 0000000..dabec47
> --- /dev/null
> +++ b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config.in
> @@ -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 "$@"
> diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> index e634021..3ec7458 100644
> --- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> +++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
> @@ -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
>  }
> -- 
> 2.7.4
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pkg-config: allow kernel to be build with esdk
  2017-06-14 14:03 [PATCH] pkg-config: allow kernel to be build with esdk Saul Wold
  2017-06-20 14:03 ` Saul Wold
@ 2017-06-23 14:47 ` Richard Purdie
  2017-06-23 23:38   ` Saul Wold
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2017-06-23 14:47 UTC (permalink / raw)
  To: Saul Wold, openembedded-core

On Wed, 2017-06-14 at 07:03 -0700, Saul Wold wrote:
> 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 <sgw@linux.intel.com>
> ---

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pkg-config: allow kernel to be build with esdk
  2017-06-23 14:47 ` Richard Purdie
@ 2017-06-23 23:38   ` Saul Wold
  0 siblings, 0 replies; 4+ messages in thread
From: Saul Wold @ 2017-06-23 23:38 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core

On Fri, 2017-06-23 at 15:47 +0100, Richard Purdie wrote:
> On Wed, 2017-06-14 at 07:03 -0700, Saul Wold wrote:
> > 
> > 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 <sgw@linux.intel.com>
> > ---
> 
> 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...
> 
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!


> Cheers,
> 
> Richard
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-23 23:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-14 14:03 [PATCH] pkg-config: allow kernel to be build with esdk Saul Wold
2017-06-20 14:03 ` Saul Wold
2017-06-23 14:47 ` Richard Purdie
2017-06-23 23:38   ` Saul Wold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox