-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.rs
33 lines (26 loc) · 915 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// build.rs
use std::env;
use std::path::PathBuf;
fn main() {
let src = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("src");
let mut cc = cc::Build::new();
cc.warnings(false);
cc.define("SLJIT_CONFIG_AUTO", "1");
if env::var("TARGET").unwrap().contains("apple-darwin") {
cc.define("SLJIT_PROT_EXECUTABLE_ALLOCATOR", "0");
} else {
cc.define("SLJIT_PROT_EXECUTABLE_ALLOCATOR", "1");
}
if env::var("TARGET").unwrap().contains("gnu") {
cc.define("_GNU_SOURCE", "1");
cc.define("HAVE_MEMFD_CREATE", "1");
}
cc.define("SLJIT_ARGUMENT_CHECKS", "1");
cc.define("SLJIT_DEBUG", "0");
cc.define("SLJIT_VERBOSE", "0");
cc.include(&src.join("sljit"));
cc.include(&src.join("bpfjit"));
cc.file(src.join("sljit").join("sljitLir.c"));
cc.file(src.join("bpfjit").join("bpfjit.c"));
cc.compile("bpfjit");
}