about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-05-29 12:19:38 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-06-13 16:39:59 +0000
commitd3da972441f6efd16c1b1aa5c2672cc218949bdb (patch)
treef2c40fec0a75ee9723fadb88d5394341c7a114ca
parent67f9fe6863cede6ca5f41b938e4f3188feb24c65 (diff)
downloadrust-d3da972441f6efd16c1b1aa5c2672cc218949bdb.tar.gz
rust-d3da972441f6efd16c1b1aa5c2672cc218949bdb.zip
Write stdlib workspace Cargo.toml directly in prepare.rs
-rw-r--r--build_sysroot/Cargo.toml26
-rw-r--r--build_system/prepare.rs33
2 files changed, 33 insertions, 26 deletions
diff --git a/build_sysroot/Cargo.toml b/build_sysroot/Cargo.toml
deleted file mode 100644
index 3e5d0c159f2..00000000000
--- a/build_sysroot/Cargo.toml
+++ /dev/null
@@ -1,26 +0,0 @@
-[workspace]
-members = ["./library/sysroot"]
-
-[patch.crates-io]
-rustc-std-workspace-core = { path = "./library/rustc-std-workspace-core" }
-rustc-std-workspace-alloc = { path = "./library/rustc-std-workspace-alloc" }
-rustc-std-workspace-std = { path = "./library/rustc-std-workspace-std" }
-
-[profile.dev]
-lto = "off"
-
-[profile.release]
-debug = true
-incremental = true
-lto = "off"
-
-# Mandatory for correctly compiling compiler-builtins
-[profile.dev.package.compiler_builtins]
-debug-assertions = false
-overflow-checks = false
-codegen-units = 10000
-
-[profile.release.package.compiler_builtins]
-debug-assertions = false
-overflow-checks = false
-codegen-units = 10000
diff --git a/build_system/prepare.rs b/build_system/prepare.rs
index 115575bff51..4f26cb5e85f 100644
--- a/build_system/prepare.rs
+++ b/build_system/prepare.rs
@@ -29,6 +29,39 @@ fn prepare_stdlib(dirs: &Dirs, rustc: &Path) {
     // FIXME ensure builds error out or update the copy if any of the files copied here change
     copy_dir_recursively(&ORIG_BUILD_SYSROOT.to_path(dirs), &STDLIB_SRC.to_path(dirs));
 
+    std::fs::write(
+        STDLIB_SRC.to_path(dirs).join("Cargo.toml"),
+        r#"
+[workspace]
+members = ["./library/sysroot"]
+
+[patch.crates-io]
+rustc-std-workspace-core = { path = "./library/rustc-std-workspace-core" }
+rustc-std-workspace-alloc = { path = "./library/rustc-std-workspace-alloc" }
+rustc-std-workspace-std = { path = "./library/rustc-std-workspace-std" }
+
+[profile.dev]
+lto = "off"
+
+[profile.release]
+debug = true
+incremental = true
+lto = "off"
+
+# Mandatory for correctly compiling compiler-builtins
+[profile.dev.package.compiler_builtins]
+debug-assertions = false
+overflow-checks = false
+codegen-units = 10000
+
+[profile.release.package.compiler_builtins]
+debug-assertions = false
+overflow-checks = false
+codegen-units = 10000
+"#,
+    )
+    .unwrap();
+
     let rustc_version = get_rustc_version(rustc);
     fs::write(SYSROOT_RUSTC_VERSION.to_path(dirs), &rustc_version).unwrap();
 }