|
| 1 | +From 1f0ded570575781c7e8dbd0d60c57a2ec72ec987 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Anhad Singh < [email protected]> |
| 3 | +Date: Wed, 18 Oct 2023 19:23:49 +1100 |
| 4 | +Subject: [PATCH] fix(bootstrap): build target in x.py and bootstrap |
| 5 | + |
| 6 | +Signed-off-by: Anhad Singh < [email protected]> |
| 7 | +--- |
| 8 | + src/bootstrap/bootstrap.py | 7 +++++-- |
| 9 | + src/bootstrap/src/core/builder.rs | 6 ++++-- |
| 10 | + 2 files changed, 9 insertions(+), 4 deletions(-) |
| 11 | + |
| 12 | +diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py |
| 13 | +index 1a1125a107f..3f3171a9ddf 100644 |
| 14 | +--- a/src/bootstrap/bootstrap.py |
| 15 | ++++ b/src/bootstrap/bootstrap.py |
| 16 | +@@ -881,7 +881,7 @@ class RustBuild(object): |
| 17 | + ... "debug", "bootstrap") |
| 18 | + True |
| 19 | + """ |
| 20 | +- return os.path.join(self.build_dir, "bootstrap", "debug", "bootstrap") |
| 21 | ++ return os.path.join(self.build_dir, "bootstrap", self.build, "debug", "bootstrap") |
| 22 | + |
| 23 | + def build_bootstrap(self): |
| 24 | + """Build bootstrap""" |
| 25 | +@@ -903,7 +903,7 @@ class RustBuild(object): |
| 26 | + build_dir = os.path.join(self.build_dir, "bootstrap") |
| 27 | + if self.clean and os.path.exists(build_dir): |
| 28 | + shutil.rmtree(build_dir) |
| 29 | +- # `CARGO_BUILD_TARGET` breaks bootstrap build. |
| 30 | ++ # `CARGO_BUILD_TARGET` and `build.target` breaks bootstrap build. |
| 31 | + # See also: <https://github.com/rust-lang/rust/issues/70208>. |
| 32 | + if "CARGO_BUILD_TARGET" in env: |
| 33 | + del env["CARGO_BUILD_TARGET"] |
| 34 | +@@ -987,6 +987,9 @@ class RustBuild(object): |
| 35 | + except KeyError: |
| 36 | + pass |
| 37 | + |
| 38 | ++ args.append("--target") |
| 39 | ++ args.append(self.build) |
| 40 | ++ |
| 41 | + return args |
| 42 | + |
| 43 | + def build_triple(self): |
| 44 | +diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs |
| 45 | +index 039a87e760d..cbbbce4f515 100644 |
| 46 | +--- a/src/bootstrap/src/core/builder.rs |
| 47 | ++++ b/src/bootstrap/src/core/builder.rs |
| 48 | +@@ -1587,6 +1587,8 @@ pub fn cargo( |
| 49 | + self.clear_if_dirty(&out_dir, &self.rustc(compiler)); |
| 50 | + } |
| 51 | + |
| 52 | ++ let artifact_dir = self.out.join("bootstrap/").join(self.build.build.triple).join("debug/"); |
| 53 | ++ |
| 54 | + // Customize the compiler we're running. Specify the compiler to cargo |
| 55 | + // as our shim and then pass it some various options used to configure |
| 56 | + // how the actual compiler itself is called. |
| 57 | +@@ -1599,7 +1601,7 @@ pub fn cargo( |
| 58 | + .env("RUSTC_STAGE", stage.to_string()) |
| 59 | + .env("RUSTC_SYSROOT", &sysroot) |
| 60 | + .env("RUSTC_LIBDIR", &libdir) |
| 61 | +- .env("RUSTDOC", self.bootstrap_out.join("rustdoc")) |
| 62 | ++ .env("RUSTDOC", artifact_dir.join("rustdoc")) |
| 63 | + .env( |
| 64 | + "RUSTDOC_REAL", |
| 65 | + if cmd == "doc" || cmd == "rustdoc" || (cmd == "test" && want_rustdoc) { |
| 66 | +@@ -1613,7 +1615,7 @@ pub fn cargo( |
| 67 | + // Clippy support is a hack and uses the default `cargo-clippy` in path. |
| 68 | + // Don't override RUSTC so that the `cargo-clippy` in path will be run. |
| 69 | + if cmd != "clippy" { |
| 70 | +- cargo.env("RUSTC", self.bootstrap_out.join("rustc")); |
| 71 | ++ cargo.env("RUSTC", artifact_dir.join("rustc")); |
| 72 | + } |
| 73 | + |
| 74 | + // Dealing with rpath here is a little special, so let's go into some |
| 75 | +-- |
| 76 | +2.42.0 |
| 77 | + |
0 commit comments