rustc: fix build for no_std targets
This commit is contained in:
parent
8e9a77e2b5
commit
bac7ee3208
|
@ -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