diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-02-16 18:01:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-16 18:01:12 +0000 |
commit | 164a7e44c7deffc1a73b7b399c1aace017b1ea7b (patch) | |
tree | 68caf1a2ec4bb090b4a71ab66d23287f630d0899 /pkgs/build-support/rust | |
parent | 5c852cc5876900f7b15a49bd3e7395e676f54d86 (diff) | |
parent | ac1f5b72a9e95873d1de0233fddcb56f99884b37 (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r-- | pkgs/build-support/rust/lib/default.nix | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pkgs/build-support/rust/lib/default.nix b/pkgs/build-support/rust/lib/default.nix index 77397f9b7220c..aa5ba14c1397b 100644 --- a/pkgs/build-support/rust/lib/default.nix +++ b/pkgs/build-support/rust/lib/default.nix @@ -30,10 +30,17 @@ rec { else lib.optional platform.isUnix "unix" ++ lib.optional platform.isWindows "windows"; + # https://doc.rust-lang.org/reference/conditional-compilation.html#target_vendor + toTargetVendor = platform: let + inherit (platform.parsed) vendor; + in platform.rustc.platform.vendor or { + "w64" = "pc"; + }.${vendor.name} or vendor.name; + # Returns the name of the rust target, even if it is custom. Adjustments are # because rust has slightly different naming conventions than we do. toRustTarget = platform: let - inherit (platform.parsed) cpu vendor kernel abi; + inherit (platform.parsed) cpu kernel abi; cpu_ = platform.rustc.platform.arch or { "armv7a" = "armv7"; "armv7l" = "armv7"; @@ -41,9 +48,7 @@ rec { "armv5tel" = "armv5te"; "riscv64" = "riscv64gc"; }.${cpu.name} or cpu.name; - vendor_ = platform.rustc.platform.vendor or { - "w64" = "pc"; - }.${vendor.name} or vendor.name; + vendor_ = toTargetVendor platform; in platform.rustc.config or "${cpu_}-${vendor_}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}"; |