about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2017-07-24 09:16:37 -0600
committerGitHub <noreply@github.com>2017-07-24 09:16:37 -0600
commitfd2331c2692f7f15d432e8320bbfaf9be3de7d7c (patch)
tree4c18083cc233f30746c3d3a3d4f28b62929a908b
parentbf5d6617fd3f767f55eb4df719ffc72228b6e462 (diff)
parent02219642bc5e8a9454ff4d6c6b0ede16a321ab9d (diff)
Rollup merge of #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.
-rw-r--r--src/librustc/build.rs15
-rw-r--r--src/librustc_back/build.rs15
-rw-r--r--src/librustc_driver/build.rs17
-rw-r--r--src/librustc_incremental/build.rs14
-rw-r--r--src/librustc_metadata/build.rs14
-rw-r--r--src/librustc_trans/build.rs16
-rw-r--r--src/libsyntax/build.rs15
7 files changed, 106 insertions, 0 deletions
diff --git a/src/librustc/build.rs b/src/librustc/build.rs
new file mode 100644
index 00000000000..4df5f0e6405
--- /dev/null
+++ b/src/librustc/build.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    println!("cargo:rerun-if-changed=build.rs");
+    println!("cargo:rerun-if-env-changed=CFG_LIBDIR_RELATIVE");
+    println!("cargo:rerun-if-env-changed=CFG_COMPILER_HOST_TRIPLE");
+}
diff --git a/src/librustc_back/build.rs b/src/librustc_back/build.rs
new file mode 100644
index 00000000000..16f0872b25a
--- /dev/null
+++ b/src/librustc_back/build.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    println!("cargo:rerun-if-changed=build.rs");
+    println!("cargo:rerun-if-env-changed=CFG_DEFAULT_LINKER");
+    println!("cargo:rerun-if-env-changed=CFG_DEFAULT_AR");
+}
diff --git a/src/librustc_driver/build.rs b/src/librustc_driver/build.rs
new file mode 100644
index 00000000000..9844f3b557a
--- /dev/null
+++ b/src/librustc_driver/build.rs
@@ -0,0 +1,17 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    println!("cargo:rerun-if-changed=build.rs");
+    println!("cargo:rerun-if-env-changed=CFG_RELEASE");
+    println!("cargo:rerun-if-env-changed=CFG_VERSION");
+    println!("cargo:rerun-if-env-changed=CFG_VER_DATE");
+    println!("cargo:rerun-if-env-changed=CFG_VER_HASH");
+}
diff --git a/src/librustc_incremental/build.rs b/src/librustc_incremental/build.rs
new file mode 100644
index 00000000000..f18a3f9b940
--- /dev/null
+++ b/src/librustc_incremental/build.rs
@@ -0,0 +1,14 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    println!("cargo:rerun-if-changed=build.rs");
+    println!("cargo:rerun-if-env-changed=CFG_VERSION");
+}
diff --git a/src/librustc_metadata/build.rs b/src/librustc_metadata/build.rs
new file mode 100644
index 00000000000..f18a3f9b940
--- /dev/null
+++ b/src/librustc_metadata/build.rs
@@ -0,0 +1,14 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    println!("cargo:rerun-if-changed=build.rs");
+    println!("cargo:rerun-if-env-changed=CFG_VERSION");
+}
diff --git a/src/librustc_trans/build.rs b/src/librustc_trans/build.rs
new file mode 100644
index 00000000000..97accbb4b8f
--- /dev/null
+++ b/src/librustc_trans/build.rs
@@ -0,0 +1,16 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    println!("cargo:rerun-if-changed=build.rs");
+    println!("cargo:rerun-if-env-changed=CFG_VERSION");
+    println!("cargo:rerun-if-env-changed=CFG_PREFIX");
+    println!("cargo:rerun-if-env-changed=CFG_LLVM_ROOT");
+}
diff --git a/src/libsyntax/build.rs b/src/libsyntax/build.rs
new file mode 100644
index 00000000000..d39340c3326
--- /dev/null
+++ b/src/libsyntax/build.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    println!("cargo:rerun-if-changed=build.rs");
+    println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL");
+    println!("cargo:rerun-if-env-changed=CFG_DISABLE_UNSTABLE_FEATURES");
+}