\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
@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
@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
+ @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
@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