]> git.proxmox.com Git - rustc.git/blob - src/libunwind/build.rs
New upstream version 1.19.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:rerun-if-changed=build.rs");
15 let target = env::var("TARGET").expect("TARGET was not set");
16
17 if target.contains("linux") {
18 if target.contains("musl") && !target.contains("mips") {
19 println!("cargo:rustc-link-lib=static=unwind");
20 } else if !target.contains("android") {
21 println!("cargo:rustc-link-lib=gcc_s");
22 }
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=gcc");
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 }
45 }