Skip to content

Commit

Permalink
Copy source into build directory
Browse files Browse the repository at this point in the history
If we gotta change it, we shouldn't change the source tree.
  • Loading branch information
alexcrichton committed May 12, 2017
1 parent d117bb1 commit 637fccc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lzma-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ fn main() {
let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let src = t!(env::current_dir());

println!("cargo:rustc-link-search={}/lib", dst.display());
println!("cargo:root={}", dst.display());
Expand Down Expand Up @@ -65,9 +64,11 @@ fn main() {
// neither of which we want.
//
// Work around this by just touching every file to the same time.
let meta = t!(Path::new("xz-5.2.2/configure").metadata());
let src = dst.join("src");
cp_r(Path::new("xz-5.2.2"), &src);
let meta = t!(src.join("configure").metadata());
let now = FileTime::from_last_modification_time(&meta);
set_all_mtime(Path::new("xz-5.2.2"), &now);
set_all_mtime(&src, &now);

println!("cargo:rustc-link-lib=static=lzma");
let cfg = gcc::Config::new();
Expand All @@ -84,7 +85,7 @@ fn main() {
cmd.env("CC", compiler.path())
.env("CFLAGS", cflags)
.current_dir(&dst.join("build"))
.arg(sanitize_sh(&src.join("xz-5.2.2/configure")));
.arg(sanitize_sh(&src.join("configure")));
cmd.arg(format!("--prefix={}", sanitize_sh(&dst)));
cmd.arg("--disable-doc");
cmd.arg("--disable-lzma-links");
Expand Down

0 comments on commit 637fccc

Please sign in to comment.