Skip to content

Commit ed78ac1

Browse files
committed
Build support for no llvm
1 parent 03198da commit ed78ac1

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

src/bootstrap/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub struct Config {
5353
pub profiler: bool,
5454

5555
// llvm codegen options
56+
pub llvm_enabled: bool,
5657
pub llvm_assertions: bool,
5758
pub llvm_optimize: bool,
5859
pub llvm_release_debuginfo: bool,
@@ -182,6 +183,7 @@ struct Install {
182183
/// TOML representation of how the LLVM build is configured.
183184
#[derive(RustcDecodable, Default)]
184185
struct Llvm {
186+
enabled: Option<bool>,
185187
ccache: Option<StringOrBool>,
186188
ninja: Option<bool>,
187189
assertions: Option<bool>,
@@ -252,6 +254,7 @@ struct TomlTarget {
252254
impl Config {
253255
pub fn parse(build: &str, file: Option<PathBuf>) -> Config {
254256
let mut config = Config::default();
257+
config.llvm_enabled = true;
255258
config.llvm_optimize = true;
256259
config.use_jemalloc = true;
257260
config.backtrace = true;
@@ -345,6 +348,7 @@ impl Config {
345348
Some(StringOrBool::Bool(false)) | None => {}
346349
}
347350
set(&mut config.ninja, llvm.ninja);
351+
set(&mut config.llvm_enabled, llvm.enabled);
348352
set(&mut config.llvm_assertions, llvm.assertions);
349353
set(&mut config.llvm_optimize, llvm.optimize);
350354
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);

src/bootstrap/config.toml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
# =============================================================================
1515
[llvm]
1616

17+
# Indicates whether rustc will support compilation with LLVM (currently broken)
18+
#enabled = true
19+
1720
# Indicates whether the LLVM build is a Release or Debug build
1821
#optimize = true
1922

src/bootstrap/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ impl Build {
583583
if self.config.use_jemalloc {
584584
features.push_str(" jemalloc");
585585
}
586+
if self.config.llvm_enabled {
587+
features.push_str(" llvm");
588+
}
586589
return features
587590
}
588591

src/bootstrap/native.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ use build_helper::up_to_date;
3535

3636
/// Compile LLVM for `target`.
3737
pub fn llvm(build: &Build, target: &str) {
38+
// If we're not compiling for LLVM bail out here.
39+
if !build.config.llvm_enabled {
40+
return;
41+
}
42+
3843
// If we're using a custom LLVM bail out here, but we can only use a
3944
// custom LLVM for the build triple.
4045
if let Some(config) = build.config.target_config.get(target) {

0 commit comments

Comments
 (0)