Cherry pick changes from ce3abc5801.

Fix stage 2 builds with a custom libdir.

When copying libstd for the stage 2 compiler, the builder ignores the
configured libdir/libdir_relative configuration parameters.  This causes
the compiler to fail to find libstd, which cause any tools built with the
stage 2 compiler to fail.

To fix this, make the copy steps of rustbuild aware of the libdir_relative
parameter when the stage >= 2.  Also update the dist target to be aware of
the new location of libstd.
This commit is contained in:
Mark Simulacrum 2017-07-07 23:00:38 -04:00
parent a1fa2681cf
commit c7435b52a9

View File

@ -192,8 +192,13 @@ impl<'a> Builder<'a> {
impl<'a> Step<'a> for Libdir<'a> {
type Output = PathBuf;
fn run(self, builder: &Builder) -> PathBuf {
let sysroot = builder.sysroot(self.compiler)
.join("lib").join("rustlib").join(self.target).join("lib");
let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() {
builder.build.config.libdir_relative.cloned().unwrap()
} else {
PathBuf::from("lib")
};
let sysroot = builder.sysroot(self.compiler).join(lib)
.join("rustlib").join(self.target).join("lib");
let _ = fs::remove_dir_all(&sysroot);
t!(fs::create_dir_all(&sysroot));
sysroot