summaryrefslogtreecommitdiff
path: root/rust/build.rs
blob: 10c0d2161c2f6d4989ff2c7c4a7974c49d939d08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
extern crate gcc;

use std::env;

fn main() {
    let target = env::var("TARGET").unwrap();
    println!("cargo:rustc-link-lib=strophe");

    let mut config = gcc::Config::new();
    config.file("clib/sendxmpp.c");
    if target.contains("freebsd") {
        println!("cargo:rustc-link-search=native=/usr/local/lib");
        config.include("/usr/local/include");
    } else if target.contains("linux") {
        // ok pass
    } else {
        println!("Unknown OS, need to adapt build.rs");
        std::process::exit(1);
    }
    config.compile("libsendxmpp.a");
}