rustbuild: Restore Config.libdir_relative

This re-introduces a `Config.libdir_relative` field, now derived from
`libdir` and made relative to `prefix` if necessary.

This fixes a regression from #46592 when `--libdir` is given an absolute
path.  `Builder::sysroot_libdir` should always use a relative path so
its callers don't clobber system locations, and `librustc` also asserts
that `CFG_LIBDIR_RELATIVE` is really relative.
This commit is contained in:
Josh Stone
2018-02-19 14:05:21 -08:00
parent 27a046e933
commit 80970e6953
3 changed files with 20 additions and 3 deletions

View File

@@ -444,8 +444,8 @@ impl<'a> Builder<'a> {
fn run(self, builder: &Builder) -> Interned<PathBuf> {
let compiler = self.compiler;
let lib = if compiler.stage >= 1 && builder.build.config.libdir.is_some() {
builder.build.config.libdir.clone().unwrap()
let lib = if compiler.stage >= 1 && builder.build.config.libdir_relative.is_some() {
builder.build.config.libdir_relative.clone().unwrap()
} else {
PathBuf::from("lib")
};