Skip to content

Commit

Permalink
Auto merge of #49778 - tamird:install-relative-prefix, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
rustbuild: canonicalize prefix `install_sh`

Testing:
```
  $ git diff
  diff --git a/config.toml.example b/config.toml.example
  index 9dd3002506..b47bc490cd 100644
  --- a/config.toml.example
  +++ b/config.toml.example
  @@ -196,7 +196,7 @@
   [install]

   # Instead of installing to /usr/local, install to this path instead.
  -#prefix = "/usr/local"
  +prefix = "install-prefix"

   # Where to install system configuration files
   # If this is a relative path, it will get installed in `prefix` above
  $ mkdir install-prefix
  $ ./x.py install -i --stage 0 --config config.toml.example
  ...
  $ ls install-prefix/
  bin	lib	share
```

Closes #36989.

r? @Mark-Simulacrum
  • Loading branch information
bors committed Apr 9, 2018
2 parents 8ae79ef + 9487902 commit 561fb39
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bootstrap/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ fn install_sh(
let bindir_default = PathBuf::from("bin");
let libdir_default = PathBuf::from("lib");
let mandir_default = datadir_default.join("man");
let prefix = build.config.prefix.as_ref().unwrap_or(&prefix_default);
let prefix = build.config.prefix.as_ref().map_or(prefix_default, |p| {
fs::canonicalize(p).expect(&format!("could not canonicalize {}", p.display()))
});
let sysconfdir = build.config.sysconfdir.as_ref().unwrap_or(&sysconfdir_default);
let datadir = build.config.datadir.as_ref().unwrap_or(&datadir_default);
let docdir = build.config.docdir.as_ref().unwrap_or(&docdir_default);
Expand Down

0 comments on commit 561fb39

Please sign in to comment.