]> git.proxmox.com Git - rustc.git/blob - src/libunwind/build.rs
New upstream version 1.12.0+dfsg1
[rustc.git] / src / libunwind / build.rs
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.
4 //
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.
10
11 use std::env;
12
13 fn main() {
14 println!("cargo:rustc-cfg=cargobuild");
15
16 let target = env::var("TARGET").unwrap();
17
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");
23 }
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");
38 }
39 }