mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
Merge pull request #190697 from newAM/rustc-fix-embedded
rustc: fix build for no_std targets
This commit is contained in:
commit
c4e25f230b
3 changed files with 8 additions and 1 deletions
|
@ -38,4 +38,9 @@ rec {
|
|||
if platform ? rustc.platform
|
||||
then builtins.toFile (toRustTarget platform + ".json") (builtins.toJSON platform.rustc.platform)
|
||||
else toRustTarget platform;
|
||||
|
||||
# Returns true if the target is no_std
|
||||
# https://github.com/rust-lang/rust/blob/2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2/src/bootstrap/config.rs#L415-L421
|
||||
IsNoStdTarget = platform: let rustTarget = toRustTarget platform; in
|
||||
builtins.any (t: lib.hasInfix t rustTarget) ["-none" "nvptx" "switch" "-uefi"];
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ in
|
|||
lib = lib';
|
||||
|
||||
# Backwards compat before `lib` was factored out.
|
||||
inherit (lib') toTargetArch toTargetOs toRustTarget toRustTargetSpec;
|
||||
inherit (lib') toTargetArch toTargetOs toRustTarget toRustTargetSpec IsNoStdTarget;
|
||||
|
||||
# This just contains tools for now. But it would conceivably contain
|
||||
# libraries too, say if we picked some default/recommended versions from
|
||||
|
|
|
@ -107,6 +107,8 @@ in stdenv.mkDerivation rec {
|
|||
"${setHost}.musl-root=${pkgsBuildHost.targetPackages.stdenv.cc.libc}"
|
||||
] ++ optionals stdenv.targetPlatform.isMusl [
|
||||
"${setTarget}.musl-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}"
|
||||
] ++ optionals (rust.IsNoStdTarget stdenv.targetPlatform) [
|
||||
"--disable-docs"
|
||||
];
|
||||
|
||||
# The bootstrap.py will generated a Makefile that then executes the build.
|
||||
|
|
Loading…
Reference in a new issue