pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
    println!("Building stage{} compiler artifacts ({} -> {})",
             compiler.stage, compiler.host, target);

    let out_dir = build.cargo_out(compiler, Mode::Librustc, target);
    build.clear_if_dirty(&out_dir, &libtest_stamp(build, compiler, target));

    let mut cargo = build.cargo(compiler, Mode::Librustc, target, "build");
    cargo.arg("--features").arg(build.rustc_features())
         .arg("--manifest-path")
         .arg(build.src.join("src/rustc/Cargo.toml"));

    // Set some configuration variables picked up by build scripts and
    // the compiler alike
    cargo.env("CFG_RELEASE", build.rust_release())
         .env("CFG_RELEASE_CHANNEL", &build.config.channel)
         .env("CFG_VERSION", build.rust_version())
         .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(PathBuf::new()));

    if compiler.stage == 0 {
        cargo.env("CFG_LIBDIR_RELATIVE", "lib");
    } else {
        let libdir_relative = build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib"));
        cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
    }

    // If we're not building a compiler with debugging information then remove
    // these two env vars which would be set otherwise.
    if build.config.rust_debuginfo_only_std {
        cargo.env_remove("RUSTC_DEBUGINFO");
        cargo.env_remove("RUSTC_DEBUGINFO_LINES");
    }

    if let Some(ref ver_date) = build.rust_info.commit_date() {
        cargo.env("CFG_VER_DATE", ver_date);
    }
    if let Some(ref ver_hash) = build.rust_info.sha() {
        cargo.env("CFG_VER_HASH", ver_hash);
    }
    if !build.unstable_features() {
        cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1");
    }
    // Flag that rust llvm is in use
    if build.is_rust_llvm(target) {
        cargo.env("LLVM_RUSTLLVM", "1");
    }
    cargo.env("LLVM_CONFIG", build.llvm_config(target));
    let target_config = build.config.target_config.get(target);
    if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
        cargo.env("CFG_LLVM_ROOT", s);
    }
    // Building with a static libstdc++ is only supported on linux right now,
    // not for MSVC or macOS
    if build.config.llvm_static_stdcpp &&
       !target.contains("windows") &&
       !target.contains("apple") {
        cargo.env("LLVM_STATIC_STDCPP",
                  compiler_file(build.cxx(target), "libstdc++.a"));
    }
    if build.config.llvm_link_shared {
        cargo.env("LLVM_LINK_SHARED", "1");
    }
    if let Some(ref s) = build.config.rustc_default_linker {
        cargo.env("CFG_DEFAULT_LINKER", s);
    }
    if let Some(ref s) = build.config.rustc_default_ar {
        cargo.env("CFG_DEFAULT_AR", s);
    }
    build.run(&mut cargo);
    update_mtime(build, &librustc_stamp(build, compiler, target));
}
/// Build the compiler.
///
/// This will build the compiler for a particular stage of the build using
/// the `compiler` targeting the `target` architecture. The artifacts
/// created will also be linked into the sysroot directory.
Build the compiler.
This will build the compiler for a particular stage of the build using
the `compiler` targeting the `target` architecture. The artifacts
created will also be linked into the sysroot directory.
Build the compiler . This will build the compiler for a particular stage of the build using the ` compiler ` targeting the ` target ` architecture . The artifacts created will also be linked into the sysroot directory .
pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
    println!("Building stage{} compiler artifacts ({} -> {})",
             compiler.stage, compiler.host, target);
    let out_dir = build.cargo_out(compiler, Mode::Librustc, target);
    build.clear_if_dirty(&out_dir, &libtest_stamp(build, compiler, target));
    let mut cargo = build.cargo(compiler, Mode::Librustc, target, "build");
    cargo.arg("--features").arg(build.rustc_features())
         .arg("--manifest-path")
         .arg(build.src.join("src/rustc/Cargo.toml"));
    // Set some configuration variables picked up by build scripts and
    // the compiler alike
    cargo.env("CFG_RELEASE", build.rust_release())
         .env("CFG_RELEASE_CHANNEL", &build.config.channel)
         .env("CFG_VERSION", build.rust_version())
         .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(PathBuf::new()));
    if compiler.stage == 0 {
        cargo.env("CFG_LIBDIR_RELATIVE", "lib");
    } else {
        let libdir_relative = build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib"));
        cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
    }
    // If we're not building a compiler with debugging information then remove
    // these two env vars which would be set otherwise.
    if build.config.rust_debuginfo_only_std {
        cargo.env_remove("RUSTC_DEBUGINFO");
        cargo.env_remove("RUSTC_DEBUGINFO_LINES");
    }
    if let Some(ref ver_date) = build.rust_info.commit_date() {
        cargo.env("CFG_VER_DATE", ver_date);
    }
    if let Some(ref ver_hash) = build.rust_info.sha() {
        cargo.env("CFG_VER_HASH", ver_hash);
    }
    if !build.unstable_features() {
        cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1");
    }
    // Flag that rust llvm is in use
    if build.is_rust_llvm(target) {
        cargo.env("LLVM_RUSTLLVM", "1");
    }
    cargo.env("LLVM_CONFIG", build.llvm_config(target));
    let target_config = build.config.target_config.get(target);
    if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
        cargo.env("CFG_LLVM_ROOT", s);
    }
    // Building with a static libstdc++ is only supported on linux right now,
    // not for MSVC or macOS
    if build.config.llvm_static_stdcpp &&
       !target.contains("windows") &&
       !target.contains("apple") {
        cargo.env("LLVM_STATIC_STDCPP",
                  compiler_file(build.cxx(target), "libstdc++.a"));
    }
    if build.config.llvm_link_shared {
        cargo.env("LLVM_LINK_SHARED", "1");
    }
    if let Some(ref s) = build.config.rustc_default_linker {
        cargo.env("CFG_DEFAULT_LINKER", s);
    }
    if let Some(ref s) = build.config.rustc_default_ar {
        cargo.env("CFG_DEFAULT_AR", s);
    }
    build.run(&mut cargo);
    update_mtime(build, &librustc_stamp(build, compiler, target));
}
pub fn rustc ( build : & Build , target : & str , compiler : & Compiler ) { println ! ( " " compiler stage compiler host target ) ; let out_dir = build . cargo_out ( compiler , Mode :: Librustc , target ) ; build . clear_if_dirty ( & out_dir , & libtest_stamp ( build , compiler , target ) ) ; let mut cargo = build . cargo ( compiler , Mode :: Librustc , target , " " ) ; cargo . arg ( " " ) . arg ( build . rustc_features ( ) ) . arg ( " " ) . arg ( build . src . join ( " " ) ) ; // Set some configuration variables picked up by build scripts and // the compiler alike cargo . env ( " " , build . rust_release ( ) ) . env ( " " , & build . config . channel ) . env ( " " , build . rust_version ( ) ) . env ( " " , build . config . prefix . clone ( ) . unwrap_or ( PathBuf :: new ( ) ) ) ; if compiler . stage == 0 { cargo . env ( " " , " " ) ; } else { let libdir_relative = build . config . libdir_relative . clone ( ) . unwrap_or ( PathBuf :: from ( " " ) ) ; cargo . env ( " " , libdir_relative ) ; } // If we're not building a compiler with debugging information then remove // these two env vars which would be set otherwise. if build . config . rust_debuginfo_only_std { cargo . env_remove ( " " ) ; cargo . env_remove ( " " ) ; } if let Some ( ref ver_date ) = build . rust_info . commit_date ( ) { cargo . env ( " " , ver_date ) ; } if let Some ( ref ver_hash ) = build . rust_info . sha ( ) { cargo . env ( " " , ver_hash ) ; } if ! build . unstable_features ( ) { cargo . env ( " " , " " ) ; } // Flag that rust llvm is in use if build . is_rust_llvm ( target ) { cargo . env ( " " , " " ) ; } cargo . env ( " " , build . llvm_config ( target ) ) ; let target_config = build . config . target_config . get ( target ) ; if let Some ( s ) = target_config . and_then ( | c | c . llvm_config . as_ref ( ) ) { cargo . env ( " " , s ) ; } // Building with a static libstdc++ is only supported on linux right now, // not for MSVC or macOS if build . config . llvm_static_stdcpp && ! target . contains ( " " ) && ! target . contains ( " " ) { cargo . env ( " " , compiler_file ( build . cxx ( target ) , " " ) ) ; } if build . config . llvm_link_shared { cargo . env ( " " , " " ) ; } if let Some ( ref s ) = build . config . rustc_default_linker { cargo . env ( " " , s ) ; } if let Some ( ref s ) = build . config . rustc_default_ar { cargo . env ( " " , s ) ; } build . run ( & mut cargo ) ; update_mtime ( build , & librustc_stamp ( build , compiler , target ) ) ; }
Build the compiler.
Build the compiler .
build
&Build
target
&str
compiler
&Compiler
build
&Build
target
&str
compiler
&Compiler