Skip to content

Commit fd2331c

Browse files
Rollup merge of rust-lang#43421 - alexcrichton:add-some-build-scripts, r=Mark-Simulacrum
rustc: Add some build scripts for librustc crates This commit adds some "boilerplate" build scripts to librustc/libsyntax crates to declare dependencies on various environment variables that are configured throughout the build. Cargo recently gained the ability to depend on environment variables in build scripts which can help trigger recompilation of a crate. This should fix weird bugs where after you make a commit or a few days later you'll get weird "not built with the same compiler" errors hopefully.
2 parents bf5d661 + 0221964 commit fd2331c

File tree

7 files changed

+106
-0
lines changed

7 files changed

+106
-0
lines changed

src/librustc/build.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
println!("cargo:rerun-if-changed=build.rs");
13+
println!("cargo:rerun-if-env-changed=CFG_LIBDIR_RELATIVE");
14+
println!("cargo:rerun-if-env-changed=CFG_COMPILER_HOST_TRIPLE");
15+
}

src/librustc_back/build.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
println!("cargo:rerun-if-changed=build.rs");
13+
println!("cargo:rerun-if-env-changed=CFG_DEFAULT_LINKER");
14+
println!("cargo:rerun-if-env-changed=CFG_DEFAULT_AR");
15+
}

src/librustc_driver/build.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
println!("cargo:rerun-if-changed=build.rs");
13+
println!("cargo:rerun-if-env-changed=CFG_RELEASE");
14+
println!("cargo:rerun-if-env-changed=CFG_VERSION");
15+
println!("cargo:rerun-if-env-changed=CFG_VER_DATE");
16+
println!("cargo:rerun-if-env-changed=CFG_VER_HASH");
17+
}

src/librustc_incremental/build.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
println!("cargo:rerun-if-changed=build.rs");
13+
println!("cargo:rerun-if-env-changed=CFG_VERSION");
14+
}

src/librustc_metadata/build.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
println!("cargo:rerun-if-changed=build.rs");
13+
println!("cargo:rerun-if-env-changed=CFG_VERSION");
14+
}

src/librustc_trans/build.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
println!("cargo:rerun-if-changed=build.rs");
13+
println!("cargo:rerun-if-env-changed=CFG_VERSION");
14+
println!("cargo:rerun-if-env-changed=CFG_PREFIX");
15+
println!("cargo:rerun-if-env-changed=CFG_LLVM_ROOT");
16+
}

src/libsyntax/build.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
println!("cargo:rerun-if-changed=build.rs");
13+
println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL");
14+
println!("cargo:rerun-if-env-changed=CFG_DISABLE_UNSTABLE_FEATURES");
15+
}

0 commit comments

Comments
 (0)