Install docs, std and rustc using results from dist.
This commit is contained in:
parent
e6985b2a6d
commit
a580f8f80d
@ -27,7 +27,7 @@ use {Build, Compiler};
|
|||||||
use util::{cp_r, libdir, is_dylib, cp_filtered, copy};
|
use util::{cp_r, libdir, is_dylib, cp_filtered, copy};
|
||||||
use regex::{RegexSet, quote};
|
use regex::{RegexSet, quote};
|
||||||
|
|
||||||
fn package_vers(build: &Build) -> &str {
|
pub fn package_vers(build: &Build) -> &str {
|
||||||
match &build.config.channel[..] {
|
match &build.config.channel[..] {
|
||||||
"stable" => &build.release,
|
"stable" => &build.release,
|
||||||
"beta" => "beta",
|
"beta" => "beta",
|
||||||
@ -40,7 +40,7 @@ fn distdir(build: &Build) -> PathBuf {
|
|||||||
build.out.join("dist")
|
build.out.join("dist")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tmpdir(build: &Build) -> PathBuf {
|
pub fn tmpdir(build: &Build) -> PathBuf {
|
||||||
build.out.join("tmp/dist")
|
build.out.join("tmp/dist")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ fn chmod(_path: &Path, _perms: u32) {}
|
|||||||
|
|
||||||
// We have to run a few shell scripts, which choke quite a bit on both `\`
|
// We have to run a few shell scripts, which choke quite a bit on both `\`
|
||||||
// characters and on `C:\` paths, so normalize both of them away.
|
// characters and on `C:\` paths, so normalize both of them away.
|
||||||
fn sanitize_sh(path: &Path) -> String {
|
pub fn sanitize_sh(path: &Path) -> String {
|
||||||
let path = path.to_str().unwrap().replace("\\", "/");
|
let path = path.to_str().unwrap().replace("\\", "/");
|
||||||
return change_drive(&path).unwrap_or(path);
|
return change_drive(&path).unwrap_or(path);
|
||||||
|
|
||||||
|
@ -13,10 +13,36 @@
|
|||||||
//! This module is responsible for installing the standard library,
|
//! This module is responsible for installing the standard library,
|
||||||
//! compiler, and documentation.
|
//! compiler, and documentation.
|
||||||
|
|
||||||
|
use std::fs;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
use Build;
|
use Build;
|
||||||
|
use dist::{package_vers, sanitize_sh, tmpdir};
|
||||||
|
|
||||||
/// Installs everything.
|
/// Installs everything.
|
||||||
pub fn install(_: &Build, stage: u32, host: &str) {
|
pub fn install(build: &Build, stage: u32, host: &str) {
|
||||||
println!("Install everything stage{} ({})", stage, host);
|
let prefix = build.config.prefix.as_ref().clone().map(|x| Path::new(x))
|
||||||
println!("Note: install currently does nothing.");
|
.unwrap_or(Path::new("/usr/local"));
|
||||||
|
let empty_dir = build.out.join("tmp/empty_dir");
|
||||||
|
t!(fs::create_dir_all(&empty_dir));
|
||||||
|
if build.config.docs {
|
||||||
|
install_sh(&build, "docs", "rust-docs", stage, host, prefix, &empty_dir);
|
||||||
|
}
|
||||||
|
install_sh(&build, "std", "rust-std", stage, host, prefix, &empty_dir);
|
||||||
|
install_sh(&build, "rustc", "rustc", stage, host, prefix, &empty_dir);
|
||||||
|
t!(fs::remove_dir_all(&empty_dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn install_sh(build: &Build, package: &str, name: &str, stage: u32, host: &str,
|
||||||
|
prefix: &Path, empty_dir: &Path) {
|
||||||
|
println!("Install {} stage{} ({})", package, stage, host);
|
||||||
|
let package_name = format!("{}-{}-{}", name, package_vers(build), host);
|
||||||
|
|
||||||
|
let mut cmd = Command::new("sh");
|
||||||
|
cmd.current_dir(empty_dir)
|
||||||
|
.arg(sanitize_sh(&tmpdir(build).join(&package_name).join("install.sh")))
|
||||||
|
.arg(format!("--prefix={}", sanitize_sh(&prefix)))
|
||||||
|
.arg("--disable-ldconfig");
|
||||||
|
build.run(&mut cmd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user