Skip to content

Commit dfacaf7

Browse files
committed
fix mips, sparc64, and s390x builds
1 parent cac5f88 commit dfacaf7

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

jemalloc-sys/build.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ use std::fs;
1515
use std::path::PathBuf;
1616
use std::process::Command;
1717

18+
fn gnu_target(target: &str) -> String {
19+
match target {
20+
"i686-pc-windows-msvc" => "i686-pc-win32".to_string(),
21+
"x86_64-pc-windows-msvc" => "x86_64-pc-win32".to_string(),
22+
"i686-pc-windows-gnu" => "i686-w64-mingw32".to_string(),
23+
"x86_64-pc-windows-gnu" => "x86_64-w64-mingw32".to_string(),
24+
s => s.to_string(),
25+
}
26+
}
27+
1828
fn main() {
1929
let target = env::var("TARGET").unwrap();
2030
let host = env::var("HOST").unwrap();
@@ -47,6 +57,12 @@ fn main() {
4757
.env("CC", compiler.path())
4858
.env("CFLAGS", cflags);
4959

60+
// jemalloc's configure doesn't detect this value
61+
// automatically for this target:
62+
if target == "sparc64-unknown-linux-gnu" {
63+
cmd.arg("--with-lg-quantum=4");
64+
}
65+
5066
if target.contains("ios") {
5167
cmd.arg("--disable-tls");
5268
} else if target.contains("android") {
@@ -62,8 +78,8 @@ fn main() {
6278
if env::var_os("CARGO_FEATURE_PROFILING").is_some() {
6379
cmd.arg("--enable-prof");
6480
}
65-
cmd.arg(format!("--host={}", target.replace("windows-gnu", "w64-mingw32")));
66-
cmd.arg(format!("--build={}", host.replace("windows-gnu", "w64-mingw32")));
81+
cmd.arg(format!("--host={}", gnu_target(&target)));
82+
cmd.arg(format!("--build={}", gnu_target(&host)));
6783
cmd.arg(format!("--prefix={}", out_dir.display()));
6884

6985
run(&mut cmd);

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ const MIN_ALIGN: usize = 8;
3939
target_arch = "x86_64",
4040
target_arch = "aarch64",
4141
target_arch = "powerpc64",
42-
target_arch = "powerpc64le")))]
42+
target_arch = "powerpc64le",
43+
target_arch = "mips64",
44+
target_arch = "s390x",
45+
target_arch = "sparc64")))]
4346
const MIN_ALIGN: usize = 16;
4447

4548
// MALLOCX_ALIGN(a) macro

0 commit comments

Comments
 (0)