William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1 | inherit siteinfo |
| 2 | |
| 3 | def meson_array(var, d): |
| 4 | items = d.getVar(var).split() |
| 5 | return repr(items[0] if len(items) == 1 else items) |
| 6 | |
| 7 | # Map our ARCH values to what Meson expects: |
| 8 | # http://mesonbuild.com/Reference-tables.html#cpu-families |
| 9 | def meson_cpu_family(var, d): |
| 10 | import re |
| 11 | arch = d.getVar(var) |
| 12 | if arch == 'powerpc': |
| 13 | return 'ppc' |
| 14 | elif arch == 'powerpc64' or arch == 'powerpc64le': |
| 15 | return 'ppc64' |
| 16 | elif arch == 'armeb': |
| 17 | return 'arm' |
| 18 | elif arch == 'aarch64_be': |
| 19 | return 'aarch64' |
| 20 | elif arch == 'mipsel': |
| 21 | return 'mips' |
| 22 | elif arch == 'mips64el': |
| 23 | return 'mips64' |
| 24 | elif re.match(r"i[3-6]86", arch): |
| 25 | return "x86" |
| 26 | elif arch == "microblazeel": |
| 27 | return "microblaze" |
| 28 | else: |
| 29 | return arch |
| 30 | |
| 31 | # Map our OS values to what Meson expects: |
| 32 | # https://mesonbuild.com/Reference-tables.html#operating-system-names |
| 33 | def meson_operating_system(var, d): |
| 34 | os = d.getVar(var) |
| 35 | if "mingw" in os: |
| 36 | return "windows" |
| 37 | # avoid e.g 'linux-gnueabi' |
| 38 | elif "linux" in os: |
| 39 | return "linux" |
| 40 | else: |
| 41 | return os |
| 42 | |
| 43 | def meson_endian(prefix, d): |
| 44 | arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS") |
| 45 | sitedata = siteinfo_data_for_machine(arch, os, d) |
| 46 | if "endian-little" in sitedata: |
| 47 | return "little" |
| 48 | elif "endian-big" in sitedata: |
| 49 | return "big" |
| 50 | else: |
| 51 | bb.fatal("Cannot determine endianism for %s-%s" % (arch, os)) |