@@ -4,48 +4,27 @@ fn main() {
4
4
let mut build = cc:: Build :: new ( ) ;
5
5
6
6
build. include ( "c_src/mimalloc/include" ) ;
7
- build. files (
8
- [
9
- "alloc-aligned" ,
10
- "alloc-posix" ,
11
- "alloc" ,
12
- "arena" ,
13
- "bitmap" ,
14
- "heap" ,
15
- "init" ,
16
- "options" ,
17
- "os" ,
18
- "page" ,
19
- "random" ,
20
- "region" ,
21
- "segment" ,
22
- "stats" ,
23
- ]
24
- . iter ( )
25
- . map ( |fname| format ! ( "c_src/mimalloc/src/{}.c" , fname) ) ,
26
- ) ;
27
-
28
- build. define ( "MI_STATIC_LIB" , None ) ;
7
+ build. include ( "c_src/mimalloc/src" ) ;
8
+ build. file ( "c_src/mimalloc/src/static.c" ) ;
29
9
30
10
let target_os = env:: var ( "CARGO_CFG_TARGET_OS" ) . expect ( "target_os not defined!" ) ;
11
+ let target_family = env:: var ( "CARGO_CFG_TARGET_FAMILY" ) . expect ( "target_family not defined!" ) ;
31
12
32
- if cfg ! ( feature = "override" ) {
13
+ if env :: var_os ( "CARGO_FEATURE_OVERRIDE" ) . is_some ( ) {
33
14
// Overriding malloc is only available on windows in shared mode, but we
34
15
// only ever build a static lib.
35
- if target_os != "windows" {
16
+ if target_family != "windows" {
36
17
build. define ( "MI_MALLOC_OVERRIDE" , None ) ;
37
18
}
38
19
}
39
20
40
- if cfg ! ( feature = "secure" ) {
21
+ if env :: var_os ( "CARGO_FEATURE_SECURE" ) . is_some ( ) {
41
22
build. define ( "MI_SECURE" , "4" ) ;
42
23
}
43
24
44
- let dynamic_tls = cfg ! ( feature = "local_dynamic_tls" ) ;
25
+ let dynamic_tls = env :: var ( "CARGO_FEATURE_LOCAL_DYNAMIC_TLS" ) . is_ok ( ) ;
45
26
46
- if env:: var ( "CARGO_CFG_TARGET_FAMILY" ) . expect ( "target family not set" ) == "unix"
47
- && target_os != "haiku"
48
- {
27
+ if target_family == "unix" && target_os != "haiku" {
49
28
if dynamic_tls {
50
29
build. flag_if_supported ( "-ftls-model=local-dynamic" ) ;
51
30
} else {
0 commit comments