From 723f2c7352dc3b4ae30af8f96a543e00d1cfd0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 9 Apr 2025 07:50:37 +0200 Subject: [PATCH] docs: update cross compilation section from autotools to meson fixes https://github.com/NixOS/nix/issues/12934 Update doc/manual/source/development/building.md Co-authored-by: Eelco Dolstra Update doc/manual/source/development/building.md Co-authored-by: John Ericson --- doc/manual/source/development/building.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/manual/source/development/building.md b/doc/manual/source/development/building.md index da465d090..2a9a7afd0 100644 --- a/doc/manual/source/development/building.md +++ b/doc/manual/source/development/building.md @@ -195,19 +195,25 @@ Nix uses a string with the following format to identify the *system type* or *pl -[-] ``` -It is set when Nix is compiled for the given system, and based on the output of [`config.guess`](https://github.com/nixos/nix/blob/master/config/config.guess) ([upstream](https://git.savannah.gnu.org/cgit/config.git/tree/config.guess)): +It is set when Nix is compiled for the given system, and based on the output of Meson's [`host_machine` information](https://mesonbuild.com/Reference-manual_builtin_host_machine.html)> ``` --[][-] ``` -When Nix is built such that `./configure` is passed any of the `--host`, `--build`, `--target` options, the value is based on the output of [`config.sub`](https://github.com/nixos/nix/blob/master/config/config.sub) ([upstream](https://git.savannah.gnu.org/cgit/config.git/tree/config.sub)): +When cross-compiling Nix with Meson for local development, you need to specify a [cross-file](https://mesonbuild.com/Cross-compilation.html) using the `--cross-file` option. Cross-files define the target architecture and toolchain. When cross-compiling Nix with Nix, Nixpkgs takes care of this for you. + +In the nix flake we also have some cross-compilation targets available: ``` --[-]- +nix build .#nix-everything-riscv64-unknown-linux-gnu +nix build .#nix-everything-armv7l-unknown-linux-gnueabihf +nix build .#nix-everything-armv7l-unknown-linux-gnueabihf +nix build .#nix-everything-x86_64-unknown-freebsd +nix build .#nix-everything-x86_64-w64-mingw32 ``` -For historic reasons and backward-compatibility, some CPU and OS identifiers are translated from the GNU Autotools naming convention in [`configure.ac`](https://github.com/nixos/nix/blob/master/configure.ac) as follows: +For historic reasons and backward-compatibility, some CPU and OS identifiers are translated as follows: | `config.guess` | Nix | |----------------------------|---------------------|