@@ -115,6 +115,11 @@ pub(super) fn handle_needs(
115
115
condition : cache. x86_64_dlltool ,
116
116
ignore_reason : "ignored when dlltool for x86_64 is not present" ,
117
117
} ,
118
+ Need {
119
+ name : "needs-dlltool" ,
120
+ condition : cache. dlltool ,
121
+ ignore_reason : "ignored when dlltool for the current architecture is not present" ,
122
+ } ,
118
123
Need {
119
124
name : "needs-git-hash" ,
120
125
condition : config. git_hash ,
@@ -183,13 +188,25 @@ pub(super) struct CachedNeedsConditions {
183
188
rust_lld : bool ,
184
189
i686_dlltool : bool ,
185
190
x86_64_dlltool : bool ,
191
+ dlltool : bool ,
186
192
}
187
193
188
194
impl CachedNeedsConditions {
189
195
pub ( super ) fn load ( config : & Config ) -> Self {
190
196
let path = std:: env:: var_os ( "PATH" ) . expect ( "missing PATH environment variable" ) ;
191
197
let path = std:: env:: split_paths ( & path) . collect :: < Vec < _ > > ( ) ;
192
198
199
+ // On Windows, dlltool.exe is used for all architectures.
200
+ #[ cfg( windows) ]
201
+ let dlltool = path. iter ( ) . any ( |dir| dir. join ( "dlltool.exe" ) . is_file ( ) ) ;
202
+
203
+ // For non-Windows, there are architecture specific dlltool binaries.
204
+ #[ cfg( not( windows) ) ]
205
+ let i686_dlltool = path. iter ( ) . any ( |dir| dir. join ( "i686-w64-mingw32-dlltool" ) . is_file ( ) ) ;
206
+ #[ cfg( not( windows) ) ]
207
+ let x86_64_dlltool =
208
+ path. iter ( ) . any ( |dir| dir. join ( "x86_64-w64-mingw32-dlltool" ) . is_file ( ) ) ;
209
+
193
210
let target = & & * config. target ;
194
211
Self {
195
212
sanitizer_support : std:: env:: var_os ( "RUSTC_SANITIZER_SUPPORT" ) . is_some ( ) ,
@@ -225,17 +242,26 @@ impl CachedNeedsConditions {
225
242
. join ( if config. host . contains ( "windows" ) { "rust-lld.exe" } else { "rust-lld" } )
226
243
. exists ( ) ,
227
244
228
- // On Windows, dlltool.exe is used for all architectures.
229
245
#[ cfg( windows) ]
230
- i686_dlltool : path . iter ( ) . any ( |dir| dir . join ( " dlltool.exe" ) . is_file ( ) ) ,
246
+ i686_dlltool : dlltool,
231
247
#[ cfg( windows) ]
232
- x86_64_dlltool : path. iter ( ) . any ( |dir| dir. join ( "dlltool.exe" ) . is_file ( ) ) ,
248
+ x86_64_dlltool : dlltool,
249
+ #[ cfg( windows) ]
250
+ dlltool,
233
251
234
252
// For non-Windows, there are architecture specific dlltool binaries.
235
253
#[ cfg( not( windows) ) ]
236
- i686_dlltool : path. iter ( ) . any ( |dir| dir. join ( "i686-w64-mingw32-dlltool" ) . is_file ( ) ) ,
254
+ i686_dlltool,
255
+ #[ cfg( not( windows) ) ]
256
+ x86_64_dlltool,
237
257
#[ cfg( not( windows) ) ]
238
- x86_64_dlltool : path. iter ( ) . any ( |dir| dir. join ( "x86_64-w64-mingw32-dlltool" ) . is_file ( ) ) ,
258
+ dlltool : if config. matches_arch ( "x86" ) {
259
+ i686_dlltool
260
+ } else if config. matches_arch ( "x86_64" ) {
261
+ x86_64_dlltool
262
+ } else {
263
+ false
264
+ } ,
239
265
}
240
266
}
241
267
}
0 commit comments