Revision: 15867
http://sourceforge.net/p/edk2/code/15867
Author: lhauch
Date: 2014-08-21 16:41:41 +0000 (Thu, 21 Aug 2014)
Log Message:
-----------
Adding files for proposed replacement for edksetup.bat.
This changes includes new scripts that breaks out some of the functionality in
edksetup.bat and eliminates calling the toolsetup.bat file in BaseTools
directory.
Edk2Setup.bat is to be used for testing. If no bugs are reported by the end of
September, 2014, the file will be renamed to edksetup.bat.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <[email protected]>
Reviewed-by: Gao, Liming <[email protected]>
Added Paths:
-----------
trunk/edk2/BaseTools/Scripts/SetVisualStudio.bat
trunk/edk2/BaseTools/Scripts/ShowEnvironment.bat
trunk/edk2/BaseTools/Scripts/UpdateBuildVersions.py
trunk/edk2/Edk2Setup.bat
Added: trunk/edk2/BaseTools/Scripts/SetVisualStudio.bat
===================================================================
--- trunk/edk2/BaseTools/Scripts/SetVisualStudio.bat
(rev 0)
+++ trunk/edk2/BaseTools/Scripts/SetVisualStudio.bat 2014-08-21 16:41:41 UTC
(rev 15867)
@@ -0,0 +1,103 @@
+@REM @file
+@REM Windows batch file to set up the Microsoft Visual Studio environment
+@REM
+@REM This script is used to set up one of the Microsoft Visual Studio
+@REM environments, VS2008x86, VS2010x86, VS2012x86 or VS2013x86 for
+@REM building the Nt32Pkg/Nt32Pkg.dsc emulation environment to run on
+@REM an X64 version of Windows.
+@REM The system environment variables in this script are set by the
+@rem Edk2Setup.bat script (that will be renamed to edksetup.bat).
+@REM
+@REM This script can also be used to build the Win32 binaries
+@REM
+@REM Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+@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
+@REM http://opensource.org/licenses/bsd-license.php
+@REM
+@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED.
+@REM
+@echo off
+@if defined NT32_X64 @goto CheckLatest
+@if "%REBUILD_TOOLS%"=="TRUE" @goto RebuildTools
+
+:CheckLatest
+echo.
+@if defined VS120COMNTOOLS (
+ @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio
12.0\VC\bin\x86_amd64"
+ @goto SetVs
+)
+
+@if defined VS110COMNTOOLS (
+ @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio
11.0\VC\bin\x86_amd64"
+ @goto SetVs
+)
+
+@if defined VS100COMNTOOLS (
+ @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\bin\x86_amd64"
+ @goto SetVs
+)
+
+@if defined VS90COMNTOOLS (
+ @set "COMMONTOOLSx64=C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\bin\x86_amd64"
+ @goto SetVs
+)
+@echo.
+@echo No version of Microsoft Visual Studio was found on this system
+@echo.
+@exit /B 1
+
+@REM Set up the X64 environment for building Nt32Pkg/Nt32Pkg.dsc to run on an
X64 platform
+:SetVs
+if exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
+ @call "%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
+ @if errorlevel 1 (
+ @echo. ERROR setting Microsoft Visual Studio %1
+ @set COMMONTOOLSx64=
+ @exit /B 1
+ )
+)
+if not exist "%COMMONTOOLSx64%\vcvarsx86_amd64.bat" (
+ @echo ERROR : This script does not exist:
"%COMMONTOOLSx64%\vcvarsx86_amd64.bat"
+ @set COMMONTOOLSx64=
+ @exit /B 1
+)
+@set COMMONTOOLSx64=
+@goto End
+
+:RebuildTools
+@call python "%WORKSPACE%\BaseTools\Scripts\UpdateBuildVersions.py"
+@set "BIN_DIR=%EDK_TOOLS_PATH%\Bin\Win32"
+if not exist "%BIN_DIR%" @mkdir "%BIN_DIR%"
+@echo Removing temporary and binary files
+@cd "%BASE_TOOLS_PATH%"
+@call nmake cleanall
+@echo Rebuilding the EDK II BaseTools
+@cd "%BASE_TOOLS_PATH%\Source\C"
+@call nmake -nologo -a -f Makefile
+@if errorlevel 1 (
+@echo Error building the C-based BaseTools
+@cd "%WORKSPACE%"
+@exit /B1
+)
+@cd %BASE_TOOLS_PATH%\Source\Python
+@call nmake -nologo -a -f Makefile
+@if errorlevel 1 (
+@echo Error building the Python-based BaseTools
+@cd %WORKSPACE%
+@exit /B1
+)
+@cd %WORKSPACE%
+
+@goto End
+
+:VersionNotFound
+@echo.
+@echo This Microsoft Visual Studio version is in not installed on this system:
%1
+@echo.
+@exit /B 1
+
+:End
+@exit /B 0
Added: trunk/edk2/BaseTools/Scripts/ShowEnvironment.bat
===================================================================
--- trunk/edk2/BaseTools/Scripts/ShowEnvironment.bat
(rev 0)
+++ trunk/edk2/BaseTools/Scripts/ShowEnvironment.bat 2014-08-21 16:41:41 UTC
(rev 15867)
@@ -0,0 +1,207 @@
+@REM @file
+@REM Windows batch file to display the Windows environment
+@REM
+@REM This script will be used to show the current EDK II build environment.
+@REM it may be called by the Edk2Setup.bat (that will be renamed to
edksetup.bat) or
+@REM run as stand-alone application.
+@REM
+@REM Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+@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
+@REM http://opensource.org/licenses/bsd-license.php
+@REM
+@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED.
+@REM
+@echo off
+@set SE_SVN_REVISION=$Revision: 8 $
+@set SE_VERSION=0.7.0.
+@if "%SCRIPT%"=="EDKSETUP_BAT" goto SkipCmdlineArgumentCheck
+
+:parse_cmd_line
+@if /I "%1"=="-h" @goto Usage
+@if /I "%1"=="--help" @goto Usage
+@if /I "%1"=="/?" @goto Usage
+@if /I "%1"=="-v" @goto Version
+@if /I "%1"=="--version" @goto Version
+
+:Usage
+@echo Usage: ShowEnvironment.bat [Options]
+@echo Copyright(c) 2014, Intel Corporation. All rights reserved.
+@echo.
+@echo Options:
+@echo --help, -h Print this help screen and exit
+@echo --version, -v Print this tool's version and exit
+@echo.
+@goto End
+
+:Version
+@echo ShowEnvironment.bat Version: %SE_VERSION%%SE_SVN_REVISION:~11,-1%
+@echo Copyright(c) 2014, Intel Corporation. All rights reserved.
+
+:SkipCmdlineArgumentCheck
+if defined SRC_CONF @goto SetEnv
+
+@echo.
+@echo
#############################################################################
+@if defined WORKSPACE @echo WORKSPACE = %WORKSPACE%
+@if not defined WORKSPACE @echo WORKSPACE = Not Set
+@if defined EDK_TOOLS_PATH @echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%
+@if not defined EDK_TOOLS_PATH @echo EDK_TOOLS_PATH = Not Set
+@if defined BASE_TOOLS_PATH @echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%
+@if defined PYTHON_FREEZER_PATH @echo PYTHON_FREEZER_PATH =
%PYTHON_FREEZER_PATH%
+@if "%NT32PKG%"=="TRUE" (
+ @echo.
+ @echo NOTE: Please configure your build to use the following
TOOL_CHAIN_TAG
+ @echo when building NT32Pkg/Nt32Pkg.dsc
+ @if defined VCINSTALLDIR @call :CheckVsVer
+ @set TEST_VS=
+)
+@if defined HIDE_PATH goto End
+
+
+@echo ############################## PATH
#########################################
+@setlocal DisableDelayedExpansion
+@set "var=%PATH%"
+@set "var=%var:"=""%"
+@set "var=%var:^=^^%"
+@set "var=%var:&=^&%"
+@set "var=%var:|=^|%"
+@set "var=%var:<=^<%"
+@set "var=%var:>=^>%"
+@set "var=%var:;=^;^;%"
+@set var=%var:""="%
+@set "var=%var:"=""Q%"
+@set "var=%var:;;="S"S%"
+@set "var=%var:^;^;=;%"
+@set "var=%var:""="%"
+@setlocal EnableDelayedExpansion
+@set "var=!var:"Q=!"
+@for %%a in ("!var:"S"S=";"!") do (
+ @if "!!"=="" endlocal
+ @if %%a neq "" echo %%~a
+)
+@goto End
+
+:CheckVsVer
+@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2008x86
+ @goto :EOF
+)
+@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 9.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2008
+ @goto :EOF
+)
+
+@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2010x86
+ @goto :EOF
+)
+@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 10.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2010
+ @goto :EOF
+)
+
+@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2012x86
+ @goto :EOF
+)
+@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 11.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2012
+ @goto :EOF
+)
+
+@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2013x86
+ @goto :EOF
+)
+@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 12.0\"
+@if "%VSINSTALLDIR%"=="%TEST_VS%" (
+ @echo TOOL_CHAIN_TAG = VS2013
+ @goto :EOF
+)
+@goto :EOF
+
+:SetEnv
+@set FIRST_COPY=FALSE
+@set MISSING_TARGET_TEMPLATE=FALSE
+@set MISSING_TOOLS_DEF_TEMPLATE=FALSE
+@set MISSING_BUILD_RULE_TEMPLATE=FALSE
+@if not exist "%SRC_CONF%\target.template" @set MISSING_TARGET_TEMPLATE=TRUE
+@if not exist "%SRC_CONF%\tools_def.template" @set
MISSING_TOOLS_DEF_TEMPLATE=TRUE
+@if not exist "%SRC_CONF%\build_rule.template" @set
MISSING_BUILD_RULE_TEMPLATE=TRUE
+
+@if not exist "%WORKSPACE%\Conf\target.txt" (
+ @if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo copying ... target.template to %WORKSPACE%\Conf\target.txt
+ @copy /Y "%SRC_CONF%\target.template" "%WORKSPACE%\Conf\target.txt" > nul
+ @set FIRST_COPY=TRUE
+)
+@if not exist "%WORKSPACE%\Conf\tools_def.txt" (
+ @if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo copying ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
+ @copy /Y "%SRC_CONF%\tools_def.template" "%WORKSPACE%\Conf\tools_def.txt"
> nul
+ @set FIRST_COPY=TRUE
+)
+@if not exist "%WORKSPACE%\Conf\build_rule.txt" (
+ @if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo copying ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
+ @copy /Y "%SRC_CONF%\build_rule.template"
"%WORKSPACE%\Conf\build_rule.txt" > nul
+ @set FIRST_COPY=TRUE
+)
+
+@if "%FIRST_COPY%"=="TRUE" @goto End
+@if not "%RECONFIG%"=="TRUE" @goto End
+
+@if "%RECONFIG%"=="TRUE" (
+ @echo.
+ @echo Over-writing the files in the WORKSPACE\Conf directory
+ @echo using the default template files
+ @echo.
+ @if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo over-write ... target.template to %WORKSPACE%\Conf\target.txt
+ @copy /Y "%SRC_CONF%\target.template" "%WORKSPACE%\Conf\target.txt" > nul
+
+ @if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo over-write ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
+ @copy /Y "%SRC_CONF%\tools_def.template" "%WORKSPACE%\Conf\tools_def.txt"
> nul
+
+ @if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @goto MissingTemplates
+ @echo over-write ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
+ @copy /Y "%SRC_CONF%\build_rule.template"
"%WORKSPACE%\Conf\build_rule.txt" > nul
+ @goto End
+)
+
+:MissingTemplates
+@echo.
+@if "%RECONFIG%"=="TRUE" @echo ERROR : Reconfig failed
+@if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate:
"%SRC_CONF%\target.template"
+@if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate:
"%SRC_CONF%\tools_def.template"
+@if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate:
"%SRC_CONF%\build_rule.template"
+@echo.
+@set MISSING_TARGET_TEMPLATE=
+@set MISSING_TOOLS_DEF_TEMPLATE=
+@set MISSING_BUILD_RULE_TEMPLATE=
+@set FIRST_COPY=
+@set SE_VERSION=
+@set SE_SVN_REVISION=
+@if not "%SCRIPT%"=="EDKSETUP_BAT" @echo on
+exit /B 1
+
+:End
+@set MISSING_TARGET_TEMPLATE=
+@set MISSING_TOOLS_DEF_TEMPLATE=
+@set MISSING_BUILD_RULE_TEMPLATE=
+@set FIRST_COPY=
+@set SE_VERSION=
+@set SE_SVN_REVISION=
+@if not "%SCRIPT%"=="EDKSETUP_BAT" @echo on
+exit /B 0
Added: trunk/edk2/BaseTools/Scripts/UpdateBuildVersions.py
===================================================================
--- trunk/edk2/BaseTools/Scripts/UpdateBuildVersions.py
(rev 0)
+++ trunk/edk2/BaseTools/Scripts/UpdateBuildVersions.py 2014-08-21 16:41:41 UTC
(rev 15867)
@@ -0,0 +1,400 @@
+## @file
+# Update build revisions of the tools when performing a developer build
+#
+# This script will modife the C/Include/Common/BuildVersion.h file and the two
+# Python scripts, Python/Common/BuildVersion.py and Python/UPT/BuildVersion.py.
+# If SVN is available, the tool will obtain the current checked out version of
+# the source tree for including the the --version commands.
+
+# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD
License
+# which accompanies this distribution. The full text of the license may be
found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED.
+##
+""" This program will update the BuildVersion.py and BuildVersion.h files used
to set a tool's version value """
+from __future__ import absolute_import
+
+import os
+import shlex
+import subprocess
+import sys
+
+from argparse import ArgumentParser, SUPPRESS
+from tempfile import NamedTemporaryFile
+from types import IntType, ListType
+
+
+SYS_ENV_ERR = "ERROR : %s system environment variable must be set prior to
running this tool.\n"
+
+__execname__ = "UpdateBuildVersions.py"
+SVN_REVISION = "$Revision: 3 $"
+SVN_REVISION = SVN_REVISION.replace("$Revision:", "").replace("$", "").strip()
+__copyright__ = "Copyright (c) 2014, Intel Corporation. All rights reserved."
+VERSION_NUMBER = "0.7.0"
+__version__ = "Version %s.%s" % (VERSION_NUMBER, SVN_REVISION)
+
+
+def ParseOptions():
+ """
+ Parse the command-line options.
+ The options for this tool will be passed along to the MkBinPkg tool.
+ """
+ parser = ArgumentParser(
+ usage=("%s [options]" % __execname__),
+ description=__copyright__,
+ conflict_handler='resolve')
+
+ # Standard Tool Options
+ parser.add_argument("--version", action="version",
+ version=__execname__ + " " + __version__)
+ parser.add_argument("-s", "--silent", action="store_true",
+ dest="silent",
+ help="All output will be disabled, pass/fail
determined by the exit code")
+ parser.add_argument("-v", "--verbose", action="store_true",
+ dest="verbose",
+ help="Enable verbose output")
+ # Tool specific options
+ parser.add_argument("--revert", action="store_true",
+ dest="REVERT", default=False,
+ help="Revert the BuildVersion files only")
+ parser.add_argument("--svn-test", action="store_true",
+ dest="TEST_SVN", default=False,
+ help="Test if the svn command is available")
+ parser.add_argument("--svnFlag", action="store_true",
+ dest="HAVE_SVN", default=False,
+ help=SUPPRESS)
+
+ return(parser.parse_args())
+
+
+def ShellCommandResults(CmdLine, Opt):
+ """ Execute the comand, returning the output content """
+ file_list = NamedTemporaryFile(delete=False)
+ filename = file_list.name
+ Results = []
+
+ returnValue = 0
+ try:
+ subprocess.check_call(args=shlex.split(CmdLine),
stderr=subprocess.STDOUT, stdout=file_list)
+ except subprocess.CalledProcessError as err_val:
+ file_list.close()
+ if not Opt.silent:
+ sys.stderr.write("ERROR : %d : %s\n" % (err_val.returncode,
err_val.__str__()))
+ if os.path.exists(filename):
+ sys.stderr.write(" : Partial results may be in this file:
%s\n" % filename)
+ sys.stderr.flush()
+ returnValue = err_val.returncode
+
+ except IOError as (errno, strerror):
+ file_list.close()
+ if not Opt.silent:
+ sys.stderr.write("I/O ERROR : %s : %s\n" % (str(errno), strerror))
+ sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)
+ if os.path.exists(filename):
+ sys.stderr.write(" : Partial results may be in this file:
%s\n" % filename)
+ sys.stderr.flush()
+ returnValue = errno
+
+ except OSError as (errno, strerror):
+ file_list.close()
+ if not Opt.silent:
+ sys.stderr.write("OS ERROR : %s : %s\n" % (str(errno), strerror))
+ sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)
+ if os.path.exists(filename):
+ sys.stderr.write(" : Partial results may be in this file:
%s\n" % filename)
+ sys.stderr.flush()
+ returnValue = errno
+
+ except KeyboardInterrupt:
+ file_list.close()
+ if not Opt.silent:
+ sys.stderr.write("ERROR : Command terminated by user : %s\n" %
CmdLine)
+ if os.path.exists(filename):
+ sys.stderr.write(" : Partial results may be in this file:
%s\n" % filename)
+ sys.stderr.flush()
+ returnValue = 1
+
+ finally:
+ if not file_list.closed:
+ file_list.flush()
+ os.fsync(file_list.fileno())
+ file_list.close()
+
+ if os.path.exists(filename):
+ fd_ = open(filename, 'r')
+ Results = fd_.readlines()
+ fd_.close()
+ os.unlink(filename)
+
+ if returnValue > 0:
+ return returnValue
+
+ return Results
+
+
+def UpdateBuildVersionPython(Rev, UserModified, opts):
+ """ This routine will update the BuildVersion.h files in the C source tree
"""
+ for SubDir in ["Common", "UPT"]:
+ PyPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source",
"Python", SubDir)
+ BuildVersionPy = os.path.join(PyPath, "BuildVersion.py")
+ fd_ = open(os.path.normpath(BuildVersionPy), 'r')
+ contents = fd_.readlines()
+ fd_.close()
+ if opts.HAVE_SVN is False:
+ BuildVersionOrig = os.path.join(PyPath, "orig_BuildVersion.py")
+ fd_ = open (BuildVersionOrig, 'w')
+ for line in contents:
+ fd_.write(line)
+ fd_.flush()
+ fd_.close()
+ new_content = []
+ for line in contents:
+ if line.strip().startswith("gBUILD_VERSION"):
+ new_line = "gBUILD_VERSION = \"Developer Build based on
Revision: %s\"" % Rev
+ if UserModified:
+ new_line = "gBUILD_VERSION = \"Developer Build based on
Revision: %s with Modified Sources\"" % Rev
+ new_content.append(new_line)
+ continue
+ new_content.append(line)
+
+ fd_ = open(os.path.normpath(BuildVersionPy), 'w')
+ for line in new_content:
+ fd_.write(line)
+ fd_.close()
+
+
+def UpdateBuildVersionH(Rev, UserModified, opts):
+ """ This routine will update the BuildVersion.h files in the C source tree
"""
+ CPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "C",
"Include", "Common")
+ BuildVersionH = os.path.join(CPath, "BuildVersion.h")
+ fd_ = open(os.path.normpath(BuildVersionH), 'r')
+ contents = fd_.readlines()
+ fd_.close()
+ if opts.HAVE_SVN is False:
+ BuildVersionOrig = os.path.join(CPath, "orig_BuildVersion.h")
+ fd_ = open(BuildVersionOrig, 'w')
+ for line in contents:
+ fd_.write(line)
+ fd_.flush()
+ fd_.close()
+
+ new_content = []
+ for line in contents:
+ if line.strip().startswith("#define"):
+ new_line = "#define __BUILD_VERSION \"Developer Build based on
Revision: %s\"" % Rev
+ if UserModified:
+ new_line = "#define __BUILD_VERSION \"Developer Build based on
Revision: %s with Modified Sources\"" % \
+ Rev
+ new_content.append(new_line)
+ continue
+ new_content.append(line)
+
+ fd_ = open(os.path.normpath(BuildVersionH), 'w')
+ for line in new_content:
+ fd_.write(line)
+ fd_.close()
+
+
+def RevertCmd(Filename, Opt):
+ """ This is the shell command that does the SVN revert """
+ CmdLine = "svn revert %s" % Filename.replace("\\", "/").strip()
+ try:
+ subprocess.check_output(args=shlex.split(CmdLine))
+ except subprocess.CalledProcessError as err_val:
+ if not Opt.silent:
+ sys.stderr.write("Subprocess ERROR : %s\n" % err_val)
+ sys.stderr.flush()
+
+ except IOError as (errno, strerror):
+ if not Opt.silent:
+ sys.stderr.write("I/O ERROR : %d : %s\n" % (str(errno), strerror))
+ sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)
+ sys.stderr.flush()
+
+ except OSError as (errno, strerror):
+ if not Opt.silent:
+ sys.stderr.write("OS ERROR : %d : %s\n" % (str(errno), strerror))
+ sys.stderr.write("ERROR : this command failed : %s\n" % CmdLine)
+ sys.stderr.flush()
+
+ except KeyboardInterrupt:
+ if not Opt.silent:
+ sys.stderr.write("ERROR : Command terminated by user : %s\n" %
CmdLine)
+ sys.stderr.flush()
+
+ if Opt.verbose:
+ sys.stdout.write("Reverted this file: %s\n" % Filename)
+ sys.stdout.flush()
+
+
+def GetSvnRevision(opts):
+ """ Get the current revision of the BaseTools/Source tree, and check if
any of the files have been modified """
+ Revision = "Unknown"
+ Modified = False
+
+ if opts.HAVE_SVN is False:
+ sys.stderr.write("WARNING: the svn command-line tool is not
available.\n")
+ return (Revision, Modified)
+
+ SrcPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source")
+ # Check if there are modified files.
+ Cwd = os.getcwd()
+ os.chdir(SrcPath)
+
+ StatusCmd = "svn st -v --depth infinity --non-interactive"
+ contents = ShellCommandResults(StatusCmd, opts)
+ os.chdir(Cwd)
+ if type(contents) is ListType:
+ for line in contents:
+ if line.startswith("M "):
+ Modified = True
+ break
+
+ # Get the repository revision of BaseTools/Source
+ InfoCmd = "svn info %s" % SrcPath.replace("\\", "/").strip()
+ Revision = 0
+ contents = ShellCommandResults(InfoCmd, opts)
+ if type(contents) is IntType:
+ return 0, Modified
+ for line in contents:
+ line = line.strip()
+ if line.startswith("Revision:"):
+ Revision = line.replace("Revision:", "").strip()
+ break
+
+ return (Revision, Modified)
+
+
+def CheckSvn(opts):
+ """
+ This routine will return True if an svn --version command succeeds, or
False if it fails.
+ If it failed, SVN is not available.
+ """
+ OriginalSilent = opts.silent
+ opts.silent = True
+ VerCmd = "svn --version"
+ contents = ShellCommandResults(VerCmd, opts)
+ opts.silent = OriginalSilent
+ if type(contents) is IntType:
+ if opts.verbose:
+ sys.stdout.write("SVN does not appear to be available.\n")
+ sys.stdout.flush()
+ return False
+
+ if opts.verbose:
+ sys.stdout.write("Found %s" % contents[0])
+ sys.stdout.flush()
+ return True
+
+
+def CopyOrig(Src, Dest, Opt):
+ """ Overwrite the Dest File with the Src File content """
+ try:
+ fd_ = open(Src, 'r')
+ contents = fd_.readlines()
+ fd_.close()
+ fd_ = open(Dest, 'w')
+ for line in contents:
+ fd_.write(line)
+ fd_.flush()
+ fd_.close()
+ except IOError:
+ if not Opt.silent:
+ sys.stderr.write("Unable to restore this file: %s\n" % Dest)
+ sys.stderr.flush()
+ return 1
+
+ os.remove(Src)
+ if Opt.verbose:
+ sys.stdout.write("Restored this file: %s\n" % Src)
+ sys.stdout.flush()
+
+ return 0
+
+
+def CheckOriginals(Opts):
+ """
+ If SVN was not available, then the tools may have made copies of the
original BuildVersion.* files using
+ orig_BuildVersion.* for the name. If they exist, replace the existing
BuildVersion.* file with the corresponding
+ orig_BuildVersion.* file.
+ Returns 0 if this succeeds, or 1 if the copy function fails. It will also
return 0 if the orig_BuildVersion.* file
+ does not exist.
+ """
+ CPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "C",
"Include", "Common")
+ BuildVersionH = os.path.join(CPath, "BuildVersion.h")
+ OrigBuildVersionH = os.path.join(CPath, "orig_BuildVersion.h")
+ if not os.path.exists(OrigBuildVersionH):
+ return 0
+ if CopyOrig(OrigBuildVersionH, BuildVersionH, Opts):
+ return 1
+ for SubDir in ["Common", "UPT"]:
+ PyPath = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source",
"Python", SubDir)
+ BuildVersionPy = os.path.join(PyPath, "BuildVersion.h")
+ OrigBuildVersionPy = os.path.join(PyPath, "orig_BuildVersion.h")
+ if not os.path.exists(OrigBuildVersionPy):
+ return 0
+ if CopyOrig(OrigBuildVersionPy, BuildVersionPy, Opts):
+ return 1
+
+ return 0
+
+
+def RevertBuildVersionFiles(opts):
+ """
+ This routine will attempt to perform an SVN --revert on each of the
BuildVersion.* files
+ """
+ if not opts.HAVE_SVN:
+ if CheckOriginals(opts):
+ return 1
+ return 0
+ # SVN is available
+ BuildVersionH = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source", "C",
"Include", "Common", "BuildVersion.h")
+ RevertCmd(BuildVersionH, opts)
+ for SubDir in ["Common", "UPT"]:
+ BuildVersionPy = os.path.join(os.environ['BASE_TOOLS_PATH'], "Source",
"Python", SubDir, "BuildVersion.py")
+ RevertCmd(BuildVersionPy, opts)
+
+def UpdateRevisionFiles():
+ """ Main routine that will update the BuildVersion.py and BuildVersion.h
files."""
+ options = ParseOptions()
+ # Check the working environment
+ if "WORKSPACE" not in os.environ.keys():
+ sys.stderr.write(SYS_ENV_ERR % 'WORKSPACE')
+ return 1
+ if 'BASE_TOOLS_PATH' not in os.environ.keys():
+ sys.stderr.write(SYS_ENV_ERR % 'BASE_TOOLS_PATH')
+ return 1
+ if not os.path.exists(os.environ['BASE_TOOLS_PATH']):
+ sys.stderr.write("Unable to locate the %s directory." %
os.environ['BASE_TOOLS_PATH'])
+ return 1
+
+
+ options.HAVE_SVN = CheckSvn(options)
+ if options.TEST_SVN:
+ return (not options.HAVE_SVN)
+ # done processing the option, now use the option.HAVE_SVN as a flag. True
= Have it, False = Don't have it.
+ if options.REVERT:
+ # Just revert the tools an exit
+ RevertBuildVersionFiles(options)
+ else:
+ # Revert any changes in the BuildVersion.* files before setting them
again.
+ RevertBuildVersionFiles(options)
+ Revision, Modified = GetSvnRevision(options)
+ if options.verbose:
+ sys.stdout.write("Revision: %s is Modified: %s\n" % (Revision,
Modified))
+ sys.stdout.flush()
+ UpdateBuildVersionH(Revision, Modified, options)
+ UpdateBuildVersionPython(Revision, Modified, options)
+
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(UpdateRevisionFiles())
+
+
Added: trunk/edk2/Edk2Setup.bat
===================================================================
--- trunk/edk2/Edk2Setup.bat (rev 0)
+++ trunk/edk2/Edk2Setup.bat 2014-08-21 16:41:41 UTC (rev 15867)
@@ -0,0 +1,475 @@
+@REM @file
+@REM Windows batch file, Edk2Setup.bat, to set up an EDK II build environment
+@REM
+@REM This script will be renamed to edksetup.bat after initial testing and
+@REM acceptance by the open source community.
+@REM
+@REM This script will set the following system environment variables:
+@REM WORKSPACE, EDK_TOOLS_PATH, PATH
+@REM If rebuilding the tools:
+@REM BASE_TOOLS_PATH, PYTHON_FREEZER_PATH, PYTHONPATH
+@REM It will also create a Conf/target.txt, tools_def.txt and build_rule.txt
files
+@REM if they do not exist
+@REM If the reset flag is set, all environment variables will be reset and
+@REM the Conf/target.txt, tools_def.txt and build_rule.txt files will be
overwritten
+@REM
+@REM Three other scripts, located in the BaseTools\Scripts directory, may be
called
+@REM by this script.
+@REM SetVisualStudio.bat - will set the Visual Studio environment based on
the --vs* flags
+@REM it is also used to build the Win32 binaries,
calling nmake
+@REM using the WORKSPACE\BaseTools\Makefile
+@REM ShowEnvironment.bat - will display the current EDK II Build environment
+@REM UpdateBuildVersions.py - script is called prior to building the EDK II
BaseTools from
+@REM Sources. This tool will modify the
BuildVersion.* files so that
+@REM when the tools get built, they will have a
custom version entry
+@REM similar to the following:
+@REM e:\edk2>build --version
+@REM build.exe Version 0.51 Developer Build based on Revision: 15668
+@REM
+@REM Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+@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
+@REM http://opensource.org/licenses/bsd-license.php
+@REM
+@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED.
+@REM
+@REM
+@REM usage:
+@REM Edk2Setup.bat [--help | -h] [-v | --version] [-r | --reset]
+@REM [--reconfig] [--edk-tools-path DirName]
+@REM [--pull [Directory]| --rebuild [Directory]]
+@REM [--nt32 [X64]]
+
+@REM ##############################################################
+@REM # You should not have to modify anything below this line
+@REM #
+@echo off
+@set SCRIPT_NAME=%0
+@set SCRIPT_VERSION=0.9.0.
+@set SVN_REVISION=$Revision: 8 $
+@set RESET_ENVIRONMENT=FALSE
+@set NT32PKG=FALSE
+@set NT32_64=FALSE
+@set BUILD_TOOLS_WITH=
+@set LOCATION=
+@set REBUILD_TOOLS=
+@set SVN_PULL=
+@set SRC_CONF=
+@set ARGUMENT=
+@set SCRIPT=EDKSETUP_BAT
+
+@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 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 )
+
+@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
+@REM still take precedence if the location option follows the reset option
+@REM on the command line.
+@if defined EDK_TOOLS_PATH @set "LOCATION=%EDK_TOOLS_PATH%"
+
+:parse_cmd_line
+@if "%1"=="" @goto MainRoutine
+@if /I "%1"=="-h" @goto Usage
+@if /I "%1"=="--help" @goto Usage
+@if /I "%1"=="/?" @goto Usage
+@if /I "%1"=="--version" @goto Version
+
+@REM These options will reset the system environment
+@if /I "%1"=="-r" (
+ @setlocal EnableDelayedExpansion
+ @set "WORKSPACE=%CD%"
+ @set "EDK_TOOLS_PATH=%CD%\BaseTools"
+ @set "LOCATION=!EDK_TOOLS_PATH!"
+ @endlocal
+ @shift
+ @goto parse_cmd_line
+)
+@if /I "%1"=="--reset" (
+ @set "WORKSPACE=%CD%"
+ @set "EDK_TOOLS_PATH=%WORKSPACE%\BaseTools"
+ @set "LOCATION=%WORKSPACE%\BaseTools"
+ @shift
+ @goto parse_cmd_line
+)
+
+@REM This option is used to overwrite the Conf/*.txt files with the
+@REM WORKSPACE\BaseTools\Conf\*.template files.
+@if /I "%1"=="--reconfig" (
+ @set RECONFIG=TRUE
+ @shift
+ @goto parse_cmd_line
+)
+
+@REM This option can be used to set the EDK_TOOLS_PATH containing the Win32
binaries to an
+@REM alternate directory
+@if /I "%1"=="--edk-tools-path" (
+ @setlocal EnableDelayedExpansion
+ @set ARGUMENT=%2
+ @if "!ARGUMENT:~0,2!"=="--" (
+ @echo.
+ @echo ERROR : The --edk-tools-path flag requires an argument
+ @echo.
+ @endlocal
+ @goto Usage
+ )
+ @endlocal
+ @set "LOCATION=%WORKSPACE%\%2"
+ @shift
+ @shift
+ @goto parse_cmd_line
+)
+
+@REM Force pulling updated (or checkout if they do not exist) from SVN for the
BaseTools\Bin\Win32 directory
+@REM or the directory pointed to by the --location option
+@if /I "%1"=="--pull" (
+ @if "%REBUILD_TOOLS%"=="TRUE" (
+ @echo.
+ @echo ERROR: The --pull option may not be used with the --rebuild
option
+ @shift
+ @goto ExitFailure
+ )
+ @set SVN_PULL=TRUE
+ @setlocal EnableDelayedExpansion
+ @set ARGUMENT=%2
+ @if not "!ARGUMENT:~0,2!"=="--" (
+ @endlocal
+ @set "LOCATION=%2"
+ @shift
+ )
+ @shift
+ @goto parse_cmd_line
+)
+
+@REM This options forces rebuilding the tools (provided the required tools are
available
+@if /I "%1"=="--rebuild" (
+ @if "%SVN_PULL%"=="TRUE" (
+ @echo.
+ @echo ERROR: The --reset option may not be used with the --pull option
+ @shift
+ @goto ExitFailure
+ )
+ @set REBUILD_TOOLS=TRUE
+ @setlocal EnableDelayedExpansion
+ @set ARGUMENT=%2
+ @if not "!ARGUMENT:~0,2!"=="--" (
+ @endlocal
+ @set "LOCATION=%2"
+ @shift
+ )
+ @shift
+ goto parse_cmd_line
+)
+
+@REM This option will try to set the compiler environment for building
Nt32Pkg/Nt32Pkg.dsc
+@REM If the compiler environment is already installed, then no additional work
is required.
+@if /I "%1"=="--nt32" (
+ @set NT32PKG=TRUE
+ @if not defined BUILD_TOOLS_WITH (
+ @set BUILD_TOOLS_WITH=Latest
+ )
+ @REM This option will try to set the environment for building the
Nt32Pkg/Nt32Pkg; on a 64-bit
+ @REM Windows OS
+ @if /I "%2"=="X64" (
+ @set NT32_64=TRUE
+ @shift
+ )
+ @shift
+ @goto parse_cmd_line
+)
+
+@if not "%1"=="" goto UnknownOptionOrArgument
+@goto MainRoutine
+
+:Usage
+@echo Usage: %SCRIPT_NAME% [Options]
+@echo Copyright(c) 2014, Intel Corporation. All rights reserved.
+@echo.
+@echo The system environment variable, WORKSPACE, is always set to the current
+@echo working directory.
+@echo.
+@echo Options:
+@echo --help, -h Print this help screen and exit.
+@echo.
+@echo --version Print this script's version and exit.
+@echo.
+@echo --reset, -r Reset the EDK_TOOLS_PATH and PATH system
environment
+@echo variables. The EDK_TOOLS_PATH default is
+@echo WORKSPACE\BaseTools, however, it may be overridden
by
+@echo arguments given to the --edk-tools-path, --pull
and/or
+@echo --rebuild options.
+@echo Once set, the EDK_TOOLS_PATH environment variable
reset
+@echo by opening up a new command prompt window or
through one
+@echo of the options provided by this tool
+@echo.
+@echo --reconfig Overwrite the WORKSPACE/Conf/*.txt files with the
+@echo template files from the BaseTools/Conf directory.
+@echo.
+@echo --edk-tools-path DIRECTORY
+@echo This option sets the EDK_TOOLS_PATH to the
DIRECTORY
+@echo value instead of the default (WORKSPACE\BaseTools).
+@echo.
+@echo --nt32 [X64] If a compiler tool chain is not available in the
+@echo environment, call a script to attempt to set one
up.
+@echo This flag is only required if building the
+@echo Nt32Pkg/Nt32Pkg.dsc system emulator.
+@echo If the X64 argument is set, and a compiler tool
chain is
+@echo not available, attempt to set up a tool chain that
will
+@echo create X64 binaries. Setting these two options
have the
+@echo potential side effect of changing tool chains used
for a
+@echo rebuild.
+@echo.
+@pause
+@echo.
+@echo --pull [DIRECTORY] Get the EDK II BaseTools binaries from source
control
+@echo (must not be used with --rebuild).
+@echo If the optional DIRECTORY argument is specified,
the tool
+@echo sets EDK_TOOLS_PATH to DIRECTORY.
+@echo If the DIRECTORY argument is not specified, the
tools are
+@echo placed in the directory tree pointed to by the
current
+@echo EDK_TOOLS_PATH environment variable. If the
binaries
+@echo cannot be obtained from source control, the
+@echo EDK_TOOLS_PATH will be set to the default,
+@echo WORKSPACE\BaseTools directory.
+@echo.
+@echo --rebuild [DIRECTORY]
+@echo Force Rebuilding the EDK II BaseTools from source
+@echo (must not be used with --pull).
+@echo NOTE: The build will use whatever compiler
tool set
+@echo is available in the environment prior to
+@echo running edksetup.bat.
+@echo If the optional DIRECTORY argument is specified,
the tool
+@echo sets EDK_TOOLS_PATH to DIRECTORY. Tools binaries
will be
+@echo placed in the appropriate subdirectory in the
+@echo EDK_TOOLS_PATH directory. If the build fails, the
+@echo EDK_TOOLS_PATH will be set to the default,
+@echo WORKSPACE\BaseTools directory.
+@goto ExitSuccess
+
+:Version
+@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"
+@set HIDE_PATH=
+@goto ExitSuccess
+
+:UnknownOptionOrArgument
+@echo. ERROR : This argument is not valid: %1
+@echo.
+@goto ExitFailure
+
+:NoVisualStudio
+@echo ERROR : Unable to determine if a compiler tool chain has been enabled in
this
+@echo command-prompt window. Rebuilding of the tools with this script
is not
+@echo possible.
+@echo Refer to the BaseTools\BuildNotes.txt for directions for
building
+@echo the BaseTools binaries.
+@echo.
+@goto ExitFailure
+
+:NoPython
+@echo ERROR : Unable to rebuild the BaseTools binaries, python does not appear
to be
+@echo installed. If python is installed, please set the environment
+@echo variable, PYTHONHOME to the Path to the python.exe, for example,
+@echo if python.exe is located in the C:\Python27 directory, then:
+@echo set PYTHONHOME=C:\Python27
+@echo.
+@goto ExitFailure
+
+:BadPython
+@echo ERROR : Unable to rebuild the BaseTools binaries, python does not appear
to be
+@echo installed.
+@echo The python executable was not found in the PYTHONHOME:
%PYTHONHOME%
+@echo If python is installed, please set the environment variable,
PYTHONHOME
+@echo to the Path that contains python.exe, for example, if python.exe
is
+@echo located in the C:\Python27 directory, then:
+@echo set PYTHONHOME=C:\Python27
+@echo.
+@goto ExitFailure
+
+:NoCxFreeze
+@echo ERROR : Unable to locate cx_Freeze 4.2.3. The cxfreeze.bat file must be
located
+@echo in the %PYTHONHOME%\Scripts directoryin order to rebuild the
BaseTools
+@echo binaries.
+@echo.
+@goto ExitFailure
+
+:NoBaseTools
+@echo ERROR: Unable to locate the BaseTools directory containing the Source
tree
+@echo.
+@goto ExitFailure
+
+@REM
#########################################################################################
+@REM MAIN ROUTINE
+@REM Set up the Build System environment
+@REM
#########################################################################################
+:MainRoutine
+@if defined LOCATION @set "EDK_TOOLS_PATH=%LOCATION%"
+@REM SET the EDK_TOOLS_PATH.
+@if not exist "%EDK_TOOLS_PATH%" (
+ @mkdir %EDK_TOOLS_PATH%
+)
+
+@REM Set up the path to include the EDK_TOOLS_PATH\Bin\Win32 directory; this
test determines
+@REM whether the path is in the workspace or a fully qualified path that may
be outside of
+@REM the workspace
+@if exist "%WORKSPACE%\%EDK_TOOLS_PATH%" @set
"EDK_TOOLS_PATH=%WORKSPACE%\%EDK_TOOLS_PATH%"
+
+@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
+)
+@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
+@echo EDK II repository.
+@echo.
+@echo If you really want to build the tools, use the --rebuild option.
+@echo.
+@if not defined CYGWIN_HOME @echo "!!! WARNING !!! No CYGWIN_HOME set, gcc
build may not be used !!!"
+@if not defined CYGWIN_HOME @echo.
+@REM Make sure the WORKSPACE\Conf directory contains the required text files
that will be
+@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"
+ )
+) else (
+ @set "SRC_CONF=%EDK_TOOLS_PATH%\Conf"
+)
+@if not defined SRC_CONF (
+ @echo ERROR : Unable to locate the BaseTools directory tree
+ @goto ExitFailure
+)
+
+@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"
+@if errorlevel 1 (
+ @echo Unable to copy the template files from "%SRC_CONF%" to
"%WORKSPACE%\Conf"
+ @goto ExitFailure
+)
+@set SRC_CONF=
+
+@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
+ @set NT32_X64=
+)
+@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 "%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
+ @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
+ @echo the binaries
+ @echo.
+ @goto ExitFailure
+ )
+ @if exist %EDK_TOOLS_PATH%\Bin\Win32 @rmdir /S /Q
%EDK_TOOLS_PATH%\Bin\Win32
+ @call svn co
https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
"%EDK_TOOLS_PATH%\Bin\Win32"
+ ) else (
+ @call svn co
https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
"%EDK_TOOLS_PATH%\Bin\Win32"
+ @if errorlevel 1 (
+ @echo ERROR : The command-line svn tool is not available and the
Win32 binaries do not exist
+ @echo Python does not appear to be available either. This
script cannot be used to
+ @echo build the Win32 binaries or to obtain them from this
repository:
+ @echo
https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
+ @goto ExitFailure
+ )
+ )
+ @goto ShowAndExit
+)
+
+@if not "%REBUILD_TOOLS%"=="TRUE" @goto ShowAndExit
+
+@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
+@if not defined PYTHONHOME @goto NoPython
+@if not exist "%PYTHONHOME%\python.exe" @goto BadPython
+@REM python.exe has been located, now make sure it's in the PATH
+@call python --version > nul 2>&1
+@if errorlevel 1 @set "PATH=%PYTHONHOME%\python.exe;%PATH%"
+@if not defined PYTHON_FREEZER_PATH (
+ @if not exist %PYTHONHOME%\Scripts\cxfreeze.bat @goto NoCxFreeze
+ @set PYTHON_FREEZER_PATH=%PYTHONHOME%\Scripts
+)
+@call "%WORKSPACE%\BaseTools\Scripts\SetVisualStudio.bat"
+@if errorlevel 1 @goto ExitFailure
+
+:ShowAndExit
+@call "%WORKSPACE%\BaseTools\Scripts\ShowEnvironment.bat"
+
+@REM
#########################################################################################
+@REM EXIT ROUTINES
+@REM
#########################################################################################
+:ExitSuccess
+@set SCRIPT_NAME=
+@set SCRIPT_VERSION=
+@set SVN_REVISION=
+@set RESET_ENVIRONMENT=
+@set RECONFIG=
+@set NT32PKG=
+@set NT32_64=
+@set BUILD_TOOLS_WITH=
+@set LOCATION=
+@set REBUILD_TOOLS=
+@set SVN_PULL=
+@set SRC_CONF=
+@set ARGUMENT=
+@set SCRIPT=
+@set LIST_VS_VERSIONS=
+@set PYTHON_FREEZER_PATH=
+@echo on
+@exit /B 0
+
+:ExitFailure
+@set SCRIPT_NAME=
+@set SCRIPT_VERSION=
+@set SVN_REVISION=
+@set RESET_ENVIRONMENT=
+@set RECONFIG=
+@set NT32PKG=
+@set NT32_64=
+@set BUILD_TOOLS_WITH=
+@set LOCATION=
+@set REBUILD_TOOLS=
+@set SVN_PULL=
+@set SRC_CONF=
+@set ARGUMENT=
+@set SCRIPT=
+@set LIST_VS_VERSIONS=
+@set PYTHON_FREEZER_PATH=
+@echo on
+@exit /B 1
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits