bootstrap: convert llvm-tools to use Tarball
This commit is contained in:
parent
ddf82636c6
commit
7be85701cd
@ -2431,56 +2431,26 @@ impl Step for LlvmTools {
|
||||
|
||||
builder.info(&format!("Dist LlvmTools ({})", target));
|
||||
let _time = timeit(builder);
|
||||
let src = builder.src.join("src/llvm-project/llvm");
|
||||
let name = pkgname(builder, "llvm-tools");
|
||||
|
||||
let tmp = tmpdir(builder);
|
||||
let image = tmp.join("llvm-tools-image");
|
||||
drop(fs::remove_dir_all(&image));
|
||||
let mut tarball = Tarball::new(builder, "llvm-tools", &target.triple);
|
||||
tarball.set_overlay(OverlayKind::LLVM);
|
||||
tarball.is_preview(true);
|
||||
|
||||
// Prepare the image directory
|
||||
let src_bindir = builder.llvm_out(target).join("bin");
|
||||
let dst_bindir = image.join("lib/rustlib").join(&*target.triple).join("bin");
|
||||
t!(fs::create_dir_all(&dst_bindir));
|
||||
let dst_bindir = format!("lib/rustlib/{}/bin", target.triple);
|
||||
for tool in LLVM_TOOLS {
|
||||
let exe = src_bindir.join(exe(tool, target));
|
||||
builder.install(&exe, &dst_bindir, 0o755);
|
||||
tarball.add_file(&exe, &dst_bindir, 0o755);
|
||||
}
|
||||
|
||||
// Copy libLLVM.so to the target lib dir as well, so the RPATH like
|
||||
// `$ORIGIN/../lib` can find it. It may also be used as a dependency
|
||||
// of `rustc-dev` to support the inherited `-lLLVM` when using the
|
||||
// compiler libraries.
|
||||
maybe_install_llvm_target(builder, target, &image);
|
||||
maybe_install_llvm_target(builder, target, tarball.image_dir());
|
||||
|
||||
// Prepare the overlay
|
||||
let overlay = tmp.join("llvm-tools-overlay");
|
||||
drop(fs::remove_dir_all(&overlay));
|
||||
builder.create_dir(&overlay);
|
||||
builder.install(&src.join("README.txt"), &overlay, 0o644);
|
||||
builder.install(&src.join("LICENSE.TXT"), &overlay, 0o644);
|
||||
builder.create(&overlay.join("version"), &builder.llvm_tools_vers());
|
||||
|
||||
// Generate the installer tarball
|
||||
let mut cmd = rust_installer(builder);
|
||||
cmd.arg("generate")
|
||||
.arg("--product-name=Rust")
|
||||
.arg("--rel-manifest-dir=rustlib")
|
||||
.arg("--success-message=llvm-tools-installed.")
|
||||
.arg("--image-dir")
|
||||
.arg(&image)
|
||||
.arg("--work-dir")
|
||||
.arg(&tmpdir(builder))
|
||||
.arg("--output-dir")
|
||||
.arg(&distdir(builder))
|
||||
.arg("--non-installed-overlay")
|
||||
.arg(&overlay)
|
||||
.arg(format!("--package-name={}-{}", name, target.triple))
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo")
|
||||
.arg("--component-name=llvm-tools-preview");
|
||||
|
||||
builder.run(&mut cmd);
|
||||
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target.triple)))
|
||||
Some(tarball.generate())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1069,10 +1069,6 @@ impl Build {
|
||||
self.package_vers(&self.version)
|
||||
}
|
||||
|
||||
fn llvm_tools_vers(&self) -> String {
|
||||
self.rust_version()
|
||||
}
|
||||
|
||||
fn llvm_link_tools_dynamically(&self, target: TargetSelection) -> bool {
|
||||
target.contains("linux-gnu") || target.contains("apple-darwin")
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ pub(crate) struct Tarball<'a> {
|
||||
image_dir: PathBuf,
|
||||
overlay_dir: PathBuf,
|
||||
work_dir: PathBuf,
|
||||
|
||||
is_preview: bool,
|
||||
}
|
||||
|
||||
impl<'a> Tarball<'a> {
|
||||
@ -58,6 +60,8 @@ impl<'a> Tarball<'a> {
|
||||
image_dir,
|
||||
overlay_dir,
|
||||
work_dir,
|
||||
|
||||
is_preview: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +69,10 @@ impl<'a> Tarball<'a> {
|
||||
self.overlay = overlay;
|
||||
}
|
||||
|
||||
pub(crate) fn is_preview(&mut self, is: bool) {
|
||||
self.is_preview = is;
|
||||
}
|
||||
|
||||
pub(crate) fn image_dir(&self) -> &Path {
|
||||
t!(std::fs::create_dir_all(&self.image_dir));
|
||||
&self.image_dir
|
||||
@ -98,6 +106,11 @@ impl<'a> Tarball<'a> {
|
||||
self.builder.install(&self.builder.src.join(file), &self.overlay_dir, 0o644);
|
||||
}
|
||||
|
||||
let mut component_name = self.component.clone();
|
||||
if self.is_preview {
|
||||
component_name.push_str("-preview");
|
||||
}
|
||||
|
||||
let distdir = crate::dist::distdir(self.builder);
|
||||
let mut cmd = self.builder.tool_cmd(crate::tool::Tool::RustInstaller);
|
||||
cmd.arg("generate")
|
||||
@ -114,7 +127,7 @@ impl<'a> Tarball<'a> {
|
||||
.arg(self.overlay_dir)
|
||||
.arg(format!("--package-name={}-{}", self.pkgname, self.target))
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo")
|
||||
.arg(format!("--component-name={}", self.component));
|
||||
.arg(format!("--component-name={}", component_name));
|
||||
self.builder.run(&mut cmd);
|
||||
|
||||
t!(std::fs::remove_dir_all(&self.temp_dir));
|
||||
|
Loading…
x
Reference in New Issue
Block a user