lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 1 | @REM @file
|
| 2 | @REM Windows batch file, Edk2Setup.bat, to set up an EDK II build environment
|
| 3 | @REM
|
| 4 | @REM This script will be renamed to edksetup.bat after initial testing and
|
| 5 | @REM acceptance by the open source community.
|
| 6 | @REM
|
| 7 | @REM This script will set the following system environment variables:
|
| 8 | @REM WORKSPACE, EDK_TOOLS_PATH, PATH
|
| 9 | @REM If rebuilding the tools:
|
| 10 | @REM BASE_TOOLS_PATH, PYTHON_FREEZER_PATH, PYTHONPATH
|
| 11 | @REM It will also create a Conf/target.txt, tools_def.txt and build_rule.txt files
|
| 12 | @REM if they do not exist
|
| 13 | @REM If the reset flag is set, all environment variables will be reset and
|
| 14 | @REM the Conf/target.txt, tools_def.txt and build_rule.txt files will be overwritten
|
| 15 | @REM
|
| 16 | @REM Three other scripts, located in the BaseTools\Scripts directory, may be called
|
| 17 | @REM by this script.
|
| 18 | @REM SetVisualStudio.bat - will set the Visual Studio environment based on the --vs* flags
|
| 19 | @REM it is also used to build the Win32 binaries, calling nmake
|
| 20 | @REM using the WORKSPACE\BaseTools\Makefile
|
| 21 | @REM ShowEnvironment.bat - will display the current EDK II Build environment
|
| 22 | @REM UpdateBuildVersions.py - script is called prior to building the EDK II BaseTools from
|
| 23 | @REM Sources. This tool will modify the BuildVersion.* files so that
|
| 24 | @REM when the tools get built, they will have a custom version entry
|
| 25 | @REM similar to the following:
|
| 26 | @REM e:\edk2>build --version
|
| 27 | @REM build.exe Version 0.51 Developer Build based on Revision: 15668
|
| 28 | @REM
|
| 29 | @REM Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
|
| 30 | @REM This program and the accompanying materials
|
| 31 | @REM are licensed and made available under the terms and conditions of the BSD License
|
| 32 | @REM which accompanies this distribution. The full text of the license may be found at
|
| 33 | @REM http://opensource.org/licenses/bsd-license.php
|
| 34 | @REM
|
| 35 | @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 36 | @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
| 37 | @REM
|
| 38 | @REM
|
| 39 | @REM usage:
|
| 40 | @REM Edk2Setup.bat [--help | -h] [-v | --version] [-r | --reset]
|
| 41 | @REM [--reconfig] [--edk-tools-path DirName]
|
| 42 | @REM [--pull [Directory]| --rebuild [Directory]]
|
| 43 | @REM [--nt32 [X64]]
|
| 44 |
|
| 45 | @REM ##############################################################
|
| 46 | @REM # You should not have to modify anything below this line
|
| 47 | @REM #
|
| 48 | @echo off
|
| 49 | @set SCRIPT_NAME=%0
|
lhauch | 83185c5 | 2014-08-22 16:08:47 +0000 | [diff] [blame] | 50 | @set SCRIPT_VERSION=0.9.2.
|
| 51 | @set SVN_REVISION=$Revision$
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 52 | @set RESET_ENVIRONMENT=FALSE
|
| 53 | @set NT32PKG=FALSE
|
Liming Gao | c31d370 | 2015-06-16 07:23:45 +0000 | [diff] [blame] | 54 | @set NT32_X64=
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 55 | @set BUILD_TOOLS_WITH=
|
| 56 | @set LOCATION=
|
| 57 | @set REBUILD_TOOLS=
|
| 58 | @set SVN_PULL=
|
| 59 | @set SRC_CONF=
|
| 60 | @set ARGUMENT=
|
| 61 | @set SCRIPT=EDKSETUP_BAT
|
| 62 |
|
| 63 | @if not defined ORIGINAL_PATH set "ORIGINAL_PATH=%PATH%"
|
| 64 | @REM Always set the WORKSPACE environment variable to the current directory
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 65 | @if not defined WORKSPACE (
|
| 66 | @set "WORKSPACE=%CD%"
|
| 67 | )
|
| 68 | @if not exist "%BASE_TOOLS_PATH%" (
|
| 69 | @if exist "%WORKSPACE%\BaseTools" (
|
| 70 | set "BASE_TOOLS_PATH=%WORKSPACE%\BaseTools"
|
| 71 | ) else (
|
| 72 | @if defined PACKAGES_PATH (
|
| 73 | @for %%i IN (%PACKAGES_PATH%) DO (
|
| 74 | @if exist %%~fi\BaseTools (
|
| 75 | @set BASE_TOOLS_PATH=%%~fi\BaseTools
|
| 76 | @goto checkBaseTools
|
| 77 | )
|
| 78 | )
|
| 79 | )
|
| 80 | )
|
| 81 | )
|
| 82 | :checkBaseTools
|
| 83 | @if not defined BASE_TOOLS_PATH (
|
| 84 | @echo.
|
| 85 | @echo !!! ERROR !!! The BaseTools Package was not found !!!
|
| 86 | @echo.
|
| 87 | @goto ExitFailure
|
| 88 | )
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 89 | @if not exist "%WORKSPACE%\Conf" @mkdir "%WORKSPACE%\Conf"
|
| 90 |
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 91 | @@if not defined EDK_TOOLS_PATH @set "EDK_TOOLS_PATH=%BASE_TOOLS_PATH%"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 92 |
|
| 93 | @REM Keep the existing EDK_TOOLS_PATH value, the --reset flag will set it
|
| 94 | @REM back to WORKSPACE\BaseTools while the --location DIRECTORY flag will
|
| 95 | @REM still take precedence if the location option follows the reset option
|
| 96 | @REM on the command line.
|
| 97 | @if defined EDK_TOOLS_PATH @set "LOCATION=%EDK_TOOLS_PATH%"
|
| 98 |
|
| 99 | :parse_cmd_line
|
| 100 | @if "%1"=="" @goto MainRoutine
|
| 101 | @if /I "%1"=="-h" @goto Usage
|
| 102 | @if /I "%1"=="--help" @goto Usage
|
| 103 | @if /I "%1"=="/?" @goto Usage
|
| 104 | @if /I "%1"=="--version" @goto Version
|
| 105 |
|
| 106 | @REM These options will reset the system environment
|
| 107 | @if /I "%1"=="-r" (
|
| 108 | @setlocal EnableDelayedExpansion
|
| 109 | @set "WORKSPACE=%CD%"
|
| 110 | @set "EDK_TOOLS_PATH=%CD%\BaseTools"
|
| 111 | @set "LOCATION=!EDK_TOOLS_PATH!"
|
| 112 | @endlocal
|
| 113 | @shift
|
| 114 | @goto parse_cmd_line
|
| 115 | )
|
| 116 | @if /I "%1"=="--reset" (
|
| 117 | @set "WORKSPACE=%CD%"
|
| 118 | @set "EDK_TOOLS_PATH=%WORKSPACE%\BaseTools"
|
| 119 | @set "LOCATION=%WORKSPACE%\BaseTools"
|
| 120 | @shift
|
| 121 | @goto parse_cmd_line
|
| 122 | )
|
| 123 |
|
| 124 | @REM This option is used to overwrite the Conf/*.txt files with the
|
| 125 | @REM WORKSPACE\BaseTools\Conf\*.template files.
|
| 126 | @if /I "%1"=="--reconfig" (
|
| 127 | @set RECONFIG=TRUE
|
| 128 | @shift
|
| 129 | @goto parse_cmd_line
|
| 130 | )
|
| 131 |
|
| 132 | @REM This option can be used to set the EDK_TOOLS_PATH containing the Win32 binaries to an
|
| 133 | @REM alternate directory
|
| 134 | @if /I "%1"=="--edk-tools-path" (
|
| 135 | @setlocal EnableDelayedExpansion
|
| 136 | @set ARGUMENT=%2
|
| 137 | @if "!ARGUMENT:~0,2!"=="--" (
|
| 138 | @echo.
|
| 139 | @echo ERROR : The --edk-tools-path flag requires an argument
|
| 140 | @echo.
|
| 141 | @endlocal
|
| 142 | @goto Usage
|
| 143 | )
|
| 144 | @endlocal
|
| 145 | @set "LOCATION=%WORKSPACE%\%2"
|
| 146 | @shift
|
| 147 | @shift
|
| 148 | @goto parse_cmd_line
|
| 149 | )
|
| 150 |
|
| 151 | @REM Force pulling updated (or checkout if they do not exist) from SVN for the BaseTools\Bin\Win32 directory
|
| 152 | @REM or the directory pointed to by the --location option
|
| 153 | @if /I "%1"=="--pull" (
|
| 154 | @if "%REBUILD_TOOLS%"=="TRUE" (
|
| 155 | @echo.
|
| 156 | @echo ERROR: The --pull option may not be used with the --rebuild option
|
| 157 | @shift
|
| 158 | @goto ExitFailure
|
| 159 | )
|
| 160 | @set SVN_PULL=TRUE
|
| 161 | @setlocal EnableDelayedExpansion
|
| 162 | @set ARGUMENT=%2
|
| 163 | @if not "!ARGUMENT:~0,2!"=="--" (
|
| 164 | @endlocal
|
| 165 | @set "LOCATION=%2"
|
| 166 | @shift
|
| 167 | )
|
| 168 | @shift
|
| 169 | @goto parse_cmd_line
|
| 170 | )
|
| 171 |
|
| 172 | @REM This options forces rebuilding the tools (provided the required tools are available
|
| 173 | @if /I "%1"=="--rebuild" (
|
| 174 | @if "%SVN_PULL%"=="TRUE" (
|
| 175 | @echo.
|
| 176 | @echo ERROR: The --reset option may not be used with the --pull option
|
| 177 | @shift
|
| 178 | @goto ExitFailure
|
| 179 | )
|
| 180 | @set REBUILD_TOOLS=TRUE
|
| 181 | @setlocal EnableDelayedExpansion
|
| 182 | @set ARGUMENT=%2
|
| 183 | @if not "!ARGUMENT:~0,2!"=="--" (
|
| 184 | @endlocal
|
| 185 | @set "LOCATION=%2"
|
| 186 | @shift
|
| 187 | )
|
| 188 | @shift
|
| 189 | goto parse_cmd_line
|
| 190 | )
|
| 191 |
|
| 192 | @REM This option will try to set the compiler environment for building Nt32Pkg/Nt32Pkg.dsc
|
| 193 | @REM If the compiler environment is already installed, then no additional work is required.
|
| 194 | @if /I "%1"=="--nt32" (
|
| 195 | @set NT32PKG=TRUE
|
| 196 | @if not defined BUILD_TOOLS_WITH (
|
| 197 | @set BUILD_TOOLS_WITH=Latest
|
| 198 | )
|
| 199 | @REM This option will try to set the environment for building the Nt32Pkg/Nt32Pkg; on a 64-bit
|
| 200 | @REM Windows OS
|
| 201 | @if /I "%2"=="X64" (
|
Liming Gao | c31d370 | 2015-06-16 07:23:45 +0000 | [diff] [blame] | 202 | @set NT32_X64=TRUE
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 203 | @shift
|
| 204 | )
|
| 205 | @shift
|
| 206 | @goto parse_cmd_line
|
| 207 | )
|
| 208 |
|
| 209 | @if not "%1"=="" goto UnknownOptionOrArgument
|
| 210 | @goto MainRoutine
|
| 211 |
|
| 212 | :Usage
|
| 213 | @echo Usage: %SCRIPT_NAME% [Options]
|
| 214 | @echo Copyright(c) 2014, Intel Corporation. All rights reserved.
|
| 215 | @echo.
|
| 216 | @echo The system environment variable, WORKSPACE, is always set to the current
|
| 217 | @echo working directory.
|
| 218 | @echo.
|
| 219 | @echo Options:
|
| 220 | @echo --help, -h Print this help screen and exit.
|
| 221 | @echo.
|
| 222 | @echo --version Print this script's version and exit.
|
| 223 | @echo.
|
| 224 | @echo --reset, -r Reset the EDK_TOOLS_PATH and PATH system environment
|
| 225 | @echo variables. The EDK_TOOLS_PATH default is
|
| 226 | @echo WORKSPACE\BaseTools, however, it may be overridden by
|
| 227 | @echo arguments given to the --edk-tools-path, --pull and/or
|
| 228 | @echo --rebuild options.
|
| 229 | @echo Once set, the EDK_TOOLS_PATH environment variable reset
|
| 230 | @echo by opening up a new command prompt window or through one
|
| 231 | @echo of the options provided by this tool
|
| 232 | @echo.
|
| 233 | @echo --reconfig Overwrite the WORKSPACE/Conf/*.txt files with the
|
| 234 | @echo template files from the BaseTools/Conf directory.
|
| 235 | @echo.
|
| 236 | @echo --edk-tools-path DIRECTORY
|
| 237 | @echo This option sets the EDK_TOOLS_PATH to the DIRECTORY
|
| 238 | @echo value instead of the default (WORKSPACE\BaseTools).
|
| 239 | @echo.
|
| 240 | @echo --nt32 [X64] If a compiler tool chain is not available in the
|
| 241 | @echo environment, call a script to attempt to set one up.
|
| 242 | @echo This flag is only required if building the
|
| 243 | @echo Nt32Pkg/Nt32Pkg.dsc system emulator.
|
| 244 | @echo If the X64 argument is set, and a compiler tool chain is
|
| 245 | @echo not available, attempt to set up a tool chain that will
|
| 246 | @echo create X64 binaries. Setting these two options have the
|
| 247 | @echo potential side effect of changing tool chains used for a
|
| 248 | @echo rebuild.
|
| 249 | @echo.
|
| 250 | @pause
|
| 251 | @echo.
|
| 252 | @echo --pull [DIRECTORY] Get the EDK II BaseTools binaries from source control
|
| 253 | @echo (must not be used with --rebuild).
|
| 254 | @echo If the optional DIRECTORY argument is specified, the tool
|
| 255 | @echo sets EDK_TOOLS_PATH to DIRECTORY.
|
| 256 | @echo If the DIRECTORY argument is not specified, the tools are
|
| 257 | @echo placed in the directory tree pointed to by the current
|
| 258 | @echo EDK_TOOLS_PATH environment variable. If the binaries
|
| 259 | @echo cannot be obtained from source control, the
|
| 260 | @echo EDK_TOOLS_PATH will be set to the default,
|
| 261 | @echo WORKSPACE\BaseTools directory.
|
| 262 | @echo.
|
| 263 | @echo --rebuild [DIRECTORY]
|
| 264 | @echo Force Rebuilding the EDK II BaseTools from source
|
| 265 | @echo (must not be used with --pull).
|
| 266 | @echo NOTE: The build will use whatever compiler tool set
|
| 267 | @echo is available in the environment prior to
|
| 268 | @echo running edksetup.bat.
|
| 269 | @echo If the optional DIRECTORY argument is specified, the tool
|
| 270 | @echo sets EDK_TOOLS_PATH to DIRECTORY. Tools binaries will be
|
| 271 | @echo placed in the appropriate subdirectory in the
|
| 272 | @echo EDK_TOOLS_PATH directory. If the build fails, the
|
| 273 | @echo EDK_TOOLS_PATH will be set to the default,
|
| 274 | @echo WORKSPACE\BaseTools directory.
|
| 275 | @goto ExitSuccess
|
| 276 |
|
| 277 | :Version
|
| 278 | @echo %SCRIPT_NAME% Version: %SCRIPT_VERSION%%SVN_REVISION:~11,-1%
|
| 279 | @echo Copyright(c) 2014, Intel Corporation. All rights reserved.
|
| 280 | @set HIDE_PATH=TRUE
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 281 | @call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 282 | @set HIDE_PATH=
|
| 283 | @goto ExitSuccess
|
| 284 |
|
| 285 | :UnknownOptionOrArgument
|
| 286 | @echo. ERROR : This argument is not valid: %1
|
| 287 | @echo.
|
| 288 | @goto ExitFailure
|
| 289 |
|
| 290 | :NoVisualStudio
|
| 291 | @echo ERROR : Unable to determine if a compiler tool chain has been enabled in this
|
| 292 | @echo command-prompt window. Rebuilding of the tools with this script is not
|
| 293 | @echo possible.
|
| 294 | @echo Refer to the BaseTools\BuildNotes.txt for directions for building
|
| 295 | @echo the BaseTools binaries.
|
| 296 | @echo.
|
| 297 | @goto ExitFailure
|
| 298 |
|
| 299 | :NoPython
|
| 300 | @echo ERROR : Unable to rebuild the BaseTools binaries, python does not appear to be
|
| 301 | @echo installed. If python is installed, please set the environment
|
| 302 | @echo variable, PYTHONHOME to the Path to the python.exe, for example,
|
| 303 | @echo if python.exe is located in the C:\Python27 directory, then:
|
| 304 | @echo set PYTHONHOME=C:\Python27
|
| 305 | @echo.
|
| 306 | @goto ExitFailure
|
| 307 |
|
| 308 | :BadPython
|
| 309 | @echo ERROR : Unable to rebuild the BaseTools binaries, python does not appear to be
|
| 310 | @echo installed.
|
| 311 | @echo The python executable was not found in the PYTHONHOME: %PYTHONHOME%
|
| 312 | @echo If python is installed, please set the environment variable, PYTHONHOME
|
| 313 | @echo to the Path that contains python.exe, for example, if python.exe is
|
| 314 | @echo located in the C:\Python27 directory, then:
|
| 315 | @echo set PYTHONHOME=C:\Python27
|
| 316 | @echo.
|
| 317 | @goto ExitFailure
|
| 318 |
|
| 319 | :NoCxFreeze
|
| 320 | @echo ERROR : Unable to locate cx_Freeze 4.2.3. The cxfreeze.bat file must be located
|
| 321 | @echo in the %PYTHONHOME%\Scripts directoryin order to rebuild the BaseTools
|
| 322 | @echo binaries.
|
| 323 | @echo.
|
| 324 | @goto ExitFailure
|
| 325 |
|
| 326 | :NoBaseTools
|
| 327 | @echo ERROR: Unable to locate the BaseTools directory containing the Source tree
|
| 328 | @echo.
|
| 329 | @goto ExitFailure
|
| 330 |
|
| 331 | @REM #########################################################################################
|
| 332 | @REM MAIN ROUTINE
|
| 333 | @REM Set up the Build System environment
|
| 334 | @REM #########################################################################################
|
| 335 | :MainRoutine
|
| 336 | @if defined LOCATION @set "EDK_TOOLS_PATH=%LOCATION%"
|
| 337 | @REM SET the EDK_TOOLS_PATH.
|
| 338 | @if not exist "%EDK_TOOLS_PATH%" (
|
| 339 | @mkdir %EDK_TOOLS_PATH%
|
| 340 | )
|
lhauch | bd4fa6f | 2014-08-22 15:47:45 +0000 | [diff] [blame] | 341 | @if not defined NASM_PREFIX (
|
| 342 | @echo.
|
| 343 | @echo WARNING : NASM_PREFIX environment variable is not set
|
| 344 | @if exist "C:\nasm\nasm.exe" @set "NASM_PREFIX=C:\nasm\"
|
| 345 | @if exist "C:\nasm\nasm.exe" @echo Found nasm.exe, setting the environment variable to C:\nasm\
|
| 346 | @if not exist "C:\nasm\nasm.exe" echo Attempting to build modules that require NASM will fail.
|
| 347 | )
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 348 | @REM Set up the path to include the EDK_TOOLS_PATH\Bin\Win32 directory; this test determines
|
| 349 | @REM whether the path is in the workspace or a fully qualified path that may be outside of
|
| 350 | @REM the workspace
|
| 351 | @if exist "%WORKSPACE%\%EDK_TOOLS_PATH%" @set "EDK_TOOLS_PATH=%WORKSPACE%\%EDK_TOOLS_PATH%"
|
| 352 |
|
| 353 | @if defined REBUILD_TOOLS goto SetConf
|
| 354 | @if defined SVN_PULL goto SetConf
|
| 355 | @if not exist "%EDK_TOOLS_PATH%\Bin\Win32\build.exe" (
|
| 356 | @echo ERROR : %EDK_TOOLS_PATH%\Bin\Win32\build.exe does not exist
|
| 357 | @echo Re-run this script using --reset, --pull or --rebuild
|
| 358 | @echo.
|
| 359 | @goto ExitFailure
|
| 360 | )
|
| 361 | @echo.
|
| 362 | @echo Rebuilding of the tools is not required. Binaries of the latest,
|
| 363 | @echo tested versions of the tools have been tested and included in the
|
| 364 | @echo EDK II repository.
|
| 365 | @echo.
|
| 366 | @echo If you really want to build the tools, use the --rebuild option.
|
| 367 | @echo.
|
| 368 | @if not defined CYGWIN_HOME @echo "!!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!"
|
| 369 | @if not defined CYGWIN_HOME @echo.
|
| 370 | @REM Make sure the WORKSPACE\Conf directory contains the required text files that will be
|
| 371 | @REM copied or replaced from the WORKSPACE\BaseTools\Conf directories' template files.
|
| 372 | :SetConf
|
| 373 | @if not exist "%EDK_TOOLS_PATH%\Conf" (
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 374 | @if exist "%BASE_TOOLS_PATH%\Conf" (
|
| 375 | @set "SRC_CONF=%BASE_TOOLS_PATH%\Conf"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 376 | )
|
| 377 | ) else (
|
| 378 | @set "SRC_CONF=%EDK_TOOLS_PATH%\Conf"
|
| 379 | )
|
| 380 | @if not defined SRC_CONF (
|
| 381 | @echo ERROR : Unable to locate the BaseTools directory tree
|
| 382 | @goto ExitFailure
|
| 383 | )
|
| 384 |
|
| 385 | @REM The script will test to see if the files exist, and also use the RESET_ENVIRONMENT flag
|
| 386 | @REM to overwrite the WORKSPACE\Conf *.txt files.
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 387 | @call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 388 | @if errorlevel 1 (
|
| 389 | @echo Unable to copy the template files from "%SRC_CONF%" to "%WORKSPACE%\Conf"
|
| 390 | @goto ExitFailure
|
| 391 | )
|
| 392 | @set SRC_CONF=
|
| 393 |
|
| 394 | @REM Set up Visual Studio if required to build the Nt32Pkg/Nt32Pkg.dsc emulator
|
| 395 | @if "%NT32PKG%"=="TRUE" (
|
lhauch | cd92f93 | 2014-08-22 15:56:54 +0000 | [diff] [blame] | 396 | @if not defined VSINSTALLDIR @set "PATH=%ORIGINAL_PATH%"
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 397 | @if not defined NT32_X64 @call "%BASE_TOOLS_PATH%\get_vsvars.bat"
|
| 398 | @if defined NT32_X64 call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 399 | )
|
| 400 | @if "%NT32PKG%"=="TRUE" (
|
lhauch | cd92f93 | 2014-08-22 15:56:54 +0000 | [diff] [blame] | 401 | @if not defined VS_PATH set "VS_PATH=%PATH%"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 402 | )
|
| 403 | @if defined VS_PATH @set "PATH=%VS_PATH%"
|
| 404 | @if not defined VS_PATH @set "PATH=%ORIGINAL_PATH%"
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 405 | @if not defined EDK_TOOLS_BIN (
|
| 406 | @if exist %EDK_TOOLS_PATH%\Bin\Win32 (
|
| 407 | @set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32
|
| 408 | ) else (
|
| 409 | @echo.
|
| 410 | @echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!
|
| 411 | @echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32
|
| 412 | @echo Or configure EDK_TOOLS_BIN env to point Win32 directory.
|
| 413 | @echo.
|
| 414 | @goto ExitFailure
|
| 415 | )
|
| 416 | )
|
| 417 | @set "PATH=%EDK_TOOLS_BIN%;%PATH%"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 418 |
|
| 419 | @if "%REBUILD_TOOLS%"=="TRUE" @goto Rebuild
|
| 420 | @if "%SVN_PULL%"== "TRUE" (
|
| 421 | if defined PYTHONHOME (
|
| 422 | @REM Use the python script if possible to test is the svn command is available, if it fails, the user may be
|
| 423 | @REM able to rebuild the Win32 binaries
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 424 | @call "%BASE_TOOLS_PATH%\Scripts\UpdateBuildVersions.py" --svn-test -v
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 425 | @if errorlevel 1 (
|
| 426 | @echo ERROR : The command-line svn tool is not available and the Win32 binaries do not exist
|
| 427 | @echo Please re-run this script again with the --rebuild option to attempt to build
|
| 428 | @echo the binaries
|
| 429 | @echo.
|
| 430 | @goto ExitFailure
|
| 431 | )
|
| 432 | @if exist %EDK_TOOLS_PATH%\Bin\Win32 @rmdir /S /Q %EDK_TOOLS_PATH%\Bin\Win32
|
| 433 | @call svn co https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32 "%EDK_TOOLS_PATH%\Bin\Win32"
|
| 434 | ) else (
|
| 435 | @call svn co https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32 "%EDK_TOOLS_PATH%\Bin\Win32"
|
| 436 | @if errorlevel 1 (
|
| 437 | @echo ERROR : The command-line svn tool is not available and the Win32 binaries do not exist
|
| 438 | @echo Python does not appear to be available either. This script cannot be used to
|
| 439 | @echo build the Win32 binaries or to obtain them from this repository:
|
| 440 | @echo https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
|
| 441 | @goto ExitFailure
|
| 442 | )
|
| 443 | )
|
| 444 | @goto ShowAndExit
|
| 445 | )
|
| 446 |
|
| 447 | @if not "%REBUILD_TOOLS%"=="TRUE" @goto ShowAndExit
|
| 448 |
|
| 449 | @REM The following code is used to rebuild the Win32 BaseTools binaries - check that required tools are available
|
| 450 | :Rebuild
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 451 | @if not exist "%BASE_TOOLS_PATH%\Source" @goto NoBaseTools
|
| 452 | @endlocal
|
| 453 | @if not defined VCINSTALLDIR @goto NoVisualStudio
|
| 454 | @if not defined PYTHONHOME @goto NoPython
|
| 455 | @if not exist "%PYTHONHOME%\python.exe" @goto BadPython
|
| 456 | @REM python.exe has been located, now make sure it's in the PATH
|
| 457 | @call python --version > nul 2>&1
|
| 458 | @if errorlevel 1 @set "PATH=%PYTHONHOME%\python.exe;%PATH%"
|
| 459 | @if not defined PYTHON_FREEZER_PATH (
|
lhauch | bd4fa6f | 2014-08-22 15:47:45 +0000 | [diff] [blame] | 460 | @if not exist "%PYTHONHOME%\Scripts\cxfreeze.bat" @goto NoCxFreeze
|
| 461 | @set "PYTHON_FREEZER_PATH=%PYTHONHOME%\Scripts"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 462 | )
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 463 | @call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 464 | @if errorlevel 1 @goto ExitFailure
|
| 465 |
|
| 466 | :ShowAndExit
|
Liming Gao | 485eb3a | 2015-10-08 09:29:36 +0000 | [diff] [blame^] | 467 | @call "%BASE_TOOLS_PATH%\Scripts\ShowEnvironment.bat"
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 468 |
|
| 469 | @REM #########################################################################################
|
| 470 | @REM EXIT ROUTINES
|
| 471 | @REM #########################################################################################
|
| 472 | :ExitSuccess
|
| 473 | @set SCRIPT_NAME=
|
| 474 | @set SCRIPT_VERSION=
|
| 475 | @set SVN_REVISION=
|
| 476 | @set RESET_ENVIRONMENT=
|
| 477 | @set RECONFIG=
|
| 478 | @set NT32PKG=
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 479 | @set BUILD_TOOLS_WITH=
|
| 480 | @set LOCATION=
|
| 481 | @set REBUILD_TOOLS=
|
| 482 | @set SVN_PULL=
|
| 483 | @set SRC_CONF=
|
| 484 | @set ARGUMENT=
|
| 485 | @set SCRIPT=
|
| 486 | @set LIST_VS_VERSIONS=
|
| 487 | @set PYTHON_FREEZER_PATH=
|
| 488 | @echo on
|
| 489 | @exit /B 0
|
| 490 |
|
| 491 | :ExitFailure
|
| 492 | @set SCRIPT_NAME=
|
| 493 | @set SCRIPT_VERSION=
|
| 494 | @set SVN_REVISION=
|
| 495 | @set RESET_ENVIRONMENT=
|
| 496 | @set RECONFIG=
|
| 497 | @set NT32PKG=
|
lhauch | bd63012 | 2014-08-21 16:41:41 +0000 | [diff] [blame] | 498 | @set BUILD_TOOLS_WITH=
|
| 499 | @set LOCATION=
|
| 500 | @set REBUILD_TOOLS=
|
| 501 | @set SVN_PULL=
|
| 502 | @set SRC_CONF=
|
| 503 | @set ARGUMENT=
|
| 504 | @set SCRIPT=
|
| 505 | @set LIST_VS_VERSIONS=
|
| 506 | @set PYTHON_FREEZER_PATH=
|
| 507 | @echo on
|
| 508 | @exit /B 1
|