Skip to content

Commit e152a16

Browse files
committed
Build support for no llvm
1 parent 73c3f55 commit e152a16

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-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,
@@ -192,6 +193,7 @@ struct Install {
192193
#[derive(Deserialize, Default)]
193194
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
194195
struct Llvm {
196+
enabled: Option<bool>,
195197
ccache: Option<StringOrBool>,
196198
ninja: Option<bool>,
197199
assertions: Option<bool>,
@@ -265,6 +267,7 @@ struct TomlTarget {
265267
impl Config {
266268
pub fn parse(build: &str, file: Option<PathBuf>) -> Config {
267269
let mut config = Config::default();
270+
config.llvm_enabled = true;
268271
config.llvm_optimize = true;
269272
config.use_jemalloc = true;
270273
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
# =============================================================================
1515
[llvm]
1616

17+
# Indicates whether rustc will support compilation with LLVM
18+
# note: rustc does not compile without LLVM at the moment
19+
#enabled = true
20+
1721
# Indicates whether the LLVM build is a Release or Debug build
1822
#optimize = true
1923

src/bootstrap/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,9 @@ impl Build {
429429
if self.config.use_jemalloc {
430430
features.push_str(" jemalloc");
431431
}
432+
if self.config.llvm_enabled {
433+
features.push_str(" llvm");
434+
}
432435
features
433436
}
434437

src/bootstrap/native.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ impl Step for Llvm {
5656
fn run(self, builder: &Builder) {
5757
let build = builder.build;
5858
let target = self.target;
59+
60+
// If we're not compiling for LLVM bail out here.
61+
if !build.config.llvm_enabled {
62+
return;
63+
}
64+
5965
// If we're using a custom LLVM bail out here, but we can only use a
6066
// custom LLVM for the build triple.
6167
if let Some(config) = build.config.target_config.get(&target) {

0 commit comments

Comments
 (0)