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