mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
39 lines
866 B
Rust
39 lines
866 B
Rust
extern crate cc;
|
|
|
|
fn link_static(lib: &str) {
|
|
println!("cargo:rustc-link-lib=static={}", lib);
|
|
}
|
|
|
|
fn link_framework(fw: &str) {
|
|
println!("cargo:rustc-link-lib=framework={}", fw);
|
|
}
|
|
|
|
fn add_search_path(p: &str) {
|
|
println!("cargo:rustc-link-search={}", p);
|
|
}
|
|
|
|
fn build_tools() {
|
|
let mut config = cc::Build::new();
|
|
config.file("misc.c").compile("libtools.a");
|
|
|
|
println!("rerun-if-changed=build.rs");
|
|
println!("rerun-if-changed=misc.h");
|
|
println!("rerun-if-changed=misc.c");
|
|
}
|
|
|
|
fn main() {
|
|
build_tools();
|
|
|
|
add_search_path("/usr/local/lib");
|
|
|
|
let target = std::env::var("TARGET").unwrap();
|
|
if target.contains("-apple") || target.contains("-darwin") {
|
|
link_framework("CoreFoundation");
|
|
link_framework("CoreServices");
|
|
link_framework("Security");
|
|
}
|
|
|
|
// local tools
|
|
link_static("tools");
|
|
}
|