meson: Fix Meson CPU names for powerpc CPUs

Nixpkgs expects the `builtin.currentSystem` for POWER CPUs to be:

`powerpc[64][le]-linux`

But using `host_machine.cpu_family()` for the CPU part of the system
string on POWER produces this instead:

`ppc[64]-linux`

So evaluating Nixpkgs errors out on:

`error: Unknown CPU type: ppc64`

To fix this, change
`ppc` -> `powerpc`
`ppc64` -> `powerpc64`
and append `le` if `host_machine.endian() == 'little'`.

I can't actually test this on hardware rn due to hitting a kernel bug
on the host system when linking big things[1], but the approach here
is similar to how it was fixed in cppnix[2][3], so it *should* be fine.

[1] https://git.adelielinux.org/adelie/packages/-/issues/1315
[2] https://github.com/NixOS/nix/pull/13514
[3] https://github.com/NixOS/nix/pull/13520

Change-Id: Ib82839cdaf2198bf18b89e82caaa1217f88e11ed
This commit is contained in:
OPNA2608
2025-07-29 05:46:08 +00:00
committed by Raito Bezarius
parent 2b42901ec7
commit ce3e9e81b0
+10
View File
@@ -208,6 +208,16 @@ elif host_cpu == 'amd64'
host_cpu = 'x86_64'
elif host_cpu in ['armv6', 'armv7']
host_cpu += 'l'
elif host_cpu == 'ppc'
host_cpu = 'powerpc'
if host_machine.endian() == 'little'
host_cpu += 'le'
endif
elif host_cpu == 'ppc64'
host_cpu = 'powerpc64'
if host_machine.endian() == 'little'
host_cpu += 'le'
endif
endif
host_system = host_machine.cpu_family() + '-' + host_machine.system()