Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions doc/manual/source/development/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,18 @@ nix build .#nix-everything-x86_64-w64-mingw32

For historic reasons and backward-compatibility, some CPU and OS identifiers are translated as follows:

| `config.guess` | Nix |
|----------------------------|---------------------|
| `amd64` | `x86_64` |
| `i*86` | `i686` |
| `arm6` | `arm6l` |
| `arm7` | `arm7l` |
| `linux-gnu*` | `linux` |
| `linux-musl*` | `linux` |
| `host_machine.cpu_family()` | `host_machine.endian()` | Nix |
|-----------------------------|-------------------------|---------------------|
| `x86` | | `i686` |
| `arm` | | `host_machine.cpu()`|
| `ppc` | `little` | `powerpcle` |
| `ppc64` | `little` | `powerpc64le` |
| `ppc` | `big` | `powerpc` |
| `ppc64` | `big` | `powerpc64` |
| `mips` | `little` | `mipsel` |
| `mips64` | `little` | `mips64el` |
| `mips` | `big` | `mips` |
| `mips64` | `big` | `mips64` |

## Compilation environments

Expand Down
13 changes: 11 additions & 2 deletions nix-meson-build-support/default-system-cpu/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
powerpc_system_cpus = [ 'ppc64', 'ppc' ]
# This attempts to translate meson cpu_family and cpu_name specified via
# --cross-file [1] into a nix *system double*. Nixpkgs mostly respects ([2]) the
# conventions outlined in [1].
#
# [1]: https://mesonbuild.com/Reference-tables.html#cpu-families
# [2]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/lib/meson.nix

nix_system_cpu = {'ppc64' : 'powerpc64', 'ppc' : 'powerpc', 'x86' : 'i686'}.get(
host_machine.cpu_family(),
host_machine.cpu_family(),
)

if powerpc_system_cpus.contains(host_machine.cpu_family()) and host_machine.endian() == 'little'
if (host_machine.cpu_family() in [ 'ppc64', 'ppc' ]) and host_machine.endian() == 'little'
nix_system_cpu += 'le'
elif host_machine.cpu_family() in [ 'mips64', 'mips' ] and host_machine.endian() == 'little'
nix_system_cpu += 'el'
elif host_machine.cpu_family() == 'arm'
nix_system_cpu = host_machine.cpu()
endif
Loading