gst_all_1.gstreamer: disable Rust if unavailable (#338999)

This commit is contained in:
Emily 2024-09-04 16:12:25 +01:00 committed by GitHub
commit a1dbc04bb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 48 additions and 32 deletions

View File

@ -151,23 +151,10 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg
strictDeps = true;
meta = meta // {
badPlatforms = meta.badPlatforms or [] ++ [
# Rust is currently unable to target the n32 ABI
lib.systems.inspect.patterns.isMips64n32
];
} // lib.optionalAttrs (rustc.meta ? platforms) {
badPlatforms = meta.badPlatforms or [] ++ rustc.badTargetPlatforms;
# 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"
]);
rustc.targetPlatforms;
};
})

View File

@ -30,7 +30,9 @@ runCommand "${rustc-unwrapped.pname}-wrapper-${rustc-unwrapped.version}" {
};
passthru = {
inherit (rustc-unwrapped) pname version src llvm llvmPackages;
inherit (rustc-unwrapped)
pname version src llvm llvmPackages
tier1TargetPlatforms targetPlatforms badTargetPlatforms;
unwrapped = rustc-unwrapped;
};

View File

@ -61,6 +61,37 @@ rec {
dontStrip = true;
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;

View File

@ -303,6 +303,7 @@ in stdenv.mkDerivation (finalAttrs: {
passthru = {
llvm = llvmShared;
inherit llvmPackages;
inherit (rustc) tier1TargetPlatforms targetPlatforms badTargetPlatforms;
tests = {
inherit fd ripgrep wezterm;
} // lib.optionalAttrs stdenv.hostPlatform.isLinux { inherit firefox thunderbird; };
@ -313,19 +314,9 @@ in stdenv.mkDerivation (finalAttrs: {
description = "Safe, concurrent, practical language";
maintainers = with maintainers; [ havvy ] ++ teams.rust.members;
license = [ licenses.mit licenses.asl20 ];
platforms = [
# 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"
];
platforms = rustc.tier1TargetPlatforms;
# If rustc can't target a platform, we also can't build rustc for
# that platform.
badPlatforms = rustc.badTargetPlatforms;
};
})

View File

@ -15,8 +15,11 @@
, lib
, Cocoa
, CoreServices
, rustc
, testers
, rustc
, withRust ?
lib.any (lib.meta.platformMatch stdenv.hostPlatform) rustc.targetPlatforms &&
lib.all (p: !lib.meta.platformMatch stdenv.hostPlatform p) rustc.badTargetPlatforms
, gobject-introspection
, buildPackages
, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
@ -63,11 +66,12 @@ stdenv.mkDerivation (finalAttrs: {
makeWrapper
glib
bash-completion
rustc
] ++ lib.optionals stdenv.isLinux [
libcap # for setcap binary
] ++ lib.optionals withIntrospection [
gobject-introspection
] ++ lib.optionals withRust [
rustc
] ++ lib.optionals enableDocumentation [
hotdoc
];
@ -92,6 +96,7 @@ stdenv.mkDerivation (finalAttrs: {
mesonFlags = [
"-Ddbghelp=disabled" # not needed as we already provide libunwind and libdw, and dbghelp is a fallback to those
"-Dexamples=disabled" # requires many dependencies and probably not useful for our users
(lib.mesonEnable "ptp-helper" withRust)
(lib.mesonEnable "introspection" withIntrospection)
(lib.mesonEnable "doc" enableDocumentation)
(lib.mesonEnable "libunwind" withLibunwind)