2015-11-19 15:34:20 +00:00
|
|
|
extern crate gcc;
|
2015-11-30 16:27:50 +00:00
|
|
|
extern crate pkg_config;
|
2015-11-19 15:34:20 +00:00
|
|
|
|
2016-04-11 07:10:29 +00:00
|
|
|
use std::process::Command;
|
|
|
|
use std::path::Path;
|
2016-04-12 07:20:47 +00:00
|
|
|
use std::env;
|
2016-04-11 07:10:29 +00:00
|
|
|
|
2015-11-19 15:34:20 +00:00
|
|
|
fn main() {
|
2016-04-11 07:10:29 +00:00
|
|
|
if ! Path::new("libsodium/src/libsodium/.libs/libsodium.a").exists() {
|
2016-04-12 07:20:47 +00:00
|
|
|
let target = env::var("TARGET").unwrap();
|
2016-04-11 07:10:29 +00:00
|
|
|
Command::new("sh").arg("autogen.sh").current_dir("libsodium").status().unwrap();
|
2016-04-12 07:20:47 +00:00
|
|
|
let mut args = vec!["configure", "--host", &target];
|
|
|
|
if target.starts_with("i686-") {
|
|
|
|
args.extend(vec!["CFLAGS=-m32", "CXXFLAGS=-m32", "LDFLAGS=-m32"]);
|
|
|
|
}
|
|
|
|
Command::new("sh").args(&args).current_dir("libsodium").status().unwrap();
|
2016-04-11 07:10:29 +00:00
|
|
|
Command::new("make").current_dir("libsodium").status().unwrap();
|
|
|
|
}
|
2015-11-21 16:06:57 +00:00
|
|
|
gcc::Config::new().file("src/c/tuntap.c").include("src").compile("libtuntap.a");
|
2016-04-11 07:10:29 +00:00
|
|
|
println!("cargo:rustc-link-search={}", "libsodium/src/libsodium/.libs");
|
2015-11-21 16:06:57 +00:00
|
|
|
}
|