Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions jemalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,11 @@ fn main() {
.arg("install_lib_static")
.arg("install_include"));

// Try to remove the build directory to avoid it wasting disk space in the target directory
let _ = fs::remove_dir_all(build_dir);
// The MSVC build installs a differently named library, so keep its build
// directory and link the archive directly from there.
if !target.contains("windows") {
let _ = fs::remove_dir_all(&build_dir);
}

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

Expand All @@ -365,11 +368,12 @@ fn main() {
// intrinsics that are libgcc specific (e.g. those intrinsics aren't present in
// libcompiler-rt), so link that in to get that support.
if target.contains("windows") {
println!("cargo:rustc-link-lib=static=jemalloc");
println!("cargo:rustc-link-lib=static=jemalloc_s");
println!("cargo:rustc-link-search=native={}/lib", build_dir.display());
} else {
println!("cargo:rustc-link-lib=static=jemalloc_pic");
println!("cargo:rustc-link-search=native={}/lib", out_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 Expand Up @@ -448,8 +452,8 @@ fn execute(cmd: &mut Command, on_fail: impl FnOnce()) {

fn gnu_target(target: &str) -> String {
match target {
"i686-pc-windows-msvc" => "i686-pc-win32".to_string(),
"x86_64-pc-windows-msvc" => "x86_64-pc-win32".to_string(),
"i686-pc-windows-msvc" => "i686-pc-mingw32".to_string(),
"x86_64-pc-windows-msvc" => "x86_64-pc-mingw32".to_string(),
"i686-pc-windows-gnu" | "i686-pc-windows-gnullvm" => "i686-w64-mingw32".to_string(),
"x86_64-pc-windows-gnu" | "x86_64-pc-windows-gnullvm" => "x86_64-w64-mingw32".to_string(),
"aarch64-pc-windows-gnullvm" => "aarch64-w64-mingw32".to_string(),
Expand Down