@@ -17,6 +17,9 @@ use anyhow::{bail, Context, Result};
17
17
use tempfile:: TempDir ;
18
18
use walkdir:: WalkDir ;
19
19
20
+ /// The name of the profile used for buliding the sysroot.
21
+ const SYSROOT_PROFILE : & str = "sysroot_release" ;
22
+
20
23
/// Returns where the given rustc stores its sysroot source code.
21
24
pub fn rustc_sysroot_src ( mut rustc : Command ) -> Result < PathBuf > {
22
25
let output = rustc
@@ -347,6 +350,23 @@ version = "0.0.0"
347
350
# empty dummy, just so that things are being built
348
351
path = "lib.rs"
349
352
353
+ [profile.{SYSROOT_PROFILE}]
354
+ # While it says "inherits", we override all settings.
355
+ # This is to insulate us from any custom release profile.
356
+ # The only reason we use inherits is because it's required.
357
+ inherits = "release"
358
+ opt-level = 3
359
+ debug = false
360
+ strip = "none"
361
+ split-debuginfo = 'off'
362
+ debug-assertions = false
363
+ overflow-checks = false
364
+ lto = false
365
+ panic = 'unwind'
366
+ incremental = false
367
+ codegen-units = 16
368
+ rpath = false
369
+
350
370
{crates}
351
371
352
372
{patches}
@@ -426,7 +446,8 @@ path = "lib.rs"
426
446
// Run cargo.
427
447
let mut cmd = cargo;
428
448
cmd. arg ( self . mode . as_str ( ) ) ;
429
- cmd. arg ( "--release" ) ;
449
+ cmd. arg ( "--profile" ) ;
450
+ cmd. arg ( "sysroot_release" ) ;
430
451
cmd. arg ( "--manifest-path" ) ;
431
452
cmd. arg ( & manifest_file) ;
432
453
cmd. arg ( "--target" ) ;
@@ -458,7 +479,7 @@ path = "lib.rs"
458
479
TempDir :: new_in ( & self . sysroot_dir ) . context ( "failed to create staging dir" ) ?;
459
480
let out_dir = build_target_dir
460
481
. join ( & target_name)
461
- . join ( "release" )
482
+ . join ( SYSROOT_PROFILE )
462
483
. join ( "deps" ) ;
463
484
for entry in fs:: read_dir ( & out_dir) . context ( "failed to read cargo out dir" ) ? {
464
485
let entry = entry. context ( "failed to read cargo out dir entry" ) ?;
0 commit comments