Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add llvm-tools to manifest #51728

Merged
merged 3 commits into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn pkgname(builder: &Builder, component: &str) -> String {
} else if component == "rustfmt" {
format!("{}-{}", component, builder.rustfmt_package_vers())
} else if component == "llvm-tools" {
format!("{}-{}", component, builder.llvm_tools_vers())
format!("{}-{}", component, builder.llvm_tools_package_vers())
} else {
assert!(component.starts_with("rust"));
format!("{}-{}", component, builder.rust_package_vers())
Expand Down Expand Up @@ -1303,6 +1303,7 @@ impl Step for Extended {
let cargo_installer = builder.ensure(Cargo { stage, target });
let rustfmt_installer = builder.ensure(Rustfmt { stage, target });
let rls_installer = builder.ensure(Rls { stage, target });
let llvm_tools_installer = builder.ensure(LlvmTools { stage, target });
let mingw_installer = builder.ensure(Mingw { host: target });
let analysis_installer = builder.ensure(Analysis {
compiler: builder.compiler(stage, self.host),
Expand Down Expand Up @@ -1340,6 +1341,7 @@ impl Step for Extended {
tarballs.push(cargo_installer);
tarballs.extend(rls_installer.clone());
tarballs.extend(rustfmt_installer.clone());
tarballs.extend(llvm_tools_installer.clone());
tarballs.push(analysis_installer);
tarballs.push(std_installer);
if builder.config.docs {
Expand Down Expand Up @@ -1740,7 +1742,7 @@ impl Step for HashSign {
cmd.arg(builder.package_vers(&builder.release_num("cargo")));
cmd.arg(builder.package_vers(&builder.release_num("rls")));
cmd.arg(builder.package_vers(&builder.release_num("rustfmt")));
cmd.arg(builder.llvm_tools_vers());
cmd.arg(builder.llvm_tools_package_vers());
cmd.arg(addr);

builder.create_dir(&distdir(builder));
Expand All @@ -1755,7 +1757,6 @@ impl Step for HashSign {
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct LlvmTools {
pub stage: u32,
pub compiler: Compiler,
pub target: Interned<String>,
}

Expand All @@ -1770,19 +1771,16 @@ impl Step for LlvmTools {
fn make_run(run: RunConfig) {
run.builder.ensure(LlvmTools {
stage: run.builder.top_stage,
compiler: run.builder.compiler(run.builder.top_stage, run.target),
target: run.target,
});
}

fn run(self, builder: &Builder) -> Option<PathBuf> {
let compiler = self.compiler;
let host = compiler.host;

let stage = self.stage;
let target = self.target;
assert!(builder.config.extended);

builder.info(&format!("Dist LlvmTools stage{} ({})", stage, host));
builder.info(&format!("Dist LlvmTools stage{} ({})", stage, target));
let src = builder.src.join("src/llvm");
let name = pkgname(builder, "llvm-tools");

Expand All @@ -1794,9 +1792,9 @@ impl Step for LlvmTools {
// Prepare the image directory
for tool in LLVM_TOOLS {
let exe = builder
.llvm_out(host)
.llvm_out(target)
.join("bin")
.join(exe(tool, &compiler.host));
.join(exe(tool, &target));
builder.install(&exe, &image.join("bin"), 0o755);
}

Expand All @@ -1806,6 +1804,7 @@ impl Step for LlvmTools {
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);
Expand All @@ -1817,12 +1816,12 @@ impl Step for LlvmTools {
.arg("--work-dir").arg(&tmpdir(builder))
.arg("--output-dir").arg(&distdir(builder))
.arg("--non-installed-overlay").arg(&overlay)
.arg(format!("--package-name={}-{}", name, host))
.arg(format!("--package-name={}-{}", name, target))
.arg("--legacy-manifest-dirs=rustlib,cargo")
.arg("--component-name=llvm-tools");


builder.run(&mut cmd);
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, host)))
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target)))
}
}
21 changes: 4 additions & 17 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,24 +973,11 @@ impl Build {
self.package_vers(&self.release_num("rustfmt"))
}

fn llvm_tools_vers(&self) -> String {
// japaric: should we use LLVM version here?
// let stdout = build_helper::output(
// Command::new(self.llvm_out(self.config.build).join("build/bin/llvm-size"))
// .arg("--version"),
// );

// for line in stdout.lines() {
// if line.contains("LLVM version") {
// if let Some(vers) = line.split_whitespace().nth(2) {
// return vers.to_string();
// }
// }
// }

// panic!("The output of $LLVM_TOOL has changed; \
// please fix `bootstrap::Build.llvm_tools_vers`");
fn llvm_tools_package_vers(&self) -> String {
self.package_vers(&self.rust_version())
}

fn llvm_tools_vers(&self) -> String {
self.rust_version()
}

Expand Down
25 changes: 24 additions & 1 deletion src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ struct Builder {
cargo_release: String,
rls_release: String,
rustfmt_release: String,
llvm_tools_release: String,

input: PathBuf,
output: PathBuf,
Expand All @@ -196,11 +197,13 @@ struct Builder {
cargo_version: Option<String>,
rls_version: Option<String>,
rustfmt_version: Option<String>,
llvm_tools_version: Option<String>,

rust_git_commit_hash: Option<String>,
cargo_git_commit_hash: Option<String>,
rls_git_commit_hash: Option<String>,
rustfmt_git_commit_hash: Option<String>,
llvm_tools_git_commit_hash: Option<String>,
}

fn main() {
Expand All @@ -212,7 +215,7 @@ fn main() {
let cargo_release = args.next().unwrap();
let rls_release = args.next().unwrap();
let rustfmt_release = args.next().unwrap();
let _llvm_tools_vers = args.next().unwrap(); // FIXME do something with it?
let llvm_tools_release = args.next().unwrap();
let s3_address = args.next().unwrap();
let mut passphrase = String::new();
t!(io::stdin().read_to_string(&mut passphrase));
Expand All @@ -222,6 +225,7 @@ fn main() {
cargo_release,
rls_release,
rustfmt_release,
llvm_tools_release,

input,
output,
Expand All @@ -234,11 +238,13 @@ fn main() {
cargo_version: None,
rls_version: None,
rustfmt_version: None,
llvm_tools_version: None,

rust_git_commit_hash: None,
cargo_git_commit_hash: None,
rls_git_commit_hash: None,
rustfmt_git_commit_hash: None,
llvm_tools_git_commit_hash: None,
}.build();
}

Expand All @@ -248,11 +254,14 @@ impl Builder {
self.cargo_version = self.version("cargo", "x86_64-unknown-linux-gnu");
self.rls_version = self.version("rls", "x86_64-unknown-linux-gnu");
self.rustfmt_version = self.version("rustfmt", "x86_64-unknown-linux-gnu");
self.llvm_tools_version = self.version("llvm-tools", "x86_64-unknown-linux-gnu");

self.rust_git_commit_hash = self.git_commit_hash("rust", "x86_64-unknown-linux-gnu");
self.cargo_git_commit_hash = self.git_commit_hash("cargo", "x86_64-unknown-linux-gnu");
self.rls_git_commit_hash = self.git_commit_hash("rls", "x86_64-unknown-linux-gnu");
self.rustfmt_git_commit_hash = self.git_commit_hash("rustfmt", "x86_64-unknown-linux-gnu");
self.llvm_tools_git_commit_hash = self.git_commit_hash("llvm-tools",
"x86_64-unknown-linux-gnu");

self.digest_and_sign();
let manifest = self.build_manifest();
Expand Down Expand Up @@ -289,9 +298,11 @@ impl Builder {
self.package("rls-preview", &mut manifest.pkg, HOSTS);
self.package("rustfmt-preview", &mut manifest.pkg, HOSTS);
self.package("rust-analysis", &mut manifest.pkg, TARGETS);
self.package("llvm-tools", &mut manifest.pkg, TARGETS);

let rls_present = manifest.pkg.contains_key("rls-preview");
let rustfmt_present = manifest.pkg.contains_key("rustfmt-preview");
let llvm_tools_present = manifest.pkg.contains_key("llvm-tools");

if rls_present {
manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() });
Expand Down Expand Up @@ -346,6 +357,12 @@ impl Builder {
target: host.to_string(),
});
}
if llvm_tools_present {
extensions.push(Component {
pkg: "llvm-tools".to_string(),
target: host.to_string(),
});
}
extensions.push(Component {
pkg: "rust-analysis".to_string(),
target: host.to_string(),
Expand Down Expand Up @@ -455,6 +472,8 @@ impl Builder {
format!("rls-{}-{}.tar.gz", self.rls_release, target)
} else if component == "rustfmt" || component == "rustfmt-preview" {
format!("rustfmt-{}-{}.tar.gz", self.rustfmt_release, target)
} else if component == "llvm_tools" {
format!("llvm-tools-{}-{}.tar.gz", self.llvm_tools_release, target)
} else {
format!("{}-{}-{}.tar.gz", component, self.rust_release, target)
}
Expand All @@ -467,6 +486,8 @@ impl Builder {
&self.rls_version
} else if component == "rustfmt" || component == "rustfmt-preview" {
&self.rustfmt_version
} else if component == "llvm-tools" {
&self.llvm_tools_version
} else {
&self.rust_version
}
Expand All @@ -479,6 +500,8 @@ impl Builder {
&self.rls_git_commit_hash
} else if component == "rustfmt" || component == "rustfmt-preview" {
&self.rustfmt_git_commit_hash
} else if component == "llvm-tools" {
&self.llvm_tools_git_commit_hash
} else {
&self.rust_git_commit_hash
}
Expand Down