2020-05-27 06:13:08 +00:00
|
|
|
// spell-checker:ignore (ToDO) dylib libstdbuf deps liblibstdbuf
|
|
|
|
|
2017-12-09 02:50:18 +00:00
|
|
|
use std::env;
|
2017-12-30 06:17:54 +00:00
|
|
|
use std::fs;
|
|
|
|
use std::path::Path;
|
2017-12-09 02:50:18 +00:00
|
|
|
|
2021-03-18 01:32:34 +00:00
|
|
|
#[cfg(not(any(target_vendor = "apple", target_os = "windows")))]
|
2017-12-09 02:50:18 +00:00
|
|
|
mod platform {
|
2018-09-04 12:33:36 +00:00
|
|
|
pub const DYLIB_EXT: &str = ".so";
|
2017-12-09 02:50:18 +00:00
|
|
|
}
|
|
|
|
|
2021-03-18 01:32:34 +00:00
|
|
|
#[cfg(any(target_vendor = "apple"))]
|
2017-12-09 02:50:18 +00:00
|
|
|
mod platform {
|
2018-09-04 12:33:36 +00:00
|
|
|
pub const DYLIB_EXT: &str = ".dylib";
|
2017-12-09 02:50:18 +00:00
|
|
|
}
|
|
|
|
|
2019-04-28 02:14:22 +00:00
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
mod platform {
|
|
|
|
pub const DYLIB_EXT: &str = ".dll";
|
|
|
|
}
|
|
|
|
|
2017-10-09 22:09:24 +00:00
|
|
|
fn main() {
|
2018-03-02 07:08:09 +00:00
|
|
|
let manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("Could not find manifest dir");
|
|
|
|
let profile = env::var("PROFILE").expect("Could not determine profile");
|
|
|
|
|
2017-12-09 02:50:18 +00:00
|
|
|
let out_dir = env::var("OUT_DIR").unwrap();
|
2018-03-12 08:20:58 +00:00
|
|
|
let libstdbuf = format!(
|
2020-04-14 16:59:25 +00:00
|
|
|
"{}/../../../{}/{}/deps/liblibstdbuf{}",
|
2018-03-12 08:20:58 +00:00
|
|
|
manifest_dir,
|
2020-02-07 04:47:47 +00:00
|
|
|
env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_string()),
|
2018-03-12 08:20:58 +00:00
|
|
|
profile,
|
|
|
|
platform::DYLIB_EXT
|
|
|
|
);
|
|
|
|
|
2017-12-30 06:17:54 +00:00
|
|
|
fs::copy(libstdbuf, Path::new(&out_dir).join("libstdbuf.so")).unwrap();
|
2017-10-09 22:09:24 +00:00
|
|
|
}
|