Skip to content

Commit fd235de

Browse files
committed
Remove build directory once build of jemalloc-sys finishes
And link to the libraries installed with `make install` instead. This saves disk space in the `target` directory.
1 parent fa4486d commit fd235de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jemalloc-sys/build.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ fn main() {
318318
.arg("-j")
319319
.arg(num_jobs));
320320

321+
// Remove the build directory to avoid it wasting disk space in the target directory
322+
fs::remove_dir_all(build_dir).unwrap();
323+
321324
println!("cargo:root={}", out_dir.display());
322325

323326
// Linkage directives to pull in jemalloc and its dependencies.
@@ -332,7 +335,7 @@ fn main() {
332335
} else {
333336
println!("cargo:rustc-link-lib=static=jemalloc_pic");
334337
}
335-
println!("cargo:rustc-link-search=native={}/lib", build_dir.display());
338+
println!("cargo:rustc-link-search=native={}/lib", out_dir.display());
336339
if target.contains("android") {
337340
println!("cargo:rustc-link-lib=gcc");
338341
} else if !target.contains("windows") {

0 commit comments

Comments
 (0)