3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #215408 from astro/rust-sysroot

This commit is contained in:
zowoq 2023-03-24 15:44:59 +10:00 committed by GitHub
commit 6085b3b7f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View file

@ -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;
}

View file

@ -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",
]

View file

@ -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
'';