未验证 提交 61972e73 编写于 作者: K kennytm

Rollup merge of #47893 - alexcrichton:move-codegen-backends, r=alexcrichton

rustc: Move location of `codegen-backends` dir

Right now this directory is located under:

```
$sysroot/lib/rustlib/$target/lib/codegen-backends
```

but after seeing what we do in a few other places it seems that a more
appropriate location would be:

```
$sysroot/lib/rustlib/$target/codegen-backends
```

so this commit moves it!
...@@ -377,6 +377,11 @@ fn run(self, builder: &Builder) -> Interned<PathBuf> { ...@@ -377,6 +377,11 @@ fn run(self, builder: &Builder) -> Interned<PathBuf> {
self.ensure(Libdir { compiler, target }) self.ensure(Libdir { compiler, target })
} }
pub fn sysroot_codegen_backends(&self, compiler: Compiler) -> PathBuf {
self.sysroot_libdir(compiler, compiler.host)
.with_file_name("codegen-backends")
}
/// Returns the compiler's libdir where it stores the dynamic libraries that /// Returns the compiler's libdir where it stores the dynamic libraries that
/// it itself links against. /// it itself links against.
/// ///
......
...@@ -724,8 +724,7 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder, ...@@ -724,8 +724,7 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder,
// //
// Here we're looking for the output dylib of the `CodegenBackend` step and // Here we're looking for the output dylib of the `CodegenBackend` step and
// we're copying that into the `codegen-backends` folder. // we're copying that into the `codegen-backends` folder.
let libdir = builder.sysroot_libdir(target_compiler, target); let dst = builder.sysroot_codegen_backends(target_compiler);
let dst = libdir.join("codegen-backends");
t!(fs::create_dir_all(&dst)); t!(fs::create_dir_all(&dst));
for backend in builder.config.rust_codegen_backends.iter() { for backend in builder.config.rust_codegen_backends.iter() {
......
...@@ -435,11 +435,9 @@ fn prepare_image(builder: &Builder, compiler: Compiler, image: &Path) { ...@@ -435,11 +435,9 @@ fn prepare_image(builder: &Builder, compiler: Compiler, image: &Path) {
} }
// Copy over the codegen backends // Copy over the codegen backends
let backends_src = builder.sysroot_libdir(compiler, host) let backends_src = builder.sysroot_codegen_backends(compiler);
.join("codegen-backends"); let backends_rel = backends_src.strip_prefix(&src).unwrap();
let backends_dst = image.join("lib/rustlib") let backends_dst = image.join(&backends_rel);
.join(&*host)
.join("lib/codegen-backends");
t!(fs::create_dir_all(&backends_dst)); t!(fs::create_dir_all(&backends_dst));
cp_r(&backends_src, &backends_dst); cp_r(&backends_src, &backends_dst);
......
...@@ -289,7 +289,7 @@ fn get_trans_sysroot(backend_name: &str) -> fn() -> Box<TransCrate> { ...@@ -289,7 +289,7 @@ fn get_trans_sysroot(backend_name: &str) -> fn() -> Box<TransCrate> {
let sysroot = sysroot_candidates.iter() let sysroot = sysroot_candidates.iter()
.map(|sysroot| { .map(|sysroot| {
let libdir = filesearch::relative_target_lib_path(&sysroot, &target); let libdir = filesearch::relative_target_lib_path(&sysroot, &target);
sysroot.join(&libdir).join("codegen-backends") sysroot.join(libdir).with_file_name("codegen-backends")
}) })
.filter(|f| { .filter(|f| {
info!("codegen backend candidate: {}", f.display()); info!("codegen backend candidate: {}", f.display());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册