mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-16 17:14:00 +00:00
rustPlatform.buildRustPackage: merge custom platforms
We should constrain the set of supported platforms to the platforms supported by the compiler. Otherwise we run into the unfortunate situation where setting meta.platforms in a Rust package to platforms.unix or platforms.linux will reintroduce CPU architectures unsupported by the compiler.
This commit is contained in:
parent
5ebc220565
commit
2ade30b7af
@ -150,21 +150,24 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg
|
|||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
meta = {
|
meta = meta // {
|
||||||
# default to Rust's platforms
|
badPlatforms = meta.badPlatforms or [] ++ [
|
||||||
platforms = rustc.meta.platforms ++ [
|
|
||||||
# Platforms without host tools from
|
|
||||||
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
|
|
||||||
"armv7a-darwin"
|
|
||||||
"armv5tel-linux" "armv7a-linux" "m68k-linux" "mips-linux"
|
|
||||||
"mips64-linux" "mipsel-linux" "mips64el-linux" "riscv32-linux"
|
|
||||||
"armv6l-netbsd" "mipsel-netbsd" "riscv64-netbsd"
|
|
||||||
"x86_64-redox"
|
|
||||||
"wasm32-wasi"
|
|
||||||
];
|
|
||||||
badPlatforms = [
|
|
||||||
# Rust is currently unable to target the n32 ABI
|
# Rust is currently unable to target the n32 ABI
|
||||||
lib.systems.inspect.patterns.isMips64n32
|
lib.systems.inspect.patterns.isMips64n32
|
||||||
];
|
];
|
||||||
} // meta;
|
} // lib.optionalAttrs (rustc.meta ? platforms) {
|
||||||
|
# default to Rust's platforms
|
||||||
|
platforms = lib.intersectLists
|
||||||
|
meta.platforms or lib.platforms.all
|
||||||
|
(rustc.meta.platforms ++ [
|
||||||
|
# Platforms without host tools from
|
||||||
|
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
|
||||||
|
"armv7a-darwin"
|
||||||
|
"armv5tel-linux" "armv7a-linux" "m68k-linux" "mips-linux"
|
||||||
|
"mips64-linux" "mipsel-linux" "mips64el-linux" "riscv32-linux"
|
||||||
|
"armv6l-netbsd" "mipsel-netbsd" "riscv64-netbsd"
|
||||||
|
"x86_64-redox"
|
||||||
|
"wasm32-wasi"
|
||||||
|
]);
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user