@@ -2122,15 +2122,46 @@ impl Step for LlvmTools {
2122
2122
2123
2123
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
2124
2124
let default = should_build_extended_tool ( run. builder , "llvm-tools" ) ;
2125
- // FIXME: allow using the names of the tools themselves?
2126
- run. alias ( "llvm-tools" ) . default_condition ( default)
2125
+
2126
+ let mut run = run. alias ( "llvm-tools" ) ;
2127
+ for tool in LLVM_TOOLS {
2128
+ run = run. alias ( tool) ;
2129
+ }
2130
+
2131
+ run. default_condition ( default)
2127
2132
}
2128
2133
2129
2134
fn make_run ( run : RunConfig < ' _ > ) {
2130
2135
run. builder . ensure ( LlvmTools { target : run. target } ) ;
2131
2136
}
2132
2137
2133
2138
fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
2139
+ fn tools_to_install ( paths : & [ PathBuf ] ) -> Vec < & ' static str > {
2140
+ let mut tools = vec ! [ ] ;
2141
+
2142
+ for path in paths {
2143
+ let path = path. to_str ( ) . unwrap ( ) ;
2144
+
2145
+ // Include all tools if path is 'llvm-tools'.
2146
+ if path == "llvm-tools" {
2147
+ return LLVM_TOOLS . to_owned ( ) ;
2148
+ }
2149
+
2150
+ for tool in LLVM_TOOLS {
2151
+ if path == * tool {
2152
+ tools. push ( * tool) ;
2153
+ }
2154
+ }
2155
+ }
2156
+
2157
+ // If no specific tool is requested, include all tools.
2158
+ if tools. is_empty ( ) {
2159
+ tools = LLVM_TOOLS . to_owned ( ) ;
2160
+ }
2161
+
2162
+ tools
2163
+ }
2164
+
2134
2165
let target = self . target ;
2135
2166
2136
2167
/* run only if llvm-config isn't used */
@@ -2151,7 +2182,7 @@ impl Step for LlvmTools {
2151
2182
// Prepare the image directory
2152
2183
let src_bindir = builder. llvm_out ( target) . join ( "bin" ) ;
2153
2184
let dst_bindir = format ! ( "lib/rustlib/{}/bin" , target. triple) ;
2154
- for tool in LLVM_TOOLS {
2185
+ for tool in tools_to_install ( & builder . paths ) {
2155
2186
let exe = src_bindir. join ( exe ( tool, target) ) ;
2156
2187
tarball. add_file ( & exe, & dst_bindir, 0o755 ) ;
2157
2188
}
0 commit comments