Skip to content

Commit 1e6b147

Browse files
KobzolBusyJay
authored andcommitted
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. Signed-off-by: Jakub Beránek <[email protected]>
1 parent f4fde3f commit 1e6b147

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jemalloc-sys/build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ fn main() {
328328
.arg("install_lib_static")
329329
.arg("install_include"));
330330

331+
// Try to remove the build directory to avoid it wasting disk space in the target directory
332+
let _ = fs::remove_dir_all(build_dir);
333+
331334
println!("cargo:root={}", out_dir.display());
332335

333336
// Linkage directives to pull in jemalloc and its dependencies.
@@ -342,7 +345,7 @@ fn main() {
342345
} else {
343346
println!("cargo:rustc-link-lib=static=jemalloc_pic");
344347
}
345-
println!("cargo:rustc-link-search=native={}/lib", build_dir.display());
348+
println!("cargo:rustc-link-search=native={}/lib", out_dir.display());
346349
if target.contains("android") {
347350
println!("cargo:rustc-link-lib=gcc");
348351
} else if !target.contains("windows") {

0 commit comments

Comments
 (0)