Skip to content

Commit 9044f68

Browse files
authored
Merge pull request gnzlbg#37 from gnzlbg/fix_platforms
fix mips, sparc64, and s390x builds
2 parents 1fe55c1 + dfacaf7 commit 9044f68

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();
@@ -49,6 +59,12 @@ fn main() {
4959
.env("CPPFLAGS", cflags.clone())
5060
.arg("--disable-cxx") ;
5161

62+
// jemalloc's configure doesn't detect this value
63+
// automatically for this target:
64+
if target == "sparc64-unknown-linux-gnu" {
65+
cmd.arg("--with-lg-quantum=4");
66+
}
67+
5268
if target.contains("ios") {
5369
cmd.arg("--disable-tls");
5470
} else if target.contains("android") {
@@ -64,8 +80,8 @@ fn main() {
6480
if env::var_os("CARGO_FEATURE_PROFILING").is_some() {
6581
cmd.arg("--enable-prof");
6682
}
67-
cmd.arg(format!("--host={}", target.replace("windows-gnu", "w64-mingw32")));
68-
cmd.arg(format!("--build={}", host.replace("windows-gnu", "w64-mingw32")));
83+
cmd.arg(format!("--host={}", gnu_target(&target)));
84+
cmd.arg(format!("--build={}", gnu_target(&host)));
6985
cmd.arg(format!("--prefix={}", out_dir.display()));
7086

7187
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)