All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ruslan Babayev" <ruslan@babayev.com>
To: openembedded-core@lists.openembedded.org
Cc: Ruslan Babayev <ruslan@babayev.com>
Subject: [PATCH] meson: use the more specific cpu arch in cross file
Date: Sat, 25 Jul 2020 18:56:14 -0700	[thread overview]
Message-ID: <20200726015614.2875-1-ruslan@babayev.com> (raw)

'cpu' unlike 'cpu_family' must be a more specific subtype for the CPU.

Signed-off-by: Ruslan Babayev <ruslan@babayev.com>
---
 meta/classes/meson.bbclass                         | 14 ++++++++++++--
 .../meson/nativesdk-meson_0.53.2.bb                | 12 +++++++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/meta/classes/meson.bbclass b/meta/classes/meson.bbclass
index ff52d20e56..0caa7a37c2 100644
--- a/meta/classes/meson.bbclass
+++ b/meta/classes/meson.bbclass
@@ -62,6 +62,16 @@ def meson_cpu_family(var, d):
     else:
         return arch
 
+def meson_cpu(prefix, d):
+    import re
+    arch = d.getVar(prefix + "_ARCH")
+    tune_ccargs = d.getVar("TUNE_CCARGS")
+    m = re.search(r"(?<=-march=)\w+|(?<=-mcpu=)\w+", tune_ccargs)
+    if m:
+        return m.group(0)
+    else:
+        return arch
+
 # Map our OS values to what Meson expects:
 # https://mesonbuild.com/Reference-tables.html#operating-system-names
 def meson_operating_system(var, d):
@@ -110,13 +120,13 @@ gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'
 [host_machine]
 system = '${@meson_operating_system('HOST_OS', d)}'
 cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}'
-cpu = '${HOST_ARCH}'
+cpu = '${@meson_cpu('HOST', d)}'
 endian = '${@meson_endian('HOST', d)}'
 
 [target_machine]
 system = '${@meson_operating_system('TARGET_OS', d)}'
 cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
-cpu = '${TARGET_ARCH}'
+cpu = '${@meson_cpu('TARGET', d)}'
 endian = '${@meson_endian('TARGET', d)}'
 EOF
 }
diff --git a/meta/recipes-devtools/meson/nativesdk-meson_0.53.2.bb b/meta/recipes-devtools/meson/nativesdk-meson_0.53.2.bb
index 67add2c25e..021bff0992 100644
--- a/meta/recipes-devtools/meson/nativesdk-meson_0.53.2.bb
+++ b/meta/recipes-devtools/meson/nativesdk-meson_0.53.2.bb
@@ -6,6 +6,16 @@ inherit siteinfo
 SRC_URI += "file://meson-setup.py \
             file://meson-wrapper"
 
+def meson_cpu(var, d):
+    import re
+    arch = d.getVar(var)
+    tune_ccargs = d.getVar("TUNE_CCARGS")
+    m = re.search(r"(?<=-march=)\w+|(?<=-mcpu=)\w+", tune_ccargs)
+    if m:
+        return m.group(0)
+    else:
+        return arch
+
 def meson_endian(prefix, d):
     arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
     sitedata = siteinfo_data_for_machine(arch, os, d)
@@ -44,7 +54,7 @@ cpp_link_args = @LDFLAGS
 [host_machine]
 system = '${SDK_OS}'
 cpu_family = '${SDK_ARCH}'
-cpu = '${SDK_ARCH}'
+cpu = '${@meson_cpu("SDK_ARCH", d)}'
 endian = '${@meson_endian("SDK", d)}'
 EOF
 
-- 
2.25.1


             reply	other threads:[~2020-07-26  1:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-26  1:56 Ruslan Babayev [this message]
2020-07-26  2:02 ` ✗ patchtest: failure for meson: use the more specific cpu arch in cross file Patchwork
2020-07-27 10:52 ` [OE-core] [PATCH] " Ross Burton
2020-07-27 19:03   ` Ruslan Babayev
2020-07-29 21:04     ` Ruslan Babayev
2020-07-30  4:55 ` Khem Raj
2020-07-30  6:12   ` Ruslan Babayev
2020-07-30  8:49     ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200726015614.2875-1-ruslan@babayev.com \
    --to=ruslan@babayev.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.