mingw-gcc-build.py: Add ability to skip building GCC or binutils
authorjljusten <jljusten@c2973edb-eda0-4c78-bc6a-9341b269661f>
Thu, 25 Feb 2010 22:02:59 +0000 (22:02 +0000)
committerjljusten <jljusten@c2973edb-eda0-4c78-bc6a-9341b269661f>
Thu, 25 Feb 2010 22:02:59 +0000 (22:02 +0000)
Added --skip-binutils and --skip-gcc parameters.

A recent upgrade to the binutils version make it useful to just
build the binutils without rebuilding GCC.

git-svn-id: https://edk2-buildtools.svn.sourceforge.net/svnroot/edk2-buildtools/trunk/BaseTools@1902 c2973edb-eda0-4c78-bc6a-9341b269661f

gcc/mingw-gcc-build.py

index 36079a1..f01bedc 100755 (executable)
@@ -92,6 +92,18 @@ class Config:
             default = os.path.join(self.base_dir, 'install'),
             help = "Prefix to install binutils/gcc into"
             )
             default = os.path.join(self.base_dir, 'install'),
             help = "Prefix to install binutils/gcc into"
             )
+        Parser.add_option(
+            "--skip-binutils",
+            action = "store_true", dest = "skip_binutils",
+            default = False,
+            help = "Will skip building binutils"
+            )
+        Parser.add_option(
+            "--skip-gcc",
+            action = "store_true", dest = "skip_gcc",
+            default = False,
+            help = "Will skip building GCC"
+            )
         Parser.add_option(
             "--symlinks",
             action = "store", type = "string", dest = "symlinks",
         Parser.add_option(
             "--symlinks",
             action = "store", type = "string", dest = "symlinks",
@@ -127,13 +139,25 @@ class Config:
         self.symlinks = os.path.realpath(os.path.expanduser(self.options.symlinks))
 
     def IsConfigOk(self):
         self.symlinks = os.path.realpath(os.path.expanduser(self.options.symlinks))
 
     def IsConfigOk(self):
-                
+
+        building = []
+        if not self.options.skip_binutils:
+            building.append('binutils')
+        if not self.options.skip_gcc:
+            building.append('gcc')
+        if len(building) == 0:
+            print "Nothing will be built!"
+            print
+            print "Please try using --help and then change the configuration."
+            return False
+
         print "Current directory:"
         print "   ", self.base_dir
         print "Sources download/extraction:", self.Relative(self.src_dir)
         print "Build directory            :", self.Relative(self.build_dir)
         print "Prefix (install) directory :", self.Relative(self.prefix)
         print "Create symlinks directory  :", self.Relative(self.symlinks)
         print "Current directory:"
         print "   ", self.base_dir
         print "Sources download/extraction:", self.Relative(self.src_dir)
         print "Build directory            :", self.Relative(self.build_dir)
         print "Prefix (install) directory :", self.Relative(self.prefix)
         print "Create symlinks directory  :", self.Relative(self.symlinks)
+        print "Building                   :", ', '.join(building)
         print
         answer = raw_input("Is this configuration ok? (default = no): ")
         if (answer.lower() not in ('y', 'yes')):
         print
         answer = raw_input("Is this configuration ok? (default = no): ")
         if (answer.lower() not in ('y', 'yes')):
@@ -175,6 +199,13 @@ class SourceFiles:
         self.config = config
         self.source_files = self.source_files[config.arch]
 
         self.config = config
         self.source_files = self.source_files[config.arch]
 
+        if config.options.skip_binutils:
+            del self.source_files['binutils']
+
+        if config.options.skip_gcc:
+            del self.source_files['gcc']
+            del self.source_files['mingw_hdr']
+
     source_files_common = {
         'binutils': {
             'url': 'http://www.kernel.org/pub/linux/devel/binutils/' + \
     source_files_common = {
         'binutils': {
             'url': 'http://www.kernel.org/pub/linux/devel/binutils/' + \
@@ -405,10 +436,12 @@ class Builder:
         self.config = config
 
     def Build(self):
         self.config = config
 
     def Build(self):
-        self.BuildModule('binutils')
-        self.CopyIncludeDirectory()
-        self.BuildModule('gcc')
-        self.MakeSymLinks()
+        if not self.config.options.skip_binutils:
+            self.BuildModule('binutils')
+        if not self.config.options.skip_gcc:
+            self.CopyIncludeDirectory()
+            self.BuildModule('gcc')
+            self.MakeSymLinks()
 
     def IsBuildStepComplete(self, step):
         return \
 
     def IsBuildStepComplete(self, step):
         return \