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 | |
parent | 5c852cc5876900f7b15a49bd3e7395e676f54d86 (diff) | |
parent | ac1f5b72a9e95873d1de0233fddcb56f99884b37 (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/rust/lib/default.nix | 13 | ||||
-rw-r--r-- | pkgs/build-support/vm/default.nix | 12 |
2 files changed, 16 insertions, 9 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}"}"; diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 7b383118a0614..403bc9b1d2dab 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -35,10 +35,12 @@ rec { mkdir -p $out/lib # Copy what we need from Glibc. - cp -p ${pkgs.stdenv.cc.libc}/lib/ld-linux*.so.? $out/lib - cp -p ${pkgs.stdenv.cc.libc}/lib/libc.so.* $out/lib - cp -p ${pkgs.stdenv.cc.libc}/lib/libm.so.* $out/lib - cp -p ${pkgs.stdenv.cc.libc}/lib/libresolv.so.* $out/lib + cp -p \ + ${pkgs.stdenv.cc.libc}/lib/ld-*.so.? \ + ${pkgs.stdenv.cc.libc}/lib/libc.so.* \ + ${pkgs.stdenv.cc.libc}/lib/libm.so.* \ + ${pkgs.stdenv.cc.libc}/lib/libresolv.so.* \ + $out/lib # Copy BusyBox. cp -pd ${pkgs.busybox}/bin/* $out/bin @@ -49,7 +51,7 @@ rec { for i in $out/bin/*; do if [ -f "$i" -a ! -L "$i" ]; then echo "patching $i..." - patchelf --set-interpreter $out/lib/ld-linux*.so.? --set-rpath $out/lib $i || true + patchelf --set-interpreter $out/lib/ld-*.so.? --set-rpath $out/lib $i || true fi done ''; # */ |