@@ -23,6 +23,7 @@ use std::process;
23
23
use num_cpus;
24
24
use rustc_serialize:: Decodable ;
25
25
use toml:: { Parser , Decoder , Value } ;
26
+ use util:: push_exe_path;
26
27
27
28
/// Global configuration for the entire build and/or bootstrap.
28
29
///
@@ -86,6 +87,7 @@ pub struct Config {
86
87
pub mandir : Option < String > ,
87
88
pub codegen_tests : bool ,
88
89
pub nodejs : Option < PathBuf > ,
90
+ pub gdb : Option < PathBuf > ,
89
91
}
90
92
91
93
/// Per-target configuration stored in the global configuration structure.
@@ -123,6 +125,7 @@ struct Build {
123
125
compiler_docs : Option < bool > ,
124
126
docs : Option < bool > ,
125
127
submodules : Option < bool > ,
128
+ gdb : Option < String > ,
126
129
}
127
130
128
131
/// TOML representation of how the LLVM build is configured.
@@ -227,6 +230,7 @@ impl Config {
227
230
}
228
231
config. rustc = build. rustc . map ( PathBuf :: from) ;
229
232
config. cargo = build. cargo . map ( PathBuf :: from) ;
233
+ config. gdb = build. gdb . map ( PathBuf :: from) ;
230
234
set ( & mut config. compiler_docs , build. compiler_docs ) ;
231
235
set ( & mut config. docs , build. docs ) ;
232
236
set ( & mut config. submodules , build. submodules ) ;
@@ -356,44 +360,47 @@ impl Config {
356
360
. collect ( ) ;
357
361
}
358
362
"CFG_MUSL_ROOT" if value. len ( ) > 0 => {
359
- self . musl_root = Some ( PathBuf :: from ( value) ) ;
363
+ self . musl_root = Some ( parse_configure_path ( value) ) ;
360
364
}
361
365
"CFG_MUSL_ROOT_X86_64" if value. len ( ) > 0 => {
362
366
let target = "x86_64-unknown-linux-musl" . to_string ( ) ;
363
367
let target = self . target_config . entry ( target)
364
368
. or_insert ( Target :: default ( ) ) ;
365
- target. musl_root = Some ( PathBuf :: from ( value) ) ;
369
+ target. musl_root = Some ( parse_configure_path ( value) ) ;
366
370
}
367
371
"CFG_MUSL_ROOT_I686" if value. len ( ) > 0 => {
368
372
let target = "i686-unknown-linux-musl" . to_string ( ) ;
369
373
let target = self . target_config . entry ( target)
370
374
. or_insert ( Target :: default ( ) ) ;
371
- target. musl_root = Some ( PathBuf :: from ( value) ) ;
375
+ target. musl_root = Some ( parse_configure_path ( value) ) ;
372
376
}
373
377
"CFG_MUSL_ROOT_ARM" if value. len ( ) > 0 => {
374
378
let target = "arm-unknown-linux-musleabi" . to_string ( ) ;
375
379
let target = self . target_config . entry ( target)
376
380
. or_insert ( Target :: default ( ) ) ;
377
- target. musl_root = Some ( PathBuf :: from ( value) ) ;
381
+ target. musl_root = Some ( parse_configure_path ( value) ) ;
378
382
}
379
383
"CFG_MUSL_ROOT_ARMHF" if value. len ( ) > 0 => {
380
384
let target = "arm-unknown-linux-musleabihf" . to_string ( ) ;
381
385
let target = self . target_config . entry ( target)
382
386
. or_insert ( Target :: default ( ) ) ;
383
- target. musl_root = Some ( PathBuf :: from ( value) ) ;
387
+ target. musl_root = Some ( parse_configure_path ( value) ) ;
384
388
}
385
389
"CFG_MUSL_ROOT_ARMV7" if value. len ( ) > 0 => {
386
390
let target = "armv7-unknown-linux-musleabihf" . to_string ( ) ;
387
391
let target = self . target_config . entry ( target)
388
392
. or_insert ( Target :: default ( ) ) ;
389
- target. musl_root = Some ( PathBuf :: from ( value) ) ;
393
+ target. musl_root = Some ( parse_configure_path ( value) ) ;
390
394
}
391
395
"CFG_DEFAULT_AR" if value. len ( ) > 0 => {
392
396
self . rustc_default_ar = Some ( value. to_string ( ) ) ;
393
397
}
394
398
"CFG_DEFAULT_LINKER" if value. len ( ) > 0 => {
395
399
self . rustc_default_linker = Some ( value. to_string ( ) ) ;
396
400
}
401
+ "CFG_GDB" if value. len ( ) > 0 => {
402
+ self . gdb = Some ( parse_configure_path ( value) ) ;
403
+ }
397
404
"CFG_RELEASE_CHANNEL" => {
398
405
self . channel = value. to_string ( ) ;
399
406
}
@@ -412,41 +419,42 @@ impl Config {
412
419
"CFG_LLVM_ROOT" if value. len ( ) > 0 => {
413
420
let target = self . target_config . entry ( self . build . clone ( ) )
414
421
. or_insert ( Target :: default ( ) ) ;
415
- let root = PathBuf :: from ( value) ;
416
- target. llvm_config = Some ( root . join ( "bin/ llvm-config" ) ) ;
422
+ let root = parse_configure_path ( value) ;
423
+ target. llvm_config = Some ( push_exe_path ( root , & [ "bin" , " llvm-config"] ) ) ;
417
424
}
418
425
"CFG_JEMALLOC_ROOT" if value. len ( ) > 0 => {
419
426
let target = self . target_config . entry ( self . build . clone ( ) )
420
427
. or_insert ( Target :: default ( ) ) ;
421
- target. jemalloc = Some ( PathBuf :: from ( value) ) ;
428
+ target. jemalloc = Some ( parse_configure_path ( value) ) ;
422
429
}
423
430
"CFG_ARM_LINUX_ANDROIDEABI_NDK" if value. len ( ) > 0 => {
424
431
let target = "arm-linux-androideabi" . to_string ( ) ;
425
432
let target = self . target_config . entry ( target)
426
433
. or_insert ( Target :: default ( ) ) ;
427
- target. ndk = Some ( PathBuf :: from ( value) ) ;
434
+ target. ndk = Some ( parse_configure_path ( value) ) ;
428
435
}
429
436
"CFG_ARMV7_LINUX_ANDROIDEABI_NDK" if value. len ( ) > 0 => {
430
437
let target = "armv7-linux-androideabi" . to_string ( ) ;
431
438
let target = self . target_config . entry ( target)
432
439
. or_insert ( Target :: default ( ) ) ;
433
- target. ndk = Some ( PathBuf :: from ( value) ) ;
440
+ target. ndk = Some ( parse_configure_path ( value) ) ;
434
441
}
435
442
"CFG_I686_LINUX_ANDROID_NDK" if value. len ( ) > 0 => {
436
443
let target = "i686-linux-android" . to_string ( ) ;
437
444
let target = self . target_config . entry ( target)
438
445
. or_insert ( Target :: default ( ) ) ;
439
- target. ndk = Some ( PathBuf :: from ( value) ) ;
446
+ target. ndk = Some ( parse_configure_path ( value) ) ;
440
447
}
441
448
"CFG_AARCH64_LINUX_ANDROID_NDK" if value. len ( ) > 0 => {
442
449
let target = "aarch64-linux-android" . to_string ( ) ;
443
450
let target = self . target_config . entry ( target)
444
451
. or_insert ( Target :: default ( ) ) ;
445
- target. ndk = Some ( PathBuf :: from ( value) ) ;
452
+ target. ndk = Some ( parse_configure_path ( value) ) ;
446
453
}
447
454
"CFG_LOCAL_RUST_ROOT" if value. len ( ) > 0 => {
448
- self . rustc = Some ( PathBuf :: from ( value) . join ( "bin/rustc" ) ) ;
449
- self . cargo = Some ( PathBuf :: from ( value) . join ( "bin/cargo" ) ) ;
455
+ let path = parse_configure_path ( value) ;
456
+ self . rustc = Some ( push_exe_path ( path. clone ( ) , & [ "bin" , "rustc" ] ) ) ;
457
+ self . cargo = Some ( push_exe_path ( path, & [ "bin" , "cargo" ] ) ) ;
450
458
}
451
459
_ => { }
452
460
}
0 commit comments