@@ -23,6 +23,7 @@ use std::process;
2323use num_cpus;
2424use rustc_serialize:: Decodable ;
2525use toml:: { Parser , Decoder , Value } ;
26+ use util:: push_exe_path;
2627
2728/// Global configuration for the entire build and/or bootstrap.
2829///
@@ -86,6 +87,7 @@ pub struct Config {
8687 pub mandir : Option < String > ,
8788 pub codegen_tests : bool ,
8889 pub nodejs : Option < PathBuf > ,
90+ pub gdb : Option < PathBuf > ,
8991}
9092
9193/// Per-target configuration stored in the global configuration structure.
@@ -123,6 +125,7 @@ struct Build {
123125 compiler_docs : Option < bool > ,
124126 docs : Option < bool > ,
125127 submodules : Option < bool > ,
128+ gdb : Option < String > ,
126129}
127130
128131/// TOML representation of how the LLVM build is configured.
@@ -227,6 +230,7 @@ impl Config {
227230 }
228231 config. rustc = build. rustc . map ( PathBuf :: from) ;
229232 config. cargo = build. cargo . map ( PathBuf :: from) ;
233+ config. gdb = build. gdb . map ( PathBuf :: from) ;
230234 set ( & mut config. compiler_docs , build. compiler_docs ) ;
231235 set ( & mut config. docs , build. docs ) ;
232236 set ( & mut config. submodules , build. submodules ) ;
@@ -356,44 +360,47 @@ impl Config {
356360 . collect ( ) ;
357361 }
358362 "CFG_MUSL_ROOT" if value. len ( ) > 0 => {
359- self . musl_root = Some ( PathBuf :: from ( value) ) ;
363+ self . musl_root = Some ( parse_configure_path ( value) ) ;
360364 }
361365 "CFG_MUSL_ROOT_X86_64" if value. len ( ) > 0 => {
362366 let target = "x86_64-unknown-linux-musl" . to_string ( ) ;
363367 let target = self . target_config . entry ( target)
364368 . or_insert ( Target :: default ( ) ) ;
365- target. musl_root = Some ( PathBuf :: from ( value) ) ;
369+ target. musl_root = Some ( parse_configure_path ( value) ) ;
366370 }
367371 "CFG_MUSL_ROOT_I686" if value. len ( ) > 0 => {
368372 let target = "i686-unknown-linux-musl" . to_string ( ) ;
369373 let target = self . target_config . entry ( target)
370374 . or_insert ( Target :: default ( ) ) ;
371- target. musl_root = Some ( PathBuf :: from ( value) ) ;
375+ target. musl_root = Some ( parse_configure_path ( value) ) ;
372376 }
373377 "CFG_MUSL_ROOT_ARM" if value. len ( ) > 0 => {
374378 let target = "arm-unknown-linux-musleabi" . to_string ( ) ;
375379 let target = self . target_config . entry ( target)
376380 . or_insert ( Target :: default ( ) ) ;
377- target. musl_root = Some ( PathBuf :: from ( value) ) ;
381+ target. musl_root = Some ( parse_configure_path ( value) ) ;
378382 }
379383 "CFG_MUSL_ROOT_ARMHF" if value. len ( ) > 0 => {
380384 let target = "arm-unknown-linux-musleabihf" . to_string ( ) ;
381385 let target = self . target_config . entry ( target)
382386 . or_insert ( Target :: default ( ) ) ;
383- target. musl_root = Some ( PathBuf :: from ( value) ) ;
387+ target. musl_root = Some ( parse_configure_path ( value) ) ;
384388 }
385389 "CFG_MUSL_ROOT_ARMV7" if value. len ( ) > 0 => {
386390 let target = "armv7-unknown-linux-musleabihf" . to_string ( ) ;
387391 let target = self . target_config . entry ( target)
388392 . or_insert ( Target :: default ( ) ) ;
389- target. musl_root = Some ( PathBuf :: from ( value) ) ;
393+ target. musl_root = Some ( parse_configure_path ( value) ) ;
390394 }
391395 "CFG_DEFAULT_AR" if value. len ( ) > 0 => {
392396 self . rustc_default_ar = Some ( value. to_string ( ) ) ;
393397 }
394398 "CFG_DEFAULT_LINKER" if value. len ( ) > 0 => {
395399 self . rustc_default_linker = Some ( value. to_string ( ) ) ;
396400 }
401+ "CFG_GDB" if value. len ( ) > 0 => {
402+ self . gdb = Some ( parse_configure_path ( value) ) ;
403+ }
397404 "CFG_RELEASE_CHANNEL" => {
398405 self . channel = value. to_string ( ) ;
399406 }
@@ -412,41 +419,42 @@ impl Config {
412419 "CFG_LLVM_ROOT" if value. len ( ) > 0 => {
413420 let target = self . target_config . entry ( self . build . clone ( ) )
414421 . 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"] ) ) ;
417424 }
418425 "CFG_JEMALLOC_ROOT" if value. len ( ) > 0 => {
419426 let target = self . target_config . entry ( self . build . clone ( ) )
420427 . or_insert ( Target :: default ( ) ) ;
421- target. jemalloc = Some ( PathBuf :: from ( value) ) ;
428+ target. jemalloc = Some ( parse_configure_path ( value) ) ;
422429 }
423430 "CFG_ARM_LINUX_ANDROIDEABI_NDK" if value. len ( ) > 0 => {
424431 let target = "arm-linux-androideabi" . to_string ( ) ;
425432 let target = self . target_config . entry ( target)
426433 . or_insert ( Target :: default ( ) ) ;
427- target. ndk = Some ( PathBuf :: from ( value) ) ;
434+ target. ndk = Some ( parse_configure_path ( value) ) ;
428435 }
429436 "CFG_ARMV7_LINUX_ANDROIDEABI_NDK" if value. len ( ) > 0 => {
430437 let target = "armv7-linux-androideabi" . to_string ( ) ;
431438 let target = self . target_config . entry ( target)
432439 . or_insert ( Target :: default ( ) ) ;
433- target. ndk = Some ( PathBuf :: from ( value) ) ;
440+ target. ndk = Some ( parse_configure_path ( value) ) ;
434441 }
435442 "CFG_I686_LINUX_ANDROID_NDK" if value. len ( ) > 0 => {
436443 let target = "i686-linux-android" . to_string ( ) ;
437444 let target = self . target_config . entry ( target)
438445 . or_insert ( Target :: default ( ) ) ;
439- target. ndk = Some ( PathBuf :: from ( value) ) ;
446+ target. ndk = Some ( parse_configure_path ( value) ) ;
440447 }
441448 "CFG_AARCH64_LINUX_ANDROID_NDK" if value. len ( ) > 0 => {
442449 let target = "aarch64-linux-android" . to_string ( ) ;
443450 let target = self . target_config . entry ( target)
444451 . or_insert ( Target :: default ( ) ) ;
445- target. ndk = Some ( PathBuf :: from ( value) ) ;
452+ target. ndk = Some ( parse_configure_path ( value) ) ;
446453 }
447454 "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" ] ) ) ;
450458 }
451459 _ => { }
452460 }
0 commit comments