Skip to content

Commit 0a014c6

Browse files
committed
Move prefix to [install] section
1 parent 58b94bd commit 0a014c6

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/bootstrap/config.rs

+12-2
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>>,
@@ -126,7 +127,6 @@ struct Build {
126127
target: Vec<String>,
127128
cargo: Option<String>,
128129
rustc: Option<String>,
129-
prefix: Option<String>,
130130
compiler_docs: Option<bool>,
131131
docs: Option<bool>,
132132
submodules: Option<bool>,
@@ -136,6 +136,12 @@ struct Build {
136136
python: Option<String>,
137137
}
138138

139+
/// TOML representation of various global install decisions.
140+
#[derive(RustcDecodable, Default, Clone)]
141+
struct Install {
142+
prefix: Option<String>,
143+
}
144+
139145
/// TOML representation of how the LLVM build is configured.
140146
#[derive(RustcDecodable, Default)]
141147
struct Llvm {
@@ -239,7 +245,6 @@ impl Config {
239245
}
240246
config.rustc = build.rustc.map(PathBuf::from);
241247
config.cargo = build.cargo.map(PathBuf::from);
242-
config.prefix = build.prefix;
243248
config.nodejs = build.nodejs.map(PathBuf::from);
244249
config.gdb = build.gdb.map(PathBuf::from);
245250
config.python = build.python.map(PathBuf::from);
@@ -248,6 +253,10 @@ impl Config {
248253
set(&mut config.submodules, build.submodules);
249254
set(&mut config.vendor, build.vendor);
250255

256+
if let Some(ref install) = toml.install {
257+
config.prefix = install.prefix.clone();
258+
}
259+
251260
if let Some(ref llvm) = toml.llvm {
252261
set(&mut config.ccache, llvm.ccache);
253262
set(&mut config.ninja, llvm.ninja);
@@ -257,6 +266,7 @@ impl Config {
257266
set(&mut config.llvm_version_check, llvm.version_check);
258267
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
259268
}
269+
260270
if let Some(ref rust) = toml.rust {
261271
set(&mut config.rust_debug_assertions, rust.debug_assertions);
262272
set(&mut config.rust_debuginfo, rust.debuginfo);

src/bootstrap/config.toml.example

+8-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@
7070
# specified, use this rustc binary instead as the stage0 snapshot compiler.
7171
#rustc = "/path/to/bin/rustc"
7272

73-
# Instead of installing to /usr/local, install to this path instead.
74-
#prefix = "/path/to/install"
75-
7673
# Flag to specify whether any documentation is built. If false, rustdoc and
7774
# friends will still be compiled but they will not be used to generate any
7875
# documentation.
@@ -101,6 +98,14 @@
10198
# Indicate whether the vendored sources are used for Rust dependencies or not
10299
#vendor = false
103100

101+
# =============================================================================
102+
# General install configuration options
103+
# =============================================================================
104+
[install]
105+
106+
# Instead of installing to /usr/local, install to this path instead.
107+
#prefix = "/path/to/install"
108+
104109
# =============================================================================
105110
# Options for compiling Rust code itself
106111
# =============================================================================

0 commit comments

Comments
 (0)