@@ -314,7 +314,6 @@ def __init__(self):
314314 self .build_dir = os .path .join (os .getcwd (), "build" )
315315 self .clean = False
316316 self .config_toml = ''
317- self .printed = False
318317 self .rust_root = os .path .abspath (os .path .join (__file__ , '../../..' ))
319318 self .use_locked_deps = ''
320319 self .use_vendored_sources = ''
@@ -336,7 +335,6 @@ def download_stage0(self):
336335 if self .rustc ().startswith (self .bin_root ()) and \
337336 (not os .path .exists (self .rustc ()) or
338337 self .program_out_of_date (self .rustc_stamp ())):
339- self .print_what_bootstrap_means ()
340338 if os .path .exists (self .bin_root ()):
341339 shutil .rmtree (self .bin_root ())
342340 filename = "rust-std-{}-{}.tar.gz" .format (
@@ -351,10 +349,17 @@ def download_stage0(self):
351349 with open (self .rustc_stamp (), 'w' ) as rust_stamp :
352350 rust_stamp .write (self .date )
353351
352+ # This is required so that we don't mix incompatible MinGW
353+ # libraries/binaries that are included in rust-std with
354+ # the system MinGW ones.
355+ if "pc-windows-gnu" in self .build :
356+ filename = "rust-mingw-{}-{}.tar.gz" .format (
357+ rustc_channel , self .build )
358+ self ._download_stage0_helper (filename , "rust-mingw" )
359+
354360 if self .cargo ().startswith (self .bin_root ()) and \
355361 (not os .path .exists (self .cargo ()) or
356362 self .program_out_of_date (self .cargo_stamp ())):
357- self .print_what_bootstrap_means ()
358363 filename = "cargo-{}-{}.tar.gz" .format (cargo_channel , self .build )
359364 self ._download_stage0_helper (filename , "cargo" )
360365 self .fix_executable ("{}/bin/cargo" .format (self .bin_root ()))
@@ -555,23 +560,6 @@ def exe_suffix():
555560 return '.exe'
556561 return ''
557562
558- def print_what_bootstrap_means (self ):
559- """Prints more information about the build system"""
560- if hasattr (self , 'printed' ):
561- return
562- self .printed = True
563- if os .path .exists (self .bootstrap_binary ()):
564- return
565- if '--help' not in sys .argv or len (sys .argv ) == 1 :
566- return
567-
568- print ('info: the build system for Rust is written in Rust, so this' )
569- print (' script is now going to download a stage0 rust compiler' )
570- print (' and then compile the build system itself' )
571- print ('' )
572- print ('info: in the meantime you can read more about rustbuild at' )
573- print (' src/bootstrap/README.md before the download finishes' )
574-
575563 def bootstrap_binary (self ):
576564 """Return the path of the boostrap binary
577565
@@ -585,7 +573,6 @@ def bootstrap_binary(self):
585573
586574 def build_bootstrap (self ):
587575 """Build bootstrap"""
588- self .print_what_bootstrap_means ()
589576 build_dir = os .path .join (self .build_dir , "bootstrap" )
590577 if self .clean and os .path .exists (build_dir ):
591578 shutil .rmtree (build_dir )
@@ -654,6 +641,10 @@ def update_submodules(self):
654641 continue
655642 if self .get_toml ('jemalloc' ):
656643 continue
644+ if module .endswith ("lld" ):
645+ config = self .get_toml ('lld' )
646+ if config is None or config == 'false' :
647+ continue
657648 filtered_submodules .append (module )
658649 run (["git" , "submodule" , "update" ,
659650 "--init" , "--recursive" ] + filtered_submodules ,
@@ -670,8 +661,16 @@ def set_dev_environment(self):
670661 self ._download_url = 'https://dev-static.rust-lang.org'
671662
672663
673- def bootstrap ():
664+ def bootstrap (help_triggered ):
674665 """Configure, fetch, build and run the initial bootstrap"""
666+
667+ # If the user is asking for help, let them know that the whole download-and-build
668+ # process has to happen before anything is printed out.
669+ if help_triggered :
670+ print ("info: Downloading and building bootstrap before processing --help" )
671+ print (" command. See src/bootstrap/README.md for help with common" )
672+ print (" commands." )
673+
675674 parser = argparse .ArgumentParser (description = 'Build rust' )
676675 parser .add_argument ('--config' )
677676 parser .add_argument ('--build' )
@@ -708,7 +707,7 @@ def bootstrap():
708707 print (' and so in order to preserve your $HOME this will now' )
709708 print (' use vendored sources by default. Note that if this' )
710709 print (' does not work you should run a normal build first' )
711- print (' before running a command like `sudo make install`' )
710+ print (' before running a command like `sudo ./x.py install`' )
712711
713712 if build .use_vendored_sources :
714713 if not os .path .exists ('.cargo' ):
@@ -734,7 +733,10 @@ def bootstrap():
734733 if 'dev' in data :
735734 build .set_dev_environment ()
736735
737- build .update_submodules ()
736+ # No help text depends on submodules. This check saves ~1 minute of git commands, even if
737+ # all the submodules are present and downloaded!
738+ if not help_triggered :
739+ build .update_submodules ()
738740
739741 # Fetch/build the bootstrap
740742 build .build = args .build or build .build_triple ()
@@ -760,7 +762,7 @@ def main():
760762 help_triggered = (
761763 '-h' in sys .argv ) or ('--help' in sys .argv ) or (len (sys .argv ) == 1 )
762764 try :
763- bootstrap ()
765+ bootstrap (help_triggered )
764766 if not help_triggered :
765767 print ("Build completed successfully in {}" .format (
766768 format_build_time (time () - start_time )))
0 commit comments