mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-12 05:16:25 +03:00
rustc: expose platform lists
Previously, it wasn't possible to access the list of platforms we can build Rust programs for outside of buildRustPackage. This was a problem for packages that have optional Rust components, like gstreamer or Meson, as there was no way to only build the Rust parts for supported platforms. Now it's possible to get that information from rustc's passthru.
This commit is contained in:
parent
ce19166255
commit
0852f8eb84
4 changed files with 41 additions and 30 deletions
|
@ -151,23 +151,10 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
meta = meta // {
|
meta = meta // {
|
||||||
badPlatforms = meta.badPlatforms or [] ++ [
|
badPlatforms = meta.badPlatforms or [] ++ rustc.badTargetPlatforms;
|
||||||
# Rust is currently unable to target the n32 ABI
|
|
||||||
lib.systems.inspect.patterns.isMips64n32
|
|
||||||
];
|
|
||||||
} // lib.optionalAttrs (rustc.meta ? platforms) {
|
|
||||||
# default to Rust's platforms
|
# default to Rust's platforms
|
||||||
platforms = lib.intersectLists
|
platforms = lib.intersectLists
|
||||||
meta.platforms or lib.platforms.all
|
meta.platforms or lib.platforms.all
|
||||||
(rustc.meta.platforms ++ [
|
rustc.targetPlatforms;
|
||||||
# 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"
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
|
@ -30,7 +30,9 @@ runCommand "${rustc-unwrapped.pname}-wrapper-${rustc-unwrapped.version}" {
|
||||||
};
|
};
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit (rustc-unwrapped) pname version src llvm llvmPackages;
|
inherit (rustc-unwrapped)
|
||||||
|
pname version src llvm llvmPackages
|
||||||
|
tier1TargetPlatforms targetPlatforms badTargetPlatforms;
|
||||||
unwrapped = rustc-unwrapped;
|
unwrapped = rustc-unwrapped;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,37 @@ rec {
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
|
|
||||||
setupHooks = ./setup-hook.sh;
|
setupHooks = ./setup-hook.sh;
|
||||||
|
|
||||||
|
passthru = rec {
|
||||||
|
tier1TargetPlatforms = [
|
||||||
|
# Platforms with host tools from
|
||||||
|
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
|
||||||
|
"x86_64-darwin" "i686-darwin" "aarch64-darwin"
|
||||||
|
"i686-freebsd" "x86_64-freebsd"
|
||||||
|
"x86_64-solaris"
|
||||||
|
"aarch64-linux" "armv6l-linux" "armv7l-linux" "i686-linux"
|
||||||
|
"loongarch64-linux" "powerpc64-linux" "powerpc64le-linux"
|
||||||
|
"riscv64-linux" "s390x-linux" "x86_64-linux"
|
||||||
|
"aarch64-netbsd" "armv7l-netbsd" "i686-netbsd" "powerpc-netbsd"
|
||||||
|
"x86_64-netbsd"
|
||||||
|
"i686-openbsd" "x86_64-openbsd"
|
||||||
|
"i686-windows" "x86_64-windows"
|
||||||
|
];
|
||||||
|
targetPlatforms = tier1TargetPlatforms ++ [
|
||||||
|
# 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"
|
||||||
|
];
|
||||||
|
badTargetPlatforms = [
|
||||||
|
# Rust is currently unable to target the n32 ABI
|
||||||
|
lib.systems.inspect.patterns.isMips64n32
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
rustc = wrapRustc rustc-unwrapped;
|
rustc = wrapRustc rustc-unwrapped;
|
||||||
|
|
|
@ -303,6 +303,7 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
passthru = {
|
passthru = {
|
||||||
llvm = llvmShared;
|
llvm = llvmShared;
|
||||||
inherit llvmPackages;
|
inherit llvmPackages;
|
||||||
|
inherit (rustc) tier1TargetPlatforms targetPlatforms badTargetPlatforms;
|
||||||
tests = {
|
tests = {
|
||||||
inherit fd ripgrep wezterm;
|
inherit fd ripgrep wezterm;
|
||||||
} // lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit firefox thunderbird; };
|
} // lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit firefox thunderbird; };
|
||||||
|
@ -313,19 +314,9 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||||
description = "Safe, concurrent, practical language";
|
description = "Safe, concurrent, practical language";
|
||||||
maintainers = with maintainers; [ havvy ] ++ teams.rust.members;
|
maintainers = with maintainers; [ havvy ] ++ teams.rust.members;
|
||||||
license = [ licenses.mit licenses.asl20 ];
|
license = [ licenses.mit licenses.asl20 ];
|
||||||
platforms = [
|
platforms = rustc.tier1TargetPlatforms;
|
||||||
# Platforms with host tools from
|
# If rustc can't target a platform, we also can't build rustc for
|
||||||
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
|
# that platform.
|
||||||
"x86_64-darwin" "i686-darwin" "aarch64-darwin"
|
badPlatforms = rustc.badTargetPlatforms;
|
||||||
"i686-freebsd" "x86_64-freebsd"
|
|
||||||
"x86_64-solaris"
|
|
||||||
"aarch64-linux" "armv6l-linux" "armv7l-linux" "i686-linux"
|
|
||||||
"loongarch64-linux" "powerpc64-linux" "powerpc64le-linux"
|
|
||||||
"riscv64-linux" "s390x-linux" "x86_64-linux"
|
|
||||||
"aarch64-netbsd" "armv7l-netbsd" "i686-netbsd" "powerpc-netbsd"
|
|
||||||
"x86_64-netbsd"
|
|
||||||
"i686-openbsd" "x86_64-openbsd"
|
|
||||||
"i686-windows" "x86_64-windows"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue