-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
78 lines (74 loc) · 1.92 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
extern crate cc;
/// build by GNU or MSVC
fn main() {
if cfg!(feature = "hashs") {
yespower_build();
x16s_build();
x11_build();
} else {
eprintln!("skip compile");
}
}
/// yespower crypto hash library build
fn yespower_build() {
let mut compiler = cc::Build::new();
if !cfg!(windows) {
// for only GNU
compiler
.flag("-march=native")
.flag("-funroll-loops")
.flag("-fomit-frame-pointer");
}
compiler
.file("src/yespower/yespower.c")
.include("src/yespower")
.compile("yespower");
}
/// X16S crypto hash library build
fn x16s_build() {
let files = [
"src/x16s/x16s.c",
"src/x16s/sha3/blake.c",
"src/x16s/sha3/bmw.c",
"src/x16s/sha3/groestl.c",
"src/x16s/sha3/jh.c",
"src/x16s/sha3/keccak.c",
"src/x16s/sha3/skein.c",
"src/x16s/sha3/cubehash.c",
"src/x16s/sha3/echo.c",
"src/x16s/sha3/luffa.c",
"src/x16s/sha3/simd.c",
"src/x16s/sha3/hamsi.c",
"src/x16s/sha3/hamsi_helper.c",
"src/x16s/sha3/fugue.c",
"src/x16s/sha3/shavite.c",
"src/x16s/sha3/shabal.c",
"src/x16s/sha3/whirlpool.c",
"src/x16s/sha3/sha2big.c",
];
cc::Build::new()
.files(&files)
.include("src/x16s/sha3")
.compile("x16s");
}
/// X11 crypto hash library build
fn x11_build() {
let files = [
"src/x11/x11hash.c",
"src/x11/sha3/blake.c",
"src/x11/sha3/bmw.c",
"src/x11/sha3/groestl.c",
"src/x11/sha3/jh.c",
"src/x11/sha3/keccak.c",
"src/x11/sha3/skein.c",
"src/x11/sha3/cubehash.c",
"src/x11/sha3/echo.c",
"src/x11/sha3/luffa.c",
"src/x11/sha3/simd.c",
"src/x11/sha3/shavite.c",
];
cc::Build::new()
.files(&files)
.include("src/x11/sha3")
.compile("x11");
}