@@ -21,20 +21,25 @@ fn main() {
2121 println ! ( "cargo:rustc-cfg=cargobuild" ) ;
2222
2323 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+ } ) ;
3843
3944 println ! ( "cargo:rerun-if-changed={}" , llvm_config. display( ) ) ;
4045
@@ -63,20 +68,22 @@ fn main() {
6368 let host = env:: var ( "HOST" ) . unwrap ( ) ;
6469 let is_crossed = target != host;
6570
66- let optional_components = [ "x86" , "arm" , "aarch64" , "mips" , "powerpc" ,
67- "pnacl" ] ;
71+ let optional_components = [ "x86" , "arm" , "aarch64" , "mips" , "powerpc" , "pnacl" ] ;
6872
6973 // FIXME: surely we don't need all these components, right? Stuff like mcjit
7074 // 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" ,
7382 "instrumentation" ] ;
7483
7584 let components = output ( Command :: new ( & llvm_config) . arg ( "--components" ) ) ;
7685 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) ) ;
8087
8188 for component in required_components {
8289 if !components. contains ( component) {
@@ -96,7 +103,7 @@ fn main() {
96103 for flag in cxxflags. split_whitespace ( ) {
97104 // Ignore flags like `-m64` when we're doing a cross build
98105 if is_crossed && flag. starts_with ( "-m" ) {
99- continue
106+ continue ;
100107 }
101108 cfg. flag ( flag) ;
102109 }
@@ -131,7 +138,7 @@ fn main() {
131138 } else if lib. starts_with ( "-" ) {
132139 & lib[ 1 ..]
133140 } else {
134- continue
141+ continue ;
135142 } ;
136143
137144 // Don't need or want this library, but LLVM's CMake build system
@@ -140,10 +147,14 @@ fn main() {
140147 // library and it otherwise may just pull in extra dependencies on
141148 // libedit which we don't want
142149 if name == "LLVMLineEditor" {
143- continue
150+ continue ;
144151 }
145152
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+ } ;
147158 println ! ( "cargo:rustc-link-lib={}={}" , kind, name) ;
148159 }
149160
0 commit comments