diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-10 14:35:29 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-12 15:27:17 +0100 |
| commit | fd1517e2b51a170f2427122c6b95396db251d827 (patch) | |
| tree | dabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes-recipe/meson-routines.bbclass | |
| parent | 10317912ee319ccf7f83605d438b5cbf9663f296 (diff) | |
| download | poky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz | |
classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take
advantage of new bitbake functionality to check class scope/usage.
(From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/meson-routines.bbclass')
| -rw-r--r-- | meta/classes-recipe/meson-routines.bbclass | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/classes-recipe/meson-routines.bbclass b/meta/classes-recipe/meson-routines.bbclass new file mode 100644 index 0000000000..6086fce9d9 --- /dev/null +++ b/meta/classes-recipe/meson-routines.bbclass | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: MIT | ||
| 5 | # | ||
| 6 | |||
| 7 | inherit siteinfo | ||
| 8 | |||
| 9 | def meson_array(var, d): | ||
| 10 | items = d.getVar(var).split() | ||
| 11 | return repr(items[0] if len(items) == 1 else items) | ||
| 12 | |||
| 13 | # Map our ARCH values to what Meson expects: | ||
| 14 | # http://mesonbuild.com/Reference-tables.html#cpu-families | ||
| 15 | def meson_cpu_family(var, d): | ||
| 16 | import re | ||
| 17 | arch = d.getVar(var) | ||
| 18 | if arch == 'powerpc': | ||
| 19 | return 'ppc' | ||
| 20 | elif arch == 'powerpc64' or arch == 'powerpc64le': | ||
| 21 | return 'ppc64' | ||
| 22 | elif arch == 'armeb': | ||
| 23 | return 'arm' | ||
| 24 | elif arch == 'aarch64_be': | ||
| 25 | return 'aarch64' | ||
| 26 | elif arch == 'mipsel': | ||
| 27 | return 'mips' | ||
| 28 | elif arch == 'mips64el': | ||
| 29 | return 'mips64' | ||
| 30 | elif re.match(r"i[3-6]86", arch): | ||
| 31 | return "x86" | ||
| 32 | elif arch == "microblazeel": | ||
| 33 | return "microblaze" | ||
| 34 | else: | ||
| 35 | return arch | ||
| 36 | |||
| 37 | # Map our OS values to what Meson expects: | ||
| 38 | # https://mesonbuild.com/Reference-tables.html#operating-system-names | ||
| 39 | def meson_operating_system(var, d): | ||
| 40 | os = d.getVar(var) | ||
| 41 | if "mingw" in os: | ||
| 42 | return "windows" | ||
| 43 | # avoid e.g 'linux-gnueabi' | ||
| 44 | elif "linux" in os: | ||
| 45 | return "linux" | ||
| 46 | else: | ||
| 47 | return os | ||
| 48 | |||
| 49 | def meson_endian(prefix, d): | ||
| 50 | arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS") | ||
| 51 | sitedata = siteinfo_data_for_machine(arch, os, d) | ||
| 52 | if "endian-little" in sitedata: | ||
| 53 | return "little" | ||
| 54 | elif "endian-big" in sitedata: | ||
| 55 | return "big" | ||
| 56 | else: | ||
| 57 | bb.fatal("Cannot determine endianism for %s-%s" % (arch, os)) | ||
