]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/build/build.py
BaseTools: fix the typo in function name LanuchPostbuild
[mirror_edk2.git] / BaseTools / Source / Python / build / build.py
index 4f859bf5a774268c62c20ee9bfc89159ec19a8d8..45ccac1e139367961344c69e8798f7f7c19a5dc3 100644 (file)
@@ -265,15 +265,16 @@ def LaunchCommand(Command, WorkingDir):
     # It could be a string or sequence. We find that if command is a string in following Popen(),\r
     # ubuntu may fail with an error message that the command is not found.\r
     # So here we may need convert command from string to list instance.\r
-    if not isinstance(Command, list):\r
-        if platform.system() != 'Windows':\r
+    if platform.system() != 'Windows':\r
+        if not isinstance(Command, list):\r
             Command = Command.split()\r
+        Command = ' '.join(Command)\r
 \r
     Proc = None\r
     EndOfProcedure = None\r
     try:\r
         # launch the command\r
-        Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1)\r
+        Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True)\r
 \r
         # launch two threads to read the STDOUT and STDERR\r
         EndOfProcedure = Event()\r
@@ -775,8 +776,11 @@ class Build():
                 # This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf\r
                 ConfDirectoryPath = mws.join(self.WorkspaceDir, ConfDirectoryPath)\r
         else:\r
-            # Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf\r
-            ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')\r
+            if "CONF_PATH" in os.environ:\r
+                ConfDirectoryPath = os.path.normcase(os.path.normpath(os.environ["CONF_PATH"]))\r
+            else:\r
+                # Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf\r
+                ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')\r
         GlobalData.gConfDirectory = ConfDirectoryPath\r
         GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))\r
 \r
@@ -786,6 +790,7 @@ class Build():
             self.Db = WorkspaceDatabase(GlobalData.gDatabasePath, self.Reparse)\r
         self.BuildDatabase = self.Db.BuildObject\r
         self.Platform = None\r
+        self.ToolChainFamily = None\r
         self.LoadFixAddress = 0\r
         self.UniFlag        = BuildOptions.Flag\r
         self.BuildModules = []\r
@@ -811,7 +816,7 @@ class Build():
         if "EDK_TOOLS_BIN" in os.environ:\r
             # Print the same path style with WORKSPACE env. \r
             EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_BIN", os.path.normcase(os.path.normpath(os.environ["EDK_TOOLS_BIN"]))))\r
-\r
+        EdkLogger.quiet("%-16s = %s" % ("CONF_PATH", GlobalData.gConfDirectory))\r
         self.InitPreBuild()\r
         self.InitPostBuild()\r
         if self.PrebuildScript:\r
@@ -820,6 +825,8 @@ class Build():
             EdkLogger.quiet("%-16s = %s" % ("POSTBUILD", self.PostbuildScript))\r
         if self.PrebuildScript:\r
             self.LaunchPrebuild()\r
+            self.TargetTxt = TargetTxtClassObject()\r
+            self.ToolDef   = ToolDefClassObject()\r
         if not (self.LaunchPrebuildFlag and os.path.exists(self.PlatformBuildPath)):\r
             self.InitBuild()\r
 \r
@@ -878,6 +885,17 @@ class Build():
         else:\r
             self.ToolChainList = NewToolChainList\r
 \r
+        ToolChainFamily = []\r
+        ToolDefinition = self.ToolDef.ToolsDefTxtDatabase\r
+        for Tool in self.ToolChainList:\r
+            if TAB_TOD_DEFINES_FAMILY not in ToolDefinition or Tool not in ToolDefinition[TAB_TOD_DEFINES_FAMILY] \\r
+               or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool]:\r
+                EdkLogger.warn("No tool chain family found in configuration for %s. Default to MSFT." % Tool)\r
+                ToolChainFamily.append("MSFT")\r
+            else:\r
+                ToolChainFamily.append(ToolDefinition[TAB_TOD_DEFINES_FAMILY][Tool])\r
+        self.ToolChainFamily = ToolChainFamily\r
+\r
         if self.ThreadNumber == None:\r
             self.ThreadNumber = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER]\r
             if self.ThreadNumber == '':\r
@@ -936,6 +954,8 @@ class Build():
         if self.ToolChainList:\r
             GlobalData.gGlobalDefines['TOOLCHAIN'] = self.ToolChainList[0]\r
             GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = self.ToolChainList[0]\r
+        if self.ToolChainFamily:\r
+            GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[0]\r
         if 'PREBUILD' in GlobalData.gCommandLineDefines.keys():\r
             self.Prebuild   = GlobalData.gCommandLineDefines.get('PREBUILD')\r
         else:\r
@@ -969,7 +989,6 @@ class Build():
                 self.PostbuildScript = PostbuildList[0]\r
                 self.Postbuild = ' '.join(PostbuildList)\r
                 self.Postbuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList)\r
-                #self.LanuchPostbuild()\r
             else:\r
                 EdkLogger.error("Postbuild", POSTBUILD_ERROR, "the postbuild script %s is not exist.\n If you'd like to disable the Postbuild process, please use the format: -D POSTBUILD=\"\" " %(PostbuildList[0]))\r
 \r
@@ -1056,7 +1075,7 @@ class Build():
                 os.environ.update(dict(envs))\r
             EdkLogger.info("\n- Prebuild Done -\n")\r
 \r
-    def LanuchPostbuild(self):\r
+    def LaunchPostbuild(self):\r
         if self.Postbuild:\r
             EdkLogger.info("\n- Postbuild Start -\n")\r
             if sys.platform == "win32":\r
@@ -1599,9 +1618,12 @@ class Build():
         SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE auto-generated\n', False)\r
         for BuildTarget in self.BuildTargetList:\r
             GlobalData.gGlobalDefines['TARGET'] = BuildTarget\r
+            index = 0\r
             for ToolChain in self.ToolChainList:\r
                 GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain\r
                 GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain\r
+                GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]\r
+                index += 1\r
                 Wa = WorkspaceAutoGen(\r
                         self.WorkspaceDir,\r
                         self.PlatformFile,\r
@@ -1679,9 +1701,12 @@ class Build():
     def _BuildModule(self):\r
         for BuildTarget in self.BuildTargetList:\r
             GlobalData.gGlobalDefines['TARGET'] = BuildTarget\r
+            index = 0\r
             for ToolChain in self.ToolChainList:\r
                 GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain\r
                 GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain\r
+                GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]\r
+                index += 1\r
                 #\r
                 # module build needs platform build information, so get platform\r
                 # AutoGen first\r
@@ -1773,9 +1798,12 @@ class Build():
         SaveFileOnChange(self.PlatformBuildPath, '# DO NOT EDIT \n# FILE auto-generated\n', False)\r
         for BuildTarget in self.BuildTargetList:\r
             GlobalData.gGlobalDefines['TARGET'] = BuildTarget\r
+            index = 0\r
             for ToolChain in self.ToolChainList:\r
                 GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain\r
                 GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain\r
+                GlobalData.gGlobalDefines['FAMILY'] = self.ToolChainFamily[index]\r
+                index += 1\r
                 Wa = WorkspaceAutoGen(\r
                         self.WorkspaceDir,\r
                         self.PlatformFile,\r
@@ -2302,7 +2330,7 @@ def Main():
 \r
     if ReturnCode == 0:\r
         try:\r
-            MyBuild.LanuchPostbuild()\r
+            MyBuild.LaunchPostbuild()\r
             Conclusion = "Done"\r
         except:\r
             Conclusion = "Failed"\r