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