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 let target = env::var("TARGET").expect("TARGET was not set");
16 if target.contains("linux") {
17 if target.contains("musl") && !target.contains("mips") {
18 println!("cargo:rustc-link-lib=static=unwind");
19 } else if !target.contains("android") {
20 println!("cargo:rustc-link-lib=gcc_s");
22 } else if target.contains("freebsd") {
23 println!("cargo:rustc-link-lib=gcc_s");
24 } else if target.contains("rumprun") {
25 println!("cargo:rustc-link-lib=unwind");
26 } else if target.contains("netbsd") {
27 println!("cargo:rustc-link-lib=gcc_s");
28 } else if target.contains("openbsd") {
29 println!("cargo:rustc-link-lib=gcc");
30 } else if target.contains("bitrig") {
31 println!("cargo:rustc-link-lib=c++abi");
32 } else if target.contains("dragonfly") {
33 println!("cargo:rustc-link-lib=gcc_pic");
34 } else if target.contains("windows-gnu") {
35 println!("cargo:rustc-link-lib=gcc_eh");
36 } else if target.contains("fuchsia") {
37 println!("cargo:rustc-link-lib=unwind");