-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.rs
35 lines (29 loc) · 1000 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
34
35
extern crate gcc;
use std::env;
fn main() {
// for libhdfs.a
match env::var("HADOOP_HOME") {
Ok(val) => {
println!("cargo:rustc-link-search=native={}/lib/native", val);
},
Err(e) => { panic!("HADOOP_HOME shell environment must be set: {}", e); }
}
// for jvm.h and linking to jni libraries
let mut minidfs_config = gcc::Config::new();
minidfs_config.file("src/libhdfs/native_mini_dfs.c").include("src/libhdfs");
match env::var("JAVA_HOME") {
Ok(val) => {
minidfs_config.include(format!("{}/include/", val));
if cfg!(target_os = "linux") {
minidfs_config
.include(format!("{}/include/linux", val));
} else if cfg!(target_os = "macos") {
minidfs_config
.include(format!("{}/include/darwin", val));
}
// TODO - to be changed to consider a dependent platform.
},
Err(e) => { panic!("JAVA_HOME shell environment must be set: {}", e); }
}
minidfs_config.compile("libminidfs.a");
}