@@ -21,20 +21,25 @@ fn main() {
21
21
println ! ( "cargo:rustc-cfg=cargobuild" ) ;
22
22
23
23
let target = env:: var ( "TARGET" ) . unwrap ( ) ;
24
- let llvm_config = env:: var_os ( "LLVM_CONFIG" ) . map ( PathBuf :: from)
25
- . unwrap_or_else ( || {
26
- match env:: var_os ( "CARGO_TARGET_DIR" ) . map ( PathBuf :: from) {
27
- Some ( dir) => {
28
- let to_test = dir. parent ( ) . unwrap ( ) . parent ( ) . unwrap ( )
29
- . join ( & target) . join ( "llvm/bin/llvm-config" ) ;
30
- if Command :: new ( & to_test) . output ( ) . is_ok ( ) {
31
- return to_test
32
- }
33
- }
34
- None => { }
35
- }
36
- PathBuf :: from ( "llvm-config" )
37
- } ) ;
24
+ let llvm_config = env:: var_os ( "LLVM_CONFIG" )
25
+ . map ( PathBuf :: from)
26
+ . unwrap_or_else ( || {
27
+ match env:: var_os ( "CARGO_TARGET_DIR" ) . map ( PathBuf :: from) {
28
+ Some ( dir) => {
29
+ let to_test = dir. parent ( )
30
+ . unwrap ( )
31
+ . parent ( )
32
+ . unwrap ( )
33
+ . join ( & target)
34
+ . join ( "llvm/bin/llvm-config" ) ;
35
+ if Command :: new ( & to_test) . output ( ) . is_ok ( ) {
36
+ return to_test;
37
+ }
38
+ }
39
+ None => { }
40
+ }
41
+ PathBuf :: from ( "llvm-config" )
42
+ } ) ;
38
43
39
44
println ! ( "cargo:rerun-if-changed={}" , llvm_config. display( ) ) ;
40
45
@@ -63,20 +68,22 @@ fn main() {
63
68
let host = env:: var ( "HOST" ) . unwrap ( ) ;
64
69
let is_crossed = target != host;
65
70
66
- let optional_components = [ "x86" , "arm" , "aarch64" , "mips" , "powerpc" ,
67
- "pnacl" ] ;
71
+ let optional_components = [ "x86" , "arm" , "aarch64" , "mips" , "powerpc" , "pnacl" ] ;
68
72
69
73
// FIXME: surely we don't need all these components, right? Stuff like mcjit
70
74
// or interpreter the compiler itself never uses.
71
- let required_components = & [ "ipo" , "bitreader" , "bitwriter" , "linker" ,
72
- "asmparser" , "mcjit" , "interpreter" ,
75
+ let required_components = & [ "ipo" ,
76
+ "bitreader" ,
77
+ "bitwriter" ,
78
+ "linker" ,
79
+ "asmparser" ,
80
+ "mcjit" ,
81
+ "interpreter" ,
73
82
"instrumentation" ] ;
74
83
75
84
let components = output ( Command :: new ( & llvm_config) . arg ( "--components" ) ) ;
76
85
let mut components = components. split_whitespace ( ) . collect :: < Vec < _ > > ( ) ;
77
- components. retain ( |c| {
78
- optional_components. contains ( c) || required_components. contains ( c)
79
- } ) ;
86
+ components. retain ( |c| optional_components. contains ( c) || required_components. contains ( c) ) ;
80
87
81
88
for component in required_components {
82
89
if !components. contains ( component) {
@@ -96,7 +103,7 @@ fn main() {
96
103
for flag in cxxflags. split_whitespace ( ) {
97
104
// Ignore flags like `-m64` when we're doing a cross build
98
105
if is_crossed && flag. starts_with ( "-m" ) {
99
- continue
106
+ continue ;
100
107
}
101
108
cfg. flag ( flag) ;
102
109
}
@@ -131,7 +138,7 @@ fn main() {
131
138
} else if lib. starts_with ( "-" ) {
132
139
& lib[ 1 ..]
133
140
} else {
134
- continue
141
+ continue ;
135
142
} ;
136
143
137
144
// Don't need or want this library, but LLVM's CMake build system
@@ -140,10 +147,14 @@ fn main() {
140
147
// library and it otherwise may just pull in extra dependencies on
141
148
// libedit which we don't want
142
149
if name == "LLVMLineEditor" {
143
- continue
150
+ continue ;
144
151
}
145
152
146
- let kind = if name. starts_with ( "LLVM" ) { "static" } else { "dylib" } ;
153
+ let kind = if name. starts_with ( "LLVM" ) {
154
+ "static"
155
+ } else {
156
+ "dylib"
157
+ } ;
147
158
println ! ( "cargo:rustc-link-lib={}={}" , kind, name) ;
148
159
}
149
160
0 commit comments