about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-12-20 11:16:35 -0800
committerAlex Crichton <alex@alexcrichton.com>2016-12-20 12:59:03 -0800
commit08741494dbe847c6449ba16940310f22ca2264f6 (patch)
tree1899041170d55d86ef0b01b29990133dd264e55c
parentadfafffce8fda1c91c302a979bed7c71d3cb15aa (diff)
parent228e495e7f7fb89ca4047847a5118c5e224a0958 (diff)
downloadrust-08741494dbe847c6449ba16940310f22ca2264f6.tar.gz
rust-08741494dbe847c6449ba16940310f22ca2264f6.zip
Rollup merge of #38388 - redox-os:config_toml_prefix, r=alexcrichton
Add prefix to config.toml

This allows `rustbuild` to be used to install to a prefix.
```toml
[build]
prefix = "/path/to/install"
```
For example, the following `config.toml` will cause `x.py dist --install` to install to `/path/to/install`
-rw-r--r--src/bootstrap/config.rs12
-rw-r--r--src/bootstrap/config.toml.example8
2 files changed, 20 insertions, 0 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index f267f60d814..6b86e537b7d 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -113,6 +113,7 @@ pub struct Target {
 #[derive(RustcDecodable, Default)]
 struct TomlConfig {
     build: Option<Build>,
+    install: Option<Install>,
     llvm: Option<Llvm>,
     rust: Option<Rust>,
     target: Option<HashMap<String, TomlTarget>>,
@@ -135,6 +136,12 @@ struct Build {
     python: Option<String>,
 }
 
+/// TOML representation of various global install decisions.
+#[derive(RustcDecodable, Default, Clone)]
+struct Install {
+    prefix: Option<String>,
+}
+
 /// TOML representation of how the LLVM build is configured.
 #[derive(RustcDecodable, Default)]
 struct Llvm {
@@ -258,6 +265,10 @@ impl Config {
         set(&mut config.submodules, build.submodules);
         set(&mut config.vendor, build.vendor);
 
+        if let Some(ref install) = toml.install {
+            config.prefix = install.prefix.clone();
+        }
+
         if let Some(ref llvm) = toml.llvm {
             match llvm.ccache {
                 Some(StringOrBool::String(ref s)) => {
@@ -275,6 +286,7 @@ impl Config {
             set(&mut config.llvm_version_check, llvm.version_check);
             set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
         }
+
         if let Some(ref rust) = toml.rust {
             set(&mut config.rust_debug_assertions, rust.debug_assertions);
             set(&mut config.rust_debuginfo, rust.debuginfo);
diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example
index 9e50e71bf7d..5fc095137c7 100644
--- a/src/bootstrap/config.toml.example
+++ b/src/bootstrap/config.toml.example
@@ -101,6 +101,14 @@
 #vendor = false
 
 # =============================================================================
+# General install configuration options
+# =============================================================================
+[install]
+
+# Instead of installing to /usr/local, install to this path instead.
+#prefix = "/path/to/install"
+
+# =============================================================================
 # Options for compiling Rust code itself
 # =============================================================================
 [rust]