@@ -3467,101 +3467,161 @@ impl Step for Distcheck {
34673467 // local source code, built artifacts or configuration by accident
34683468 let root_dir = std:: env:: temp_dir ( ) . join ( "distcheck" ) ;
34693469
3470- distcheck_plain_source_tarball ( builder, & root_dir. join ( "distcheck-rustc-src" ) ) ;
3471- distcheck_rust_src ( builder, & root_dir. join ( "distcheck-rust-src" ) ) ;
3472- distcheck_rustc_dev ( builder, & root_dir. join ( "distcheck-rustc-dev" ) ) ;
3470+ distcheck_rust_dev_ci_llvm ( builder, & root_dir. join ( "distcheck_rust_dev" ) ) ;
3471+ // distcheck_plain_source_tarball(builder, &root_dir.join("distcheck-rustc-src"));
3472+ // distcheck_rust_src(builder, &root_dir.join("distcheck-rust-src"));
3473+ // distcheck_rustc_dev(builder, &root_dir.join("distcheck-rustc-dev"));
34733474 }
34743475}
34753476
3476- /// Check that we can build some basic things from the plain source tarball
3477- fn distcheck_plain_source_tarball ( builder : & Builder < ' _ > , plain_src_dir : & Path ) {
3478- builder. info ( "Distcheck plain source tarball" ) ;
3479- let plain_src_tarball = builder. ensure ( dist:: PlainSourceTarball ) ;
3480- builder. clear_dir ( plain_src_dir) ;
3477+ fn distcheck_rust_dev_ci_llvm ( builder : & Builder < ' _ > , dir : & Path ) {
3478+ builder. info ( "Distcheck rust dev" ) ;
3479+ let Some ( rust_dev) = builder. ensure ( dist:: RustDev { target : builder. host_target } ) else {
3480+ return ;
3481+ } ;
3482+ builder. clear_dir ( dir) ;
34813483
3482- let configure_args: Vec < String > = std:: env:: var ( "DISTCHECK_CONFIGURE_ARGS" )
3483- . map ( |args| args. split ( " " ) . map ( |s| s. to_string ( ) ) . collect :: < Vec < String > > ( ) )
3484- . unwrap_or_default ( ) ;
3484+ let ci_llvm_dir = dir. join ( "ci-llvm" ) ;
3485+ builder. clear_dir ( & ci_llvm_dir) ;
34853486
34863487 command ( "tar" )
34873488 . arg ( "-xf" )
3488- . arg ( plain_src_tarball . tarball ( ) )
3489+ . arg ( rust_dev . tarball ( ) )
34893490 . arg ( "--strip-components=1" )
3490- . current_dir ( plain_src_dir)
3491- . run ( builder) ;
3492- command ( "./configure" )
3493- . arg ( "--set" )
3494- . arg ( "rust.omit-git-hash=false" )
3495- . arg ( "--set" )
3496- . arg ( "rust.remap-debuginfo=false" )
3497- . args ( & configure_args)
3498- . arg ( "--enable-vendor" )
3499- . current_dir ( plain_src_dir)
3500- . run ( builder) ;
3501- command ( helpers:: make ( & builder. config . host_target . triple ) )
3502- . arg ( "check" )
3503- // Do not run the build as if we were in CI, otherwise git would be assumed to be
3504- // present, but we build from a tarball here
3505- . env ( "GITHUB_ACTIONS" , "0" )
3506- . current_dir ( plain_src_dir)
3491+ . current_dir ( & ci_llvm_dir)
35073492 . run ( builder) ;
3508- // Mitigate pressure on small-capacity disks.
3509- builder. remove_dir ( plain_src_dir) ;
3510- }
35113493
3512- /// Check that rust-src has all of libstd's dependencies
3513- fn distcheck_rust_src ( builder : & Builder < ' _ > , src_dir : & Path ) {
3514- builder. info ( "Distcheck rust-src" ) ;
3515- let src_tarball = builder. ensure ( dist:: Src ) ;
3516- builder. clear_dir ( src_dir) ;
3494+ let llvm_config = ci_llvm_dir
3495+ . join ( "rust-dev" )
3496+ . join ( "bin" )
3497+ . join ( helpers:: exe ( "llvm-config" , builder. host_target ) ) ;
3498+
3499+ let plain_source_dir = dir. join ( "plain_source_dir" ) ;
3500+ let plain_src_tarball = builder. ensure ( dist:: PlainSourceTarball ) ;
3501+ builder. clear_dir ( & plain_source_dir) ;
35173502
35183503 command ( "tar" )
35193504 . arg ( "-xf" )
3520- . arg ( src_tarball . tarball ( ) )
3505+ . arg ( plain_src_tarball . tarball ( ) )
35213506 . arg ( "--strip-components=1" )
3522- . current_dir ( src_dir )
3507+ . current_dir ( & plain_source_dir )
35233508 . run ( builder) ;
35243509
3525- let toml = src_dir. join ( "rust-src/lib/rustlib/src/rust/library/std/Cargo.toml" ) ;
3526- command ( & builder. initial_cargo )
3527- // Will read the libstd Cargo.toml
3528- // which uses the unstable `public-dependency` feature.
3529- . env ( "RUSTC_BOOTSTRAP" , "1" )
3530- . arg ( "generate-lockfile" )
3531- . arg ( "--manifest-path" )
3532- . arg ( & toml)
3533- . current_dir ( src_dir)
3510+ command ( "./configure" )
3511+ . arg ( "--set" )
3512+ . arg ( "rust.omit-git-hash=false" )
3513+ . arg ( "--set" )
3514+ . arg ( "rust.remap-debuginfo=false" )
3515+ . arg ( "--set" )
3516+ . arg ( format ! ( "target.{}.llvm-config={}" , builder. host_target. triple, llvm_config. display( ) ) )
3517+ . arg ( "--set" )
3518+ . arg ( "llvm.link-shared=true" )
3519+ . arg ( "--enable-vendor" )
3520+ . current_dir ( & plain_source_dir)
35343521 . run ( builder) ;
3535- // Mitigate pressure on small-capacity disks.
3536- builder. remove_dir ( src_dir) ;
3537- }
35383522
3539- /// Check that rustc-dev's compiler crate source code can be loaded with `cargo metadata`
3540- fn distcheck_rustc_dev ( builder : & Builder < ' _ > , dir : & Path ) {
3541- builder. info ( "Distcheck rustc-dev" ) ;
3542- let tarball = builder. ensure ( dist:: RustcDev :: new ( builder, builder. host_target ) ) . unwrap ( ) ;
3543- builder. clear_dir ( dir) ;
3523+ let llvm_lib_dir = ci_llvm_dir. join ( "rust-dev" ) . join ( "lib" ) ;
3524+ let llvm_rpath = format ! ( "-Clink-arg=-Wl,-rpath,{}" , llvm_lib_dir. display( ) ) ;
35443525
3545- command ( "tar " )
3546- . arg ( "-xf " )
3547- . arg ( tarball . tarball ( ) )
3548- . arg ( "--strip-components=1" )
3549- . current_dir ( dir )
3526+ command ( "./x.py " )
3527+ . arg ( "build " )
3528+ . arg ( "library" )
3529+ . env ( "RUSTFLAGS_BOOTSTRAP" , llvm_rpath )
3530+ . current_dir ( & plain_source_dir )
35503531 . run ( builder) ;
35513532
3552- command ( & builder. initial_cargo )
3553- . arg ( "metadata" )
3554- . arg ( "--manifest-path" )
3555- . arg ( "rustc-dev/lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.toml" )
3556- . env ( "RUSTC_BOOTSTRAP" , "1" )
3557- // We might not have a globally available `rustc` binary on CI
3558- . env ( "RUSTC" , & builder. initial_rustc )
3559- . current_dir ( dir)
3560- . run ( builder) ;
3561- // Mitigate pressure on small-capacity disks.
35623533 builder. remove_dir ( dir) ;
35633534}
35643535
3536+ // /// Check that we can build some basic things from the plain source tarball
3537+ // fn distcheck_plain_source_tarball(builder: &Builder<'_>, plain_src_dir: &Path) {
3538+ // builder.info("Distcheck plain source tarball");
3539+ // let plain_src_tarball = builder.ensure(dist::PlainSourceTarball);
3540+ // builder.clear_dir(plain_src_dir);
3541+
3542+ // let configure_args: Vec<String> = std::env::var("DISTCHECK_CONFIGURE_ARGS")
3543+ // .map(|args| args.split(" ").map(|s| s.to_string()).collect::<Vec<String>>())
3544+ // .unwrap_or_default();
3545+
3546+ // command("tar")
3547+ // .arg("-xf")
3548+ // .arg(plain_src_tarball.tarball())
3549+ // .arg("--strip-components=1")
3550+ // .current_dir(plain_src_dir)
3551+ // .run(builder);
3552+ // command("./configure")
3553+ // .arg("--set")
3554+ // .arg("rust.omit-git-hash=false")
3555+ // .arg("--set")
3556+ // .arg("rust.remap-debuginfo=false")
3557+ // .args(&configure_args)
3558+ // .arg("--enable-vendor")
3559+ // .current_dir(plain_src_dir)
3560+ // .run(builder);
3561+ // command(helpers::make(&builder.config.host_target.triple))
3562+ // .arg("check")
3563+ // // Do not run the build as if we were in CI, otherwise git would be assumed to be
3564+ // // present, but we build from a tarball here
3565+ // .env("GITHUB_ACTIONS", "0")
3566+ // .current_dir(plain_src_dir)
3567+ // .run(builder);
3568+ // // Mitigate pressure on small-capacity disks.
3569+ // builder.remove_dir(plain_src_dir);
3570+ // }
3571+
3572+ // /// Check that rust-src has all of libstd's dependencies
3573+ // fn distcheck_rust_src(builder: &Builder<'_>, src_dir: &Path) {
3574+ // builder.info("Distcheck rust-src");
3575+ // let src_tarball = builder.ensure(dist::Src);
3576+ // builder.clear_dir(src_dir);
3577+
3578+ // command("tar")
3579+ // .arg("-xf")
3580+ // .arg(src_tarball.tarball())
3581+ // .arg("--strip-components=1")
3582+ // .current_dir(src_dir)
3583+ // .run(builder);
3584+
3585+ // let toml = src_dir.join("rust-src/lib/rustlib/src/rust/library/std/Cargo.toml");
3586+ // command(&builder.initial_cargo)
3587+ // // Will read the libstd Cargo.toml
3588+ // // which uses the unstable `public-dependency` feature.
3589+ // .env("RUSTC_BOOTSTRAP", "1")
3590+ // .arg("generate-lockfile")
3591+ // .arg("--manifest-path")
3592+ // .arg(&toml)
3593+ // .current_dir(src_dir)
3594+ // .run(builder);
3595+ // // Mitigate pressure on small-capacity disks.
3596+ // builder.remove_dir(src_dir);
3597+ // }
3598+
3599+ // /// Check that rustc-dev's compiler crate source code can be loaded with `cargo metadata`
3600+ // fn distcheck_rustc_dev(builder: &Builder<'_>, dir: &Path) {
3601+ // builder.info("Distcheck rustc-dev");
3602+ // let tarball = builder.ensure(dist::RustcDev::new(builder, builder.host_target)).unwrap();
3603+ // builder.clear_dir(dir);
3604+
3605+ // command("tar")
3606+ // .arg("-xf")
3607+ // .arg(tarball.tarball())
3608+ // .arg("--strip-components=1")
3609+ // .current_dir(dir)
3610+ // .run(builder);
3611+
3612+ // command(&builder.initial_cargo)
3613+ // .arg("metadata")
3614+ // .arg("--manifest-path")
3615+ // .arg("rustc-dev/lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.toml")
3616+ // .env("RUSTC_BOOTSTRAP", "1")
3617+ // // We might not have a globally available `rustc` binary on CI
3618+ // .env("RUSTC", &builder.initial_rustc)
3619+ // .current_dir(dir)
3620+ // .run(builder);
3621+ // // Mitigate pressure on small-capacity disks.
3622+ // builder.remove_dir(dir);
3623+ // }
3624+
35653625/// Runs unit tests in `bootstrap_test.py`, which test the Python parts of bootstrap.
35663626#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
35673627pub ( crate ) struct BootstrapPy ;
0 commit comments