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