forked from servo/osmesa-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
54 lines (49 loc) · 1.94 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
use std::env;
use std::path::PathBuf;
use std::process::Command;
fn main() {
let src = env::current_dir().unwrap();
let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap());
// Prevent aclocal being run due to timestamps being messed up by git.
// https://stackoverflow.com/questions/18769770/user-of-autotools-generated-tarball-gets-error-message-aclocal-1-13-command-no
run(Command::new("touch")
.current_dir(src.join("mesa-12.0.1"))
.arg("configure.ac")
.arg("aclocal.m4")
.arg("configure")
.arg("Makefile.am")
.arg("Makefile.in")
.arg("src/compiler/glsl/glcpp/glcpp-lex.c")
.arg("src/mesa/program/lex.yy.c")
.arg("src/compiler/glsl/glcpp/glcpp-parse.c")
.arg("src/compiler/glsl/glsl_parser.cpp")
.arg("src/mesa/program/program_parse.tab.c")
.arg("src/compiler/glsl/glsl_lexer.cpp"));
run(Command::new(src.join("mesa-12.0.1/configure"))
.current_dir(&dst)
.env("PTHREADSTUBS_CFLAGS", ".")
.env("PTHREADSTUBS_LIBS", ".")
.arg("--disable-gles1")
.arg("--disable-gles2")
.arg("--disable-dri")
.arg("--disable-dri3")
.arg("--disable-glx")
.arg("--disable-egl")
.arg("--disable-driglx-direct")
.arg("--enable-gallium-osmesa")
.arg("--with-gallium-drivers=swrast")
.arg("--disable-llvm-shared-libs"));
run(Command::new("make")
.arg("-j4")
.current_dir(&dst));
}
fn run(cmd: &mut Command) {
println!("running: {:?}", cmd);
let status = match cmd.status() {
Ok(s) => s,
Err(e) => panic!("failed to get status: {}", e),
};
if !status.success() {
panic!("failed with: {}", status);
}
}