X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Edk2Setup.bat;h=017e88de86c4b8495ec50e26a02ba543acb00f81;hp=0aa786d9ab94fbcec87314f31a9704a948904228;hb=91db774bf4b33e1bf07f2f1aded5fd79c6f27c44;hpb=c31d3701734d07cd0d3d7211cb6a92c7d1e4d831 diff --git a/Edk2Setup.bat b/Edk2Setup.bat index 0aa786d9ab..017e88de86 100755 --- a/Edk2Setup.bat +++ b/Edk2Setup.bat @@ -27,6 +27,7 @@ @REM build.exe Version 0.51 Developer Build based on Revision: 15668 @REM @REM Copyright (c) 2014, Intel Corporation. All rights reserved.
+@REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP
@REM This program and the accompanying materials @REM are licensed and made available under the terms and conditions of the BSD License @REM which accompanies this distribution. The full text of the license may be found at @@ -59,17 +60,37 @@ @set SRC_CONF= @set ARGUMENT= @set SCRIPT=EDKSETUP_BAT +@set PYTHON_BUILD= @if not defined ORIGINAL_PATH set "ORIGINAL_PATH=%PATH%" @REM Always set the WORKSPACE environment variable to the current directory -@set "WORKSPACE=%CD%" -@if exist "%WORKSPACE%\BaseTools" @set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools" +@if not defined WORKSPACE ( + @set "WORKSPACE=%CD%" +) +@if not exist "%BASE_TOOLS_PATH%" ( + @if exist "%WORKSPACE%\BaseTools" ( + set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools" + ) else ( + @if defined PACKAGES_PATH ( + @for %%i IN (%PACKAGES_PATH%) DO ( + @if exist %%~fi\BaseTools ( + @set BASE_TOOLS_PATH=%%~fi\BaseTools + @goto checkBaseTools + ) + ) + ) + ) +) +:checkBaseTools +@if not defined BASE_TOOLS_PATH ( + @echo. + @echo !!! ERROR !!! The BaseTools Package was not found !!! + @echo. + @goto ExitFailure +) @if not exist "%WORKSPACE%\Conf" @mkdir "%WORKSPACE%\Conf" -@@if not defined EDK_TOOLS_PATH @set "EDK_TOOLS_PATH=%WORKSPACE%\BaseTools" -@rem @set "PATH=%WORKSPACE%\BaseTools\Bin\Win32;%PATH%" -@rem @set WORKSPACE_TOOLS_PATH=%WORKSPACE%\BaseTools -@rem ) +@@if not defined EDK_TOOLS_PATH @set "EDK_TOOLS_PATH=%BASE_TOOLS_PATH%" @REM Keep the existing EDK_TOOLS_PATH value, the --reset flag will set it @REM back to WORKSPACE\BaseTools while the --location DIRECTORY flag will @@ -259,7 +280,7 @@ @echo %SCRIPT_NAME% Version: %SCRIPT_VERSION%%SVN_REVISION:~11,-1% @echo Copyright(c) 2014, Intel Corporation. All rights reserved. @set HIDE_PATH=TRUE -@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat" +@call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat" @set HIDE_PATH= @goto ExitSuccess @@ -333,12 +354,16 @@ @if defined REBUILD_TOOLS goto SetConf @if defined SVN_PULL goto SetConf -@if not exist "%EDK_TOOLS_PATH%\Bin\Win32\build.exe" ( - @echo ERROR : %EDK_TOOLS_PATH%\Bin\Win32\build.exe does not exist - @echo Re-run this script using --reset, --pull or --rebuild - @echo. - @goto ExitFailure + +@REM call set_vsprefix_envs.bat to set up the PREFIX env for VS tool path. +@IF NOT exist "%EDK_TOOLS_PATH%\set_vsprefix_envs.bat" ( + @echo. + @echo !!! ERROR !!! The set_vsprefix_envs.bat was not found !!! + @echo. + @goto ExitFailure ) +@call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat + @echo. @echo Rebuilding of the tools is not required. Binaries of the latest, @echo tested versions of the tools have been tested and included in the @@ -352,8 +377,8 @@ @REM copied or replaced from the WORKSPACE\BaseTools\Conf directories' template files. :SetConf @if not exist "%EDK_TOOLS_PATH%\Conf" ( - @if exist "%WORKSPACE%\BaseTools\Conf" ( - @set "SRC_CONF=%WORKSPACE%\BaseTools\Conf" + @if exist "%BASE_TOOLS_PATH%\Conf" ( + @set "SRC_CONF=%BASE_TOOLS_PATH%\Conf" ) ) else ( @set "SRC_CONF=%EDK_TOOLS_PATH%\Conf" @@ -365,7 +390,7 @@ @REM The script will test to see if the files exist, and also use the RESET_ENVIRONMENT flag @REM to overwrite the WORKSPACE\Conf *.txt files. -@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat" +@call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat" @if errorlevel 1 ( @echo Unable to copy the template files from "%SRC_CONF%" to "%WORKSPACE%\Conf" @goto ExitFailure @@ -375,22 +400,59 @@ @REM Set up Visual Studio if required to build the Nt32Pkg/Nt32Pkg.dsc emulator @if "%NT32PKG%"=="TRUE" ( @if not defined VSINSTALLDIR @set "PATH=%ORIGINAL_PATH%" - @if not defined NT32_X64 @call "%WORKSPACE%\BaseTools\get_vsvars.bat" - @if defined NT32_X64 call "%WORKSPACE%\BaseTools\Scripts\SetVisualStudio.bat" + @if not defined NT32_X64 @call "%BASE_TOOLS_PATH%\get_vsvars.bat" + @if defined NT32_X64 call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat" ) @if "%NT32PKG%"=="TRUE" ( @if not defined VS_PATH set "VS_PATH=%PATH%" ) @if defined VS_PATH @set "PATH=%VS_PATH%" @if not defined VS_PATH @set "PATH=%ORIGINAL_PATH%" -@set "PATH=%EDK_TOOLS_PATH%\Bin\Win32;%PATH%" +@if not defined EDK_TOOLS_BIN ( + @if exist %EDK_TOOLS_PATH%\Bin\Win32 ( + @set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32 + ) else ( + @echo. + @echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!! + @echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32 + @echo Or configure EDK_TOOLS_BIN env to point Win32 directory. + @echo. + @goto ExitFailure + ) +) +@set "PATH=%EDK_TOOLS_BIN%;%PATH%" + +@if NOT EXIST "%EDK_TOOLS_BIN%\build.exe" @set PYTHON_BUILD=TRUE +@if NOT EXIST "%EDK_TOOLS_BIN%\GenFds.exe" @set PYTHON_BUILD=TRUE +@if NOT EXIST "%EDK_TOOLS_BIN%\TargetTool.exe" @set PYTHON_BUILD=TRUE +@if NOT EXIST "%EDK_TOOLS_BIN%\Trim.exe" @set PYTHON_BUILD=TRUE + +@if not defined PYTHON_BUILD goto SvnPull + +@echo !!! WARNING !!! Setup environment to run Python scripts directly. + +@if not defined PYTHON_HOME ( + @if defined PYTHONHOME ( + @set PYTHON_HOME=%PYTHONHOME% + ) else ( + @echo. + @echo !!! ERROR !!! PYTHON_HOME is required to build or execute the tools, please set it. !!! + @echo. + @goto ExitFailure + ) +) + +@set PATH=%PATH%;%BASE_TOOLS_PATH%\BinWrappers\WindowsLike +@set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python +@set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH% +:SvnPull @if "%REBUILD_TOOLS%"=="TRUE" @goto Rebuild @if "%SVN_PULL%"== "TRUE" ( if defined PYTHONHOME ( @REM Use the python script if possible to test is the svn command is available, if it fails, the user may be @REM able to rebuild the Win32 binaries - @call "%WORKSPACE%\BaseTools\Scripts\UpdateBuildVersions.py" --svn-test -v + @call "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py" --svn-test -v @if errorlevel 1 ( @echo ERROR : The command-line svn tool is not available and the Win32 binaries do not exist @echo Please re-run this script again with the --rebuild option to attempt to build @@ -417,7 +479,6 @@ @REM The following code is used to rebuild the Win32 BaseTools binaries - check that required tools are available :Rebuild -@if not defined BASE_TOOLS_PATH @set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools" @if not exist "%BASE_TOOLS_PATH%\Source" @goto NoBaseTools @endlocal @if not defined VCINSTALLDIR @goto NoVisualStudio @@ -430,11 +491,11 @@ @if not exist "%PYTHONHOME%\Scripts\cxfreeze.bat" @goto NoCxFreeze @set "PYTHON_FREEZER_PATH=%PYTHONHOME%\Scripts" ) -@call "%WORKSPACE%\BaseTools\Scripts\SetVisualStudio.bat" +@call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat" @if errorlevel 1 @goto ExitFailure :ShowAndExit -@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat" +@call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat" @REM ######################################################################################### @REM EXIT ROUTINES @@ -455,6 +516,7 @@ @set SCRIPT= @set LIST_VS_VERSIONS= @set PYTHON_FREEZER_PATH= +@set PYTHON_BUILD= @echo on @exit /B 0 @@ -474,5 +536,6 @@ @set SCRIPT= @set LIST_VS_VERSIONS= @set PYTHON_FREEZER_PATH= +@set PYTHON_BUILD= @echo on @exit /B 1