diff --git a/jemalloc-sys/build.rs b/jemalloc-sys/build.rs index fd11cf652..e6cf7b01c 100644 --- a/jemalloc-sys/build.rs +++ b/jemalloc-sys/build.rs @@ -155,6 +155,17 @@ fn main() { .expect("failed to copy config file to OUT_DIR"); } + // Create a dummy .git file so that 'git describe' fails and + // configure uses the VERSION file we provide. + if let Err(e) = fs::File::create(build_dir.join(".git")) { + // Assume that, if .git is a directory, it is valid and + // configure will do the right thing. + // std::io::ErrorKind::IsADirectory is unstable :-( + if e.kind().to_string() != "is a directory" { + panic!("failed to create a dummy .git file: {}", e); + } + } + // Run configure: let configure = build_dir.join("configure"); let mut cmd = Command::new("sh");