From ce3e9e81b0f4c6639a768ba17e867b361502c425 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sun, 27 Jul 2025 07:19:52 +0200 Subject: [PATCH] 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 --- meson.build | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/meson.build b/meson.build index 222c4db79..522f18415 100644 --- a/meson.build +++ b/meson.build @@ -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()