rustbuild: Tighten dependencies of build scripts

Ensure that `rerun-if-changed` is printed for all build scripts to ensure that
they've all got the right list of dependencies.
This commit is contained in:
Alex Crichton 2016-04-29 10:39:28 -07:00
parent 80ec1b9f10
commit 8d65591cf2
4 changed files with 35 additions and 3 deletions

View file

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
extern crate build_helper;
extern crate gcc;
@ -18,6 +20,7 @@ use build_helper::run;
fn main() {
println!("cargo:rustc-cfg=cargobuild");
println!("cargo:rerun-if-changed=build.rs");
let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
@ -40,6 +43,19 @@ fn main() {
let cflags = compiler.args().iter().map(|s| s.to_str().unwrap())
.collect::<Vec<_>>().join(" ");
let mut stack = src_dir.join("../jemalloc")
.read_dir().unwrap()
.map(|e| e.unwrap())
.collect::<Vec<_>>();
while let Some(entry) = stack.pop() {
let path = entry.path();
if entry.file_type().unwrap().is_dir() {
stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
} else {
println!("cargo:rerun-if-changed={}", path.display());
}
}
let mut cmd = Command::new("sh");
cmd.arg(src_dir.join("../jemalloc/configure").to_str().unwrap()
.replace("C:\\", "/c/")

View file

@ -8,7 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
fn main() {
// Remove this whenever snapshots and rustbuild nightlies are synced.
println!("cargo:rustc-cfg=cargobuild");
println!("cargo:rerun-if-changed=build.rs")
}

View file

@ -8,11 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
extern crate gcc;
extern crate build_helper;
use std::env;
use std::fs;
use std::path::PathBuf;
use std::process::Command;
@ -20,6 +21,7 @@ use build_helper::run;
fn main() {
println!("cargo:rustc-cfg=cargobuild");
println!("cargo:rerun-if-changed=build.rs");
let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
@ -65,8 +67,16 @@ fn build_libbacktrace(host: &str, target: &str) {
println!("cargo:rustc-link-lib=static=backtrace");
println!("cargo:rustc-link-search=native={}/.libs", build_dir.display());
if fs::metadata(&build_dir.join(".libs/libbacktrace.a")).is_ok() {
return
let mut stack = src_dir.read_dir().unwrap()
.map(|e| e.unwrap())
.collect::<Vec<_>>();
while let Some(entry) = stack.pop() {
let path = entry.path();
if entry.file_type().unwrap().is_dir() {
stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
} else {
println!("cargo:rerun-if-changed={}", path.display());
}
}
let compiler = gcc::Config::new().get_compiler();

View file

@ -8,8 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(warnings)]
// See comments in Cargo.toml for why this exists
fn main() {
println!("cargo:rustc-cfg=stdbuild");
println!("cargo:rerun-if-changed=build.rs");
}