Skip to content

Commit

Permalink
Remove build directory once build of jemalloc-sys finishes
Browse files Browse the repository at this point in the history
And link to the libraries installed with `make install` instead.
This saves disk space in the `target` directory.
  • Loading branch information
Kobzol committed Feb 17, 2025
1 parent fa4486d commit fd235de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jemalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ fn main() {
.arg("-j")
.arg(num_jobs));

// Remove the build directory to avoid it wasting disk space in the target directory
fs::remove_dir_all(build_dir).unwrap();

println!("cargo:root={}", out_dir.display());

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

0 comments on commit fd235de

Please sign in to comment.