Skip to content

Commit 0874149

Browse files
committed
Rollup merge of rust-lang#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`
2 parents adfafff + 228e495 commit 0874149

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/bootstrap/config.rs

+12
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ pub struct Target {
113113
#[derive(RustcDecodable, Default)]
114114
struct TomlConfig {
115115
build: Option<Build>,
116+
install: Option<Install>,
116117
llvm: Option<Llvm>,
117118
rust: Option<Rust>,
118119
target: Option<HashMap<String, TomlTarget>>,
@@ -135,6 +136,12 @@ struct Build {
135136
python: Option<String>,
136137
}
137138

139+
/// TOML representation of various global install decisions.
140+
#[derive(RustcDecodable, Default, Clone)]
141+
struct Install {
142+
prefix: Option<String>,
143+
}
144+
138145
/// TOML representation of how the LLVM build is configured.
139146
#[derive(RustcDecodable, Default)]
140147
struct Llvm {
@@ -258,6 +265,10 @@ impl Config {
258265
set(&mut config.submodules, build.submodules);
259266
set(&mut config.vendor, build.vendor);
260267

268+
if let Some(ref install) = toml.install {
269+
config.prefix = install.prefix.clone();
270+
}
271+
261272
if let Some(ref llvm) = toml.llvm {
262273
match llvm.ccache {
263274
Some(StringOrBool::String(ref s)) => {
@@ -275,6 +286,7 @@ impl Config {
275286
set(&mut config.llvm_version_check, llvm.version_check);
276287
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
277288
}
289+
278290
if let Some(ref rust) = toml.rust {
279291
set(&mut config.rust_debug_assertions, rust.debug_assertions);
280292
set(&mut config.rust_debuginfo, rust.debuginfo);

src/bootstrap/config.toml.example

+8
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@
100100
# Indicate whether the vendored sources are used for Rust dependencies or not
101101
#vendor = false
102102

103+
# =============================================================================
104+
# General install configuration options
105+
# =============================================================================
106+
[install]
107+
108+
# Instead of installing to /usr/local, install to this path instead.
109+
#prefix = "/path/to/install"
110+
103111
# =============================================================================
104112
# Options for compiling Rust code itself
105113
# =============================================================================

0 commit comments

Comments
 (0)