vpncloud/build.rs

22 lines
850 B
Rust
Raw Normal View History

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
use std::process::Command;
use std::path::Path;
2016-04-12 07:20:47 +00:00
use std::env;
2015-11-19 15:34:20 +00:00
fn main() {
if ! Path::new("libsodium/src/libsodium/.libs/libsodium.a").exists() {
2016-04-12 07:20:47 +00:00
let target = env::var("TARGET").unwrap();
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();
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");
println!("cargo:rustc-link-search={}", "libsodium/src/libsodium/.libs");
2015-11-21 16:06:57 +00:00
}