]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Edk2Setup.bat
SecurityPkg: Add TPM PTP support in TCG2 SMM.
[mirror_edk2.git] / Edk2Setup.bat
index bdf85c221f6b89edf6ca708382d65e57afe841d3..2d132349bc326e94951510667628c12c08fd0c8b 100755 (executable)
 @REM #\r
 @echo off\r
 @set SCRIPT_NAME=%0\r
-@set SCRIPT_VERSION=0.9.0.\r
-@set SVN_REVISION=$Revision: 8 $\r
+@set SCRIPT_VERSION=0.9.2.\r
+@set SVN_REVISION=$Revision$\r
 @set RESET_ENVIRONMENT=FALSE\r
 @set NT32PKG=FALSE\r
-@set NT32_64=FALSE\r
+@set NT32_X64=\r
 @set BUILD_TOOLS_WITH=\r
 @set LOCATION=\r
 @set REBUILD_TOOLS=\r
 \r
 @if not defined ORIGINAL_PATH set "ORIGINAL_PATH=%PATH%"\r
 @REM Always set the WORKSPACE environment variable to the current directory\r
-@set "WORKSPACE=%CD%"\r
-@if exist "%WORKSPACE%\BaseTools" @set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools"\r
+@if not defined WORKSPACE (\r
+  @set "WORKSPACE=%CD%"\r
+)\r
+@if not exist "%BASE_TOOLS_PATH%" (\r
+  @if exist "%WORKSPACE%\BaseTools" (\r
+    set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools"\r
+  ) else (\r
+    @if defined PACKAGES_PATH (\r
+      @for %%i IN (%PACKAGES_PATH%) DO (\r
+        @if exist %%~fi\BaseTools (\r
+          @set BASE_TOOLS_PATH=%%~fi\BaseTools\r
+          @goto checkBaseTools\r
+        )\r
+      )\r
+    )\r
+  )\r
+)\r
+:checkBaseTools\r
+@if not defined BASE_TOOLS_PATH (\r
+  @echo.\r
+  @echo !!! ERROR !!! The BaseTools Package was not found !!!\r
+  @echo.\r
+  @goto ExitFailure\r
+)\r
 @if not exist "%WORKSPACE%\Conf" @mkdir "%WORKSPACE%\Conf"\r
 \r
-@@if not defined EDK_TOOLS_PATH @set "EDK_TOOLS_PATH=%WORKSPACE%\BaseTools"\r
-@rem   @set "PATH=%WORKSPACE%\BaseTools\Bin\Win32;%PATH%"\r
-@rem   @set WORKSPACE_TOOLS_PATH=%WORKSPACE%\BaseTools\r
-@rem )\r
+@@if not defined EDK_TOOLS_PATH @set "EDK_TOOLS_PATH=%BASE_TOOLS_PATH%"\r
 \r
 @REM Keep the existing EDK_TOOLS_PATH value, the --reset flag will set it\r
 @REM back to WORKSPACE\BaseTools while the --location DIRECTORY flag will\r
     @REM This option will try to set the environment for building the Nt32Pkg/Nt32Pkg; on a 64-bit \r
     @REM Windows OS\r
     @if /I "%2"=="X64" (\r
-        @set NT32_64=TRUE\r
+        @set NT32_X64=TRUE\r
         @shift\r
     )\r
   @shift\r
 @echo %SCRIPT_NAME% Version: %SCRIPT_VERSION%%SVN_REVISION:~11,-1%\r
 @echo Copyright(c) 2014, Intel Corporation. All rights reserved.\r
 @set HIDE_PATH=TRUE\r
-@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat"\r
+@call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat"\r
 @set HIDE_PATH=\r
 @goto ExitSuccess\r
 \r
 @if not exist "%EDK_TOOLS_PATH%" (\r
     @mkdir %EDK_TOOLS_PATH%\r
 )\r
-\r
+@if not defined NASM_PREFIX (\r
+    @echo.\r
+    @echo WARNING : NASM_PREFIX environment variable is not set\r
+    @if exist "C:\nasm\nasm.exe" @set "NASM_PREFIX=C:\nasm\"\r
+    @if exist "C:\nasm\nasm.exe" @echo   Found nasm.exe, setting the environment variable to C:\nasm\\r
+    @if not exist "C:\nasm\nasm.exe" echo   Attempting to build modules that require NASM will fail.\r
+)\r
 @REM Set up the path to include the EDK_TOOLS_PATH\Bin\Win32 directory; this test determines\r
 @REM whether the path is in the workspace or a fully qualified path that may be outside of\r
 @REM the workspace\r
 @REM copied or replaced from the WORKSPACE\BaseTools\Conf directories' template files.\r
 :SetConf\r
 @if not exist "%EDK_TOOLS_PATH%\Conf" (\r
-    @if exist "%WORKSPACE%\BaseTools\Conf" (\r
-        @set "SRC_CONF=%WORKSPACE%\BaseTools\Conf"\r
+    @if exist "%BASE_TOOLS_PATH%\Conf" (\r
+        @set "SRC_CONF=%BASE_TOOLS_PATH%\Conf"\r
     )\r
 ) else (\r
     @set "SRC_CONF=%EDK_TOOLS_PATH%\Conf"\r
 \r
 @REM The script will test to see if the files exist, and also use the RESET_ENVIRONMENT flag\r
 @REM to overwrite the WORKSPACE\Conf *.txt files.\r
-@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat"\r
+@call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat"\r
 @if errorlevel 1 (\r
     @echo Unable to copy the template files from "%SRC_CONF%" to "%WORKSPACE%\Conf"\r
     @goto ExitFailure\r
 @REM Set up Visual Studio if required to build the Nt32Pkg/Nt32Pkg.dsc emulator\r
 @if "%NT32PKG%"=="TRUE" (\r
     @if not defined VSINSTALLDIR @set "PATH=%ORIGINAL_PATH%"\r
-    @if not defined NT32_X64 @call "%WORKSPACE%\BaseTools\get_vsvars.bat"\r
-    @if defined NT32_X64 call "%WORKSPACE%\BaseTools\Scripts\SetVisualStudio.bat\r
-    @set NT32_X64=\r
+    @if not defined NT32_X64 @call "%BASE_TOOLS_PATH%\get_vsvars.bat"\r
+    @if defined NT32_X64 call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"\r
 )\r
 @if "%NT32PKG%"=="TRUE" (\r
     @if not defined VS_PATH set "VS_PATH=%PATH%"\r
 )\r
 @if defined VS_PATH @set "PATH=%VS_PATH%"\r
 @if not defined VS_PATH @set "PATH=%ORIGINAL_PATH%"\r
-@set "PATH=%EDK_TOOLS_PATH%\Bin\Win32;%PATH%"\r
+@if not defined EDK_TOOLS_BIN (\r
+  @if exist %EDK_TOOLS_PATH%\Bin\Win32 (\r
+    @set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32\r
+  ) else (\r
+    @echo.\r
+    @echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!\r
+    @echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32\r
+    @echo Or configure EDK_TOOLS_BIN env to point Win32 directory.\r
+    @echo. \r
+    @goto ExitFailure\r
+  )\r
+)\r
+@set "PATH=%EDK_TOOLS_BIN%;%PATH%"\r
 \r
 @if "%REBUILD_TOOLS%"=="TRUE" @goto Rebuild\r
 @if "%SVN_PULL%"== "TRUE" (\r
     if defined PYTHONHOME (\r
         @REM Use the python script if possible to test is the svn command is available, if it fails, the user may be\r
         @REM able to rebuild the Win32 binaries\r
-        @call "%WORKSPACE%\BaseTools\Scripts\UpdateBuildVersions.py" --svn-test -v\r
+        @call "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py" --svn-test -v\r
         @if errorlevel 1 (\r
             @echo ERROR : The command-line svn tool is not available and the Win32 binaries do not exist\r
             @echo         Please re-run this script again with the --rebuild option to attempt to build \r
 \r
 @REM The following code is used to rebuild the Win32 BaseTools binaries - check that required tools are available\r
 :Rebuild\r
-@if not defined BASE_TOOLS_PATH @set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools"\r
 @if not exist "%BASE_TOOLS_PATH%\Source" @goto NoBaseTools\r
 @endlocal\r
 @if not defined VCINSTALLDIR @goto NoVisualStudio\r
 @call python --version > nul 2>&1\r
 @if errorlevel 1 @set "PATH=%PYTHONHOME%\python.exe;%PATH%"\r
 @if not defined PYTHON_FREEZER_PATH (\r
-    @if not exist %PYTHONHOME%\Scripts\cxfreeze.bat @goto NoCxFreeze\r
-    @set PYTHON_FREEZER_PATH=%PYTHONHOME%\Scripts\r
+    @if not exist "%PYTHONHOME%\Scripts\cxfreeze.bat" @goto NoCxFreeze\r
+    @set "PYTHON_FREEZER_PATH=%PYTHONHOME%\Scripts"\r
 )\r
-@call "%WORKSPACE%\BaseTools\Scripts\SetVisualStudio.bat"\r
+@call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"\r
 @if errorlevel 1 @goto ExitFailure\r
 \r
 :ShowAndExit\r
-@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat"\r
+@call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat"\r
 \r
 @REM #########################################################################################\r
 @REM EXIT ROUTINES\r
 @set RESET_ENVIRONMENT=\r
 @set RECONFIG=\r
 @set NT32PKG=\r
-@set NT32_64=\r
 @set BUILD_TOOLS_WITH=\r
 @set LOCATION=\r
 @set REBUILD_TOOLS=\r
 @set RESET_ENVIRONMENT=\r
 @set RECONFIG=\r
 @set NT32PKG=\r
-@set NT32_64=\r
 @set BUILD_TOOLS_WITH=\r
 @set LOCATION=\r
 @set REBUILD_TOOLS=\r