All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] meson: remove shell wrapper for meson
@ 2020-09-18  9:50 christian.perkonig
  2020-09-18  9:50 ` [PATCH 2/2] meson: set correct cpu and cpu-family for multilib SDKs Christian Perkonig
  2020-09-18 10:32 ` [OE-core] [PATCH 1/2] meson: remove shell wrapper for meson Ross Burton
  0 siblings, 2 replies; 7+ messages in thread
From: christian.perkonig @ 2020-09-18  9:50 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christian Perkonig

The nativesdk-meson creates a shell wrapper which adds cross-file option to the meson command. This option causes problems because it is only uses for the setup command. If you use meson for testing like 'meson test' the cross-file option is discarded.

Signed-off-by: Christian Perkonig <christian.perkonig@sigmatek.at>
---
 meta/recipes-devtools/meson/meson/meson-wrapper    | 14 --------------
 .../meson/nativesdk-meson_0.55.1.bb                |  6 +-----
 2 files changed, 1 insertion(+), 19 deletions(-)
 delete mode 100755 meta/recipes-devtools/meson/meson/meson-wrapper

diff --git a/meta/recipes-devtools/meson/meson/meson-wrapper b/meta/recipes-devtools/meson/meson/meson-wrapper
deleted file mode 100755
index d4ffe60f9a..0000000000
--- a/meta/recipes-devtools/meson/meson/meson-wrapper
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
-    echo "OECORE_NATIVE_SYSROOT not set; are you in a Yocto SDK environment?" >&2
-fi
-
-# If these are set to a cross-compile path, meson will get confused and try to
-# use them as native tools. Unset them to prevent this, as all the cross-compile
-# config is already in meson.cross.
-unset CC CXX CPP LD AR NM STRIP
-
-exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \
-     --cross-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \
-     "$@"
diff --git a/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb b/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
index 67add2c25e..3c8c4fbc37 100644
--- a/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
+++ b/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
@@ -3,8 +3,7 @@ include meson.inc
 inherit nativesdk
 inherit siteinfo
 
-SRC_URI += "file://meson-setup.py \
-            file://meson-wrapper"
+SRC_URI += "file://meson-setup.py" 
 
 def meson_endian(prefix, d):
     arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
@@ -51,9 +50,6 @@ EOF
     install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d
     install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
 
-    # We need to wrap the real meson with a thin env setup wrapper.
-    mv ${D}${bindir}/meson ${D}${bindir}/meson.real
-    install -m 0755 ${WORKDIR}/meson-wrapper ${D}${bindir}/meson
 }
 
 RDEPENDS_${PN} += "\
-- 
2.25.1


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

* [PATCH 2/2] meson: set correct cpu and cpu-family for multilib SDKs
  2020-09-18  9:50 [PATCH 1/2] meson: remove shell wrapper for meson christian.perkonig
@ 2020-09-18  9:50 ` Christian Perkonig
  2020-09-29 13:17   ` [OE-core] " Richard Purdie
  2020-09-18 10:32 ` [OE-core] [PATCH 1/2] meson: remove shell wrapper for meson Ross Burton
  1 sibling, 1 reply; 7+ messages in thread
From: Christian Perkonig @ 2020-09-18  9:50 UTC (permalink / raw)
  To: openembedded-core; +Cc: Christian Perkonig

meson use to cross compile a cross-file. This file is special for
every build environment. So if you have a multilib SDK for aarch64
and arm the cpu_family and the cpu variable in the [HOST]-section
of the cross-file must be set correctly.

Currently these variables are statically set to TARGET_ARCH during
generation of the meson.cross.template file. Now the post-relocate
scripts sets these variable for every environment.

Signed-off-by: Christian Perkonig <christian.perkonig@sigmatek.at>
---
 meta/recipes-devtools/meson/meson/meson-setup.py      | 11 ++++++++++-
 meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb |  8 +++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-devtools/meson/meson/meson-setup.py b/meta/recipes-devtools/meson/meson/meson-setup.py
index 808e2a062f..a6b716c731 100755
--- a/meta/recipes-devtools/meson/meson/meson-setup.py
+++ b/meta/recipes-devtools/meson/meson/meson-setup.py
@@ -7,6 +7,10 @@ import sys
 class Template(string.Template):
     delimiter = "@"
 
+
+class TemplateSingle(string.Template):
+    delimiter = "@@"
+
 class Environ():
     def __getitem__(self, name):
         val = os.environ[name]
@@ -15,6 +19,10 @@ class Environ():
         val = '[%s]' % val
         return val
 
+class SingleEnv():
+    def __getitem__(self, name):
+        return '%s' % os.environ[name]
+
 try:
     sysroot = os.environ['OECORE_NATIVE_SYSROOT']
 except KeyError:
@@ -26,6 +34,7 @@ cross_file = os.path.join(sysroot, 'usr/share/meson/%smeson.cross' % os.environ[
 
 with open(template_file) as in_file:
     template = in_file.read()
-    output = Template(template).substitute(Environ())
+    s = TemplateSingle(template).substitute(SingleEnv())
+    output = Template(s).substitute(Environ())
     with open(cross_file, "w") as out_file:
         out_file.write(output)
diff --git a/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb b/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
index 3c8c4fbc37..67fdd2235d 100644
--- a/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
+++ b/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
@@ -30,6 +30,7 @@ c = @CC
 cpp = @CXX
 ar = @AR
 nm = @NM
+ld = @LD
 strip = @STRIP
 pkgconfig = 'pkg-config'
 
@@ -40,10 +41,11 @@ c_link_args = @LDFLAGS
 cpp_args = @CPPFLAGS
 cpp_link_args = @LDFLAGS
 
+# Host configuration form the meson point of view 
 [host_machine]
-system = '${SDK_OS}'
-cpu_family = '${SDK_ARCH}'
-cpu = '${SDK_ARCH}'
+system = '${TARGET_OS}'
+cpu_family = '@@ARCH'
+cpu = '@@OECORE_TARGET_ARCH'
 endian = '${@meson_endian("SDK", d)}'
 EOF
 
-- 
2.25.1


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

* Re: [OE-core] [PATCH 1/2] meson: remove shell wrapper for meson
  2020-09-18  9:50 [PATCH 1/2] meson: remove shell wrapper for meson christian.perkonig
  2020-09-18  9:50 ` [PATCH 2/2] meson: set correct cpu and cpu-family for multilib SDKs Christian Perkonig
@ 2020-09-18 10:32 ` Ross Burton
  2020-09-18 11:53   ` Christian Perkonig
  1 sibling, 1 reply; 7+ messages in thread
From: Ross Burton @ 2020-09-18 10:32 UTC (permalink / raw)
  To: christian.perkonig; +Cc: OE-core

On Fri, 18 Sep 2020 at 10:50, Christian Perkonig via
lists.openembedded.org
<christian.perkonig=sigmatek.at@lists.openembedded.org> wrote:
>
> The nativesdk-meson creates a shell wrapper which adds cross-file option to the meson command. This option causes problems because it is only uses for the setup command. If you use meson for testing like 'meson test' the cross-file option is discarded.

So why is this a problem for test if the option is discarded?

Ross

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

* Re: [OE-core] [PATCH 1/2] meson: remove shell wrapper for meson
  2020-09-18 10:32 ` [OE-core] [PATCH 1/2] meson: remove shell wrapper for meson Ross Burton
@ 2020-09-18 11:53   ` Christian Perkonig
  2020-09-29  6:33     ` Christian Perkonig
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Perkonig @ 2020-09-18 11:53 UTC (permalink / raw)
  To: Ross Burton; +Cc: OE-core



On 18.09.20 12:32, Ross Burton wrote:
> On Fri, 18 Sep 2020 at 10:50, Christian Perkonig via
> lists.openembedded.org
> <christian.perkonig=sigmatek.at@lists.openembedded.org> wrote:
>>
>> The nativesdk-meson creates a shell wrapper which adds cross-file option to the meson command. This option causes problems because it is only uses for the setup command. If you use meson for testing like 'meson test' the cross-file option is discarded.
> 
> So why is this a problem for test if the option is discarded?

The problem is the syntax of the meson command. Meson is called like
   meson [COMMAND] [COMMAND_OPTIONS]
and the default command is setup. When you call 'meson test' or any 
other command it will be expanded to
   meson --cross-file=.... test
In this case the default command is used (setup) and test is interpreted 
as the build directory. It is not possible to use meson with any command 
when the wrapper is used.

Christian

> 
> Ross
> 

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

* Re: [OE-core] [PATCH 1/2] meson: remove shell wrapper for meson
  2020-09-18 11:53   ` Christian Perkonig
@ 2020-09-29  6:33     ` Christian Perkonig
  2020-09-29 13:14       ` Richard Purdie
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Perkonig @ 2020-09-29  6:33 UTC (permalink / raw)
  To: OE-core

Can someone review the patches

thanks
Christian


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

* Re: [OE-core] [PATCH 1/2] meson: remove shell wrapper for meson
  2020-09-29  6:33     ` Christian Perkonig
@ 2020-09-29 13:14       ` Richard Purdie
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2020-09-29 13:14 UTC (permalink / raw)
  To: christian.perkonig, OE-core

On Tue, 2020-09-29 at 08:33 +0200, Christian Perkonig via
lists.openembedded.org wrote:
> Can someone review the patches

I don't doubt there is a problem here but simply reverting them is
going to cause someone else a different problem for which the patch was
originally added.

Is there not a way we could improve things so the original problem was
addressed but your issues also are resolved?

Cheers,

Richard


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

* Re: [OE-core] [PATCH 2/2] meson: set correct cpu and cpu-family for multilib SDKs
  2020-09-18  9:50 ` [PATCH 2/2] meson: set correct cpu and cpu-family for multilib SDKs Christian Perkonig
@ 2020-09-29 13:17   ` Richard Purdie
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2020-09-29 13:17 UTC (permalink / raw)
  To: christian.perkonig, openembedded-core

On Fri, 2020-09-18 at 11:50 +0200, Christian Perkonig via lists.openembedded.org wrote:
> meson use to cross compile a cross-file. This file is special for
> every build environment. So if you have a multilib SDK for aarch64
> and arm the cpu_family and the cpu variable in the [HOST]-section
> of the cross-file must be set correctly.
> 
> Currently these variables are statically set to TARGET_ARCH during
> generation of the meson.cross.template file. Now the post-relocate
> scripts sets these variable for every environment.
> 
> Signed-off-by: Christian Perkonig <christian.perkonig@sigmatek.at>
> ---
>  meta/recipes-devtools/meson/meson/meson-setup.py      | 11 ++++++++++-
>  meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb |  8 +++++---
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/recipes-devtools/meson/meson/meson-setup.py b/meta/recipes-devtools/meson/meson/meson-setup.py
> index 808e2a062f..a6b716c731 100755
> --- a/meta/recipes-devtools/meson/meson/meson-setup.py
> +++ b/meta/recipes-devtools/meson/meson/meson-setup.py
> @@ -7,6 +7,10 @@ import sys
>  class Template(string.Template):
>      delimiter = "@"
>  
> +
> +class TemplateSingle(string.Template):
> +    delimiter = "@@"
> +
>  class Environ():
>      def __getitem__(self, name):
>          val = os.environ[name]
> @@ -15,6 +19,10 @@ class Environ():
>          val = '[%s]' % val
>          return val
>  
> +class SingleEnv():
> +    def __getitem__(self, name):
> +        return '%s' % os.environ[name]
> +
>  try:
>      sysroot = os.environ['OECORE_NATIVE_SYSROOT']
>  except KeyError:
> @@ -26,6 +34,7 @@ cross_file = os.path.join(sysroot, 'usr/share/meson/%smeson.cross' % os.environ[
>  
>  with open(template_file) as in_file:
>      template = in_file.read()
> -    output = Template(template).substitute(Environ())
> +    s = TemplateSingle(template).substitute(SingleEnv())
> +    output = Template(s).substitute(Environ())
>      with open(cross_file, "w") as out_file:
>          out_file.write(output)
> diff --git a/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb b/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
> index 3c8c4fbc37..67fdd2235d 100644
> --- a/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
> +++ b/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
> @@ -30,6 +30,7 @@ c = @CC
>  cpp = @CXX
>  ar = @AR
>  nm = @NM
> +ld = @LD
>  strip = @STRIP
>  pkgconfig = 'pkg-config'
>  
> @@ -40,10 +41,11 @@ c_link_args = @LDFLAGS
>  cpp_args = @CPPFLAGS
>  cpp_link_args = @LDFLAGS
>  
> +# Host configuration form the meson point of view 
>  [host_machine]
> -system = '${SDK_OS}'
> -cpu_family = '${SDK_ARCH}'
> -cpu = '${SDK_ARCH}'
> +system = '${TARGET_OS}'
> +cpu_family = '@@ARCH'
> +cpu = '@@OECORE_TARGET_ARCH'
>  endian = '${@meson_endian("SDK", d)}'
>  EOF
>  

We can build SDKs where there are multiple different target components.
"nativesdk" components therefore need to be architecture independent.
As far as I can see, this encodes target information into the nativesdk
tooling and is therefore totally incorrect. This would make it a
"cross" tool in Yocto Project terms and nativesdk is not a cross tool.

I don't doubt there are issues here but this patch is therefore not the
right way to fix this. 

Cheers,

Richard


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

end of thread, other threads:[~2020-09-29 13:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  9:50 [PATCH 1/2] meson: remove shell wrapper for meson christian.perkonig
2020-09-18  9:50 ` [PATCH 2/2] meson: set correct cpu and cpu-family for multilib SDKs Christian Perkonig
2020-09-29 13:17   ` [OE-core] " Richard Purdie
2020-09-18 10:32 ` [OE-core] [PATCH 1/2] meson: remove shell wrapper for meson Ross Burton
2020-09-18 11:53   ` Christian Perkonig
2020-09-29  6:33     ` Christian Perkonig
2020-09-29 13:14       ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.