diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-03-24 12:02:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-24 12:02:22 +0000 |
commit | 9e6337ddc0b57943480de4a38af806e8cbc2fc30 (patch) | |
tree | 248d4d196e193fe62ee49ce644f53e4956d5d163 /pkgs/build-support/rust | |
parent | dcc576176cd23d4ae1e37d31bba260484ecea05d (diff) | |
parent | f2ead7fbdadd373874be55fd27011899c54afe04 (diff) |
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support/rust')
4 files changed, 20 insertions, 7 deletions
diff --git a/pkgs/build-support/rust/build-rust-package/sysroot/default.nix b/pkgs/build-support/rust/build-rust-package/sysroot/default.nix index 1e0b901105cd8..a6d53056d9c7c 100644 --- a/pkgs/build-support/rust/build-rust-package/sysroot/default.nix +++ b/pkgs/build-support/rust/build-rust-package/sysroot/default.nix @@ -1,10 +1,10 @@ -{ stdenv, rust, rustPlatform, buildPackages }: +{ lib, stdenv, rust, rustPlatform, buildPackages }: { shortTarget, originalCargoToml, target, RUSTFLAGS }: let cargoSrc = import ../../sysroot/src.nix { - inherit stdenv rustPlatform buildPackages originalCargoToml; + inherit lib stdenv rustPlatform buildPackages originalCargoToml; }; in rustPlatform.buildRustPackage { inherit target RUSTFLAGS; @@ -14,7 +14,7 @@ in rustPlatform.buildRustPackage { RUSTC_BOOTSTRAP = 1; __internal_dontAddSysroot = true; - cargoSha256 = "0y6dqfhsgk00y3fv5bnjzk0s7i30nwqc1rp0xlrk83hkh80x81mw"; + cargoSha256 = "sha256-zgkwevitxsu1C4OgGTsqNSc0gDxaNXYK1WPbfER48d0="; doCheck = false; @@ -29,4 +29,7 @@ in rustPlatform.buildRustPackage { host=${rust.toRustTarget stdenv.buildPlatform} cp -r $RUST_SYSROOT/lib/rustlib/$host $out ''; + + # allows support for cross-compilation + meta.platforms = lib.platforms.all; } diff --git a/pkgs/build-support/rust/replace-workspace-values.py b/pkgs/build-support/rust/replace-workspace-values.py index fe54628833027..f5108f840b336 100644 --- a/pkgs/build-support/rust/replace-workspace-values.py +++ b/pkgs/build-support/rust/replace-workspace-values.py @@ -63,8 +63,16 @@ def replace_dependencies( def main() -> None: + top_cargo_toml = load_file(sys.argv[2]) + + if "workspace" not in top_cargo_toml: + # If top_cargo_toml is not a workspace manifest, then this script was probably + # ran on something that does not actually use workspace dependencies + print(f"{sys.argv[2]} is not a workspace manifest, doing nothing.") + return + crate_manifest = load_file(sys.argv[1]) - workspace_manifest = load_file(sys.argv[2])["workspace"] + workspace_manifest = top_cargo_toml["workspace"] if "workspace" in crate_manifest: return diff --git a/pkgs/build-support/rust/sysroot/Cargo.lock b/pkgs/build-support/rust/sysroot/Cargo.lock index 6ec6da6ae6e28..d9b0c25d02f2b 100644 --- a/pkgs/build-support/rust/sysroot/Cargo.lock +++ b/pkgs/build-support/rust/sysroot/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "alloc" version = "0.0.0" @@ -10,9 +12,9 @@ dependencies = [ [[package]] name = "compiler_builtins" -version = "0.1.52" +version = "0.1.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6591c2442ee984e2b264638a8b5e7ae44fd47b32d28e3a08e2e9c3cdb0c2fb0" +checksum = "f867ce54c09855ccd135ad4a50c777182a0c7af5ff20a8f537617bd648b10d50" dependencies = [ "rustc-std-workspace-core", ] diff --git a/pkgs/build-support/rust/sysroot/src.nix b/pkgs/build-support/rust/sysroot/src.nix index 3d11b62dd3156..664702e82c31b 100644 --- a/pkgs/build-support/rust/sysroot/src.nix +++ b/pkgs/build-support/rust/sysroot/src.nix @@ -19,7 +19,7 @@ stdenv.mkDerivation { + '' ${buildPackages.python3.withPackages (ps: with ps; [ toml ])}/bin/python3 ${./cargo.py} mkdir -p $out/src - touch $out/src/lib.rs + echo '#![no_std]' > $out/src/lib.rs cp Cargo.toml $out/Cargo.toml cp ${./Cargo.lock} $out/Cargo.lock ''; |