@@ -3,66 +3,23 @@ use std::env;
3
3
fn main ( ) {
4
4
println ! ( "cargo:rerun-if-changed=build.rs" ) ;
5
5
let target = env:: var ( "TARGET" ) . expect ( "TARGET was not set" ) ;
6
- if target. contains ( "linux" ) {
7
- if target. contains ( "android" ) {
8
- println ! ( "cargo:rustc-link-lib=dl" ) ;
9
- println ! ( "cargo:rustc-link-lib=log" ) ;
10
- println ! ( "cargo:rustc-link-lib=gcc" ) ;
11
- }
12
- } else if target. contains ( "freebsd" ) {
13
- println ! ( "cargo:rustc-link-lib=execinfo" ) ;
14
- println ! ( "cargo:rustc-link-lib=pthread" ) ;
6
+ if target. contains ( "freebsd" ) {
15
7
if env:: var ( "RUST_STD_FREEBSD_12_ABI" ) . is_ok ( ) {
16
8
println ! ( "cargo:rustc-cfg=freebsd12" ) ;
17
9
}
18
- } else if target. contains ( "netbsd" ) {
19
- println ! ( "cargo:rustc-link-lib=pthread" ) ;
20
- println ! ( "cargo:rustc-link-lib=rt" ) ;
21
- } else if target. contains ( "dragonfly" ) || target. contains ( "openbsd" ) {
22
- println ! ( "cargo:rustc-link-lib=pthread" ) ;
23
- } else if target. contains ( "solaris" ) {
24
- println ! ( "cargo:rustc-link-lib=socket" ) ;
25
- println ! ( "cargo:rustc-link-lib=posix4" ) ;
26
- println ! ( "cargo:rustc-link-lib=pthread" ) ;
27
- println ! ( "cargo:rustc-link-lib=resolv" ) ;
28
- } else if target. contains ( "illumos" ) {
29
- println ! ( "cargo:rustc-link-lib=socket" ) ;
30
- println ! ( "cargo:rustc-link-lib=posix4" ) ;
31
- println ! ( "cargo:rustc-link-lib=pthread" ) ;
32
- println ! ( "cargo:rustc-link-lib=resolv" ) ;
33
- println ! ( "cargo:rustc-link-lib=nsl" ) ;
34
- // Use libumem for the (malloc-compatible) allocator
35
- println ! ( "cargo:rustc-link-lib=umem" ) ;
36
- } else if target. contains ( "apple-darwin" ) {
37
- println ! ( "cargo:rustc-link-lib=System" ) ;
38
-
39
- // res_init and friends require -lresolv on macOS/iOS.
40
- // See #41582 and http://blog.achernya.com/2013/03/os-x-has-silly-libsystem.html
41
- println ! ( "cargo:rustc-link-lib=resolv" ) ;
42
- } else if target. contains ( "apple-ios" ) {
43
- println ! ( "cargo:rustc-link-lib=System" ) ;
44
- println ! ( "cargo:rustc-link-lib=objc" ) ;
45
- println ! ( "cargo:rustc-link-lib=framework=Security" ) ;
46
- println ! ( "cargo:rustc-link-lib=framework=Foundation" ) ;
47
- println ! ( "cargo:rustc-link-lib=resolv" ) ;
48
- } else if target. contains ( "uwp" ) {
49
- println ! ( "cargo:rustc-link-lib=ws2_32" ) ;
50
- // For BCryptGenRandom
51
- println ! ( "cargo:rustc-link-lib=bcrypt" ) ;
52
- } else if target. contains ( "windows" ) {
53
- println ! ( "cargo:rustc-link-lib=advapi32" ) ;
54
- println ! ( "cargo:rustc-link-lib=ws2_32" ) ;
55
- println ! ( "cargo:rustc-link-lib=userenv" ) ;
56
- } else if target. contains ( "fuchsia" ) {
57
- println ! ( "cargo:rustc-link-lib=zircon" ) ;
58
- println ! ( "cargo:rustc-link-lib=fdio" ) ;
59
- } else if target. contains ( "cloudabi" ) {
60
- if cfg ! ( feature = "backtrace" ) {
61
- println ! ( "cargo:rustc-link-lib=unwind" ) ;
62
- }
63
- println ! ( "cargo:rustc-link-lib=c" ) ;
64
- println ! ( "cargo:rustc-link-lib=compiler_rt" ) ;
65
- } else if ( target. contains ( "sgx" ) && target. contains ( "fortanix" ) )
10
+ } else if target. contains ( "linux" )
11
+ || target. contains ( "netbsd" )
12
+ || target. contains ( "dragonfly" )
13
+ || target. contains ( "openbsd" )
14
+ || target. contains ( "solaris" )
15
+ || target. contains ( "illumos" )
16
+ || target. contains ( "apple-darwin" )
17
+ || target. contains ( "apple-ios" )
18
+ || target. contains ( "uwp" )
19
+ || target. contains ( "windows" )
20
+ || target. contains ( "fuchsia" )
21
+ || target. contains ( "cloudabi" )
22
+ || ( target. contains ( "sgx" ) && target. contains ( "fortanix" ) )
66
23
|| target. contains ( "hermit" )
67
24
|| target. contains ( "l4re" )
68
25
|| target. contains ( "redox" )
0 commit comments