-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathbuild.rs
52 lines (47 loc) · 1.75 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
use std::process::Command;
static DOON_SRC: &str = "linuxdoom-1.10";
static LIBC_SRC: &str = "musl-1.2.2";
static LIBGCC_SRC: &str = "clang_compiler_rt";
fn main() {
// libc
println!("cargo:rerun-if-changed={}", LIBC_SRC);
let status = Command::new("make")
.args(&["-C", LIBC_SRC, "lib/libc.a"])
.status()
.expect("failed to start musl libc make");
if !status.success() {
panic!("Failed to make: {}", status);
}
println!("cargo:rustc-link-search={}/lib/", LIBC_SRC);
println!("cargo:rustc-link-lib=c");
// system headers for wasm32
let status = Command::new("make")
.args(&["-C", LIBC_SRC, "install-headers"])
.status()
.expect("failed to start musl libc install-headers make");
if !status.success() {
panic!("Failed to make: {}", status);
}
// compiler runtime, with e.g., floating point funtcions
println!("cargo:rerun-if-changed={}", LIBGCC_SRC);
let status = Command::new("make")
.args(&["-C", LIBGCC_SRC, "build/libclang_rt.builtins-wasm32.a"])
.status()
.expect("failed to start compiler_rt make");
if !status.success() {
panic!("Failed to make: {}", status);
}
println!("cargo:rustc-link-search={}/build", LIBGCC_SRC);
println!("cargo:rustc-link-lib=clang_rt.builtins-wasm32");
// original Doom Sources
println!("cargo:rerun-if-changed={}", DOON_SRC);
let status = Command::new("make")
.args(&["-C", DOON_SRC, "linux/liblinuxxdoom.a"])
.status()
.expect("failed to start doom make");
if !status.success() {
panic!("Failed to make: {}", status);
}
println!("cargo:rustc-link-search={}/linux", DOON_SRC);
println!("cargo:rustc-link-lib=linuxxdoom");
}