From ebd311b7b70731225d94f0e1645fa7b08452765d Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Tue, 22 Jul 2025 03:27:27 +0300 Subject: [PATCH] meson: Correctly handle endianness for PowerPC CPU families I've missed this while reviewing 6db61900028ec641f12b1d36fe4ece5a9bdaa66f. I only built big endian ppc64, so that didn't occur to me. From meson manual: > Those porting from autotools should note that Meson does not add > endianness to the name of the cpu_family. For example, autotools will > call little endian PPC64 "ppc64le", Meson will not, you must also check > the .endian() value of the machine for this information. This code should handle that correctly. --- .../default-system-cpu/meson.build | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/nix-meson-build-support/default-system-cpu/meson.build b/nix-meson-build-support/default-system-cpu/meson.build index fd447aa01..2221265f0 100644 --- a/nix-meson-build-support/default-system-cpu/meson.build +++ b/nix-meson-build-support/default-system-cpu/meson.build @@ -1,9 +1,10 @@ -nix_system_cpu = { - 'ppc64' : 'powerpc64', - 'ppc64le' : 'powerpc64le', - 'ppc' : 'powerpc', - 'ppcle' : 'powerpcle', -}.get( +powerpc_system_cpus = [ 'ppc64', 'ppc' ] + +nix_system_cpu = {'ppc64' : 'powerpc64', 'ppc' : 'powerpc'}.get( host_machine.cpu_family(), host_machine.cpu_family(), ) + +if powerpc_system_cpus.contains(host_machine.cpu_family()) and host_machine.endian() == 'little' + nix_system_cpu += 'le' +endif