diff options
| author | Simon McVittie <smcv@debian.org> | 2024-10-02 18:57:21 +0100 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-10-02 22:58:50 +0300 |
| commit | 9d0de83368c89ff7fc54ec95d5f15ec29e8e0f0e (patch) | |
| tree | a7ccb89b3f262ba727cb45c6e8a6ae8a67f958dd /mesonbuild/scripts/env2mfile.py | |
| parent | 114a3e29144c99c6ff36c656ab3d72fd5aa36f6e (diff) | |
| download | meson-9d0de83368c89ff7fc54ec95d5f15ec29e8e0f0e.tar.gz | |
env2mfile: Base cpu on DEB_HOST_GNU_CPU unless DEB_HOST_ARCH is special
`DEB_HOST_ARCH` encodes both the CPU family and the OS, so using it to
get the CPU type gives the wrong answer for non-Linux ports.
However, `DEB_HOST_GNU_CPU` gives less detailed information about the
CPU: it's `arm` for all 32-bit ARM CPUs, and doesn't distinguish between
the differing baselines of `armel` (ARMv5 softfloat) and `armhf`
(ARMv7 hardfloat).
When cross-compiling for x86_64 Linux, this changes the `cpu()` from
`amd64` to `x86_64`, which is consistent with the answer we get during
native builds on that architecture.
When cross-compiling for `ppc64el`, this changes the `cpu()` from
`ppc64el` to `ppc64`, which is a reasonable change but is still not
consistent with what we see during native builds (which is `ppc64le`):
see #13741 for that.
Resolves: https://github.com/mesonbuild/meson/issues/13742
Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'mesonbuild/scripts/env2mfile.py')
| -rwxr-xr-x | mesonbuild/scripts/env2mfile.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mesonbuild/scripts/env2mfile.py b/mesonbuild/scripts/env2mfile.py index a59c1c40c..207d75749 100755 --- a/mesonbuild/scripts/env2mfile.py +++ b/mesonbuild/scripts/env2mfile.py @@ -130,14 +130,20 @@ def get_args_from_envvars(infos: MachineInfo) -> None: if objcpp_link_args: infos.link_args['objcpp'] = objcpp_link_args +# map from DEB_HOST_GNU_CPU to Meson machine.cpu_family() deb_cpu_family_map = { 'mips64el': 'mips64', 'i686': 'x86', 'powerpc64le': 'ppc64', } -deb_cpu_map = { +# map from DEB_HOST_ARCH to Meson machine.cpu() +deb_arch_cpu_map = { 'armhf': 'arm7hlf', +} + +# map from DEB_HOST_GNU_CPU to Meson machine.cpu() +deb_cpu_map = { 'mips64el': 'mips64', 'powerpc64le': 'ppc64', } @@ -202,7 +208,8 @@ def dpkg_architecture_to_machine_info(output: str, options: T.Any) -> MachineInf host_subsystem = host_os host_kernel = replace_special_cases(deb_kernel_map, data['DEB_HOST_ARCH_OS']) host_cpu_family = replace_special_cases(deb_cpu_family_map, data['DEB_HOST_GNU_CPU']) - host_cpu = replace_special_cases(deb_cpu_map, data['DEB_HOST_ARCH']) + host_cpu = deb_arch_cpu_map.get(data['DEB_HOST_ARCH'], + replace_special_cases(deb_cpu_map, data['DEB_HOST_GNU_CPU'])) host_endian = data['DEB_HOST_ARCH_ENDIAN'] compilerstems = [('c', 'gcc'), |
