1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
14 println!("cargo:rerun-if-changed=build.rs");
15 let target = env::var("TARGET").expect("TARGET was not set");
17 if target.contains("linux") {
18 if target.contains("musl") && !target.contains("mips") {
19 // musl is handled in lib.rs
20 } else if !target.contains("android") {
21 println!("cargo:rustc-link-lib=gcc_s");
23 } else if target.contains("freebsd") {
24 println!("cargo:rustc-link-lib=gcc_s");
25 } else if target.contains("rumprun") {
26 println!("cargo:rustc-link-lib=unwind");
27 } else if target.contains("netbsd") {
28 println!("cargo:rustc-link-lib=gcc_s");
29 } else if target.contains("openbsd") {
30 println!("cargo:rustc-link-lib=c++abi");
31 } else if target.contains("solaris") {
32 println!("cargo:rustc-link-lib=gcc_s");
33 } else if target.contains("bitrig") {
34 println!("cargo:rustc-link-lib=c++abi");
35 } else if target.contains("dragonfly") {
36 println!("cargo:rustc-link-lib=gcc_pic");
37 } else if target.contains("windows-gnu") {
38 println!("cargo:rustc-link-lib=static-nobundle=gcc_eh");
39 println!("cargo:rustc-link-lib=static-nobundle=pthread");
40 } else if target.contains("fuchsia") {
41 println!("cargo:rustc-link-lib=unwind");
42 } else if target.contains("haiku") {
43 println!("cargo:rustc-link-lib=gcc_s");
44 } else if target.contains("redox") {
45 println!("cargo:rustc-link-lib=gcc");
46 } else if target.contains("cloudabi") {
47 println!("cargo:rustc-link-lib=unwind");