slimbootloader/BaseTools/set_vsprefix_envs.bat

179 lines
6.2 KiB
Batchfile
Raw Normal View History

Use LF line endings in the repository Convert the line endings stored for all text files in the repository to LF. The majority previously used DOS-style CRLF line endings. Add a .gitattributes file to enforce this and treat certain extensions as never being text files. Update PatchCheck.py to insist on LF line endings rather than CRLF. However, its other checks fail on this commit due to lots of pre-existing complaints that it only notices because the line endings have changed. Silicon/QemuSocPkg/FspBin/Patches/0001-Build-QEMU-FSP-2.0-binaries.patch needs to be treated as binary since it contains a mixture of line endings. This change has implications depending on the client platform you are using the repository from: * Windows The usual configuration for Git on Windows means that text files will be checked out to the work tree with DOS-style CRLF line endings. If that's not the case then you can configure Git to do so for the entire machine with: git config --global core.autocrlf true or for just the repository with: git config core.autocrlf true Line endings will be normalised to LF when they are committed to the repository. If you commit a text file with only LF line endings then it will be converted to CRLF line endings in your work tree. * Linux, MacOS and other Unices The usual configuration for Git on such platforms is to check files out of the repository with LF line endings. This is probably the right thing for you. In the unlikely even that you are using Git on Unix but editing or compiling on Windows for some reason then you may need to tweak your configuration to force the use of CRLF line endings as described above. * General For more information see https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings . Fixes: https://github.com/slimbootloader/slimbootloader/issues/1400 Signed-off-by: Mike Crowe <mac@mcrowe.com>
2021-11-10 19:36:23 +08:00
@REM @file
@REM This stand-alone program is typically called by the toolsetup.bat file,
@REM however it may be executed directly from the BaseTools project folder
@REM if the file is not executed within a WORKSPACE\BaseTools folder.
@REM
@REM Copyright (c) 2016-2020, Intel Corporation. All rights reserved.<BR>
@REM
@REM SPDX-License-Identifier: BSD-2-Clause-Patent
@REM
@echo off
pushd .
set SCRIPT_ERROR=0
goto main
:ToolNotInstall
set SCRIPT_ERROR=1
goto :EOF
:main
if /I "%1"=="VS2019" goto SetVS2019
if /I "%1"=="VS2017" goto SetVS2017
if /I "%1"=="VS2015" goto SetVS2015
if defined VS71COMNTOOLS (
if not defined VS2003_PREFIX (
set "VS2003_PREFIX=%VS71COMNTOOLS:~0,-14%"
)
)
:SetVS2015
if defined VS140COMNTOOLS (
if not defined VS2015_PREFIX (
set "VS2015_PREFIX=%VS140COMNTOOLS:~0,-14%"
)
if not defined WINSDK81_PREFIX (
set "WINSDK81_PREFIX=c:\Program Files\Windows Kits\8.1\bin\"
)
if not defined WINSDK81x86_PREFIX (
set "WINSDK81x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.1\bin\"
)
) else (
if /I "%1"=="VS2015" goto ToolNotInstall
)
if /I "%1"=="VS2015" goto SetWinDDK
:SetVS2017
if not defined VS150COMNTOOLS (
@REM clear two envs so that vcvars32.bat can run successfully.
set VSINSTALLDIR=
set VCToolsVersion=
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
)
del vswhereInfo
) else (
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
)
del vswhereInfo
)
) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
)
del vswhereInfo
) else (
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
)
del vswhereInfo
)
) else (
if /I "%1"=="VS2017" goto ToolNotInstall
goto SetWinDDK
)
)
if defined VCToolsInstallDir (
if not defined VS2017_PREFIX (
set "VS2017_PREFIX=%VCToolsInstallDir%"
)
if not defined WINSDK10_PREFIX (
if defined WindowsSdkVerBinPath (
set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
)
)
)
if not defined WINSDK_PATH_FOR_RC_EXE (
if defined WINSDK10_PREFIX (
set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
)
)
if /I "%1"=="VS2017" goto SetWinDDK
:SetVS2019
if not defined VS160COMNTOOLS (
@REM clear two envs so that vcvars32.bat can run successfully.
set VSINSTALLDIR=
set VCToolsVersion=
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
)
del vswhereInfo
) else (
call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
)
del vswhereInfo
)
) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
)
del vswhereInfo
) else (
call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
)
del vswhereInfo
)
) else (
if /I "%1"=="VS2019" goto ToolNotInstall
goto SetWinDDK
)
)
if defined VCToolsInstallDir (
if not defined VS2019_PREFIX (
set "VS2019_PREFIX=%VCToolsInstallDir%"
)
if not defined WINSDK10_PREFIX (
if defined WindowsSdkVerBinPath (
set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
)
)
)
if not defined WINSDK_PATH_FOR_RC_EXE (
if defined WINSDK10_PREFIX (
set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
)
)
if /I "%1"=="VS2019" goto SetWinDDK
:SetWinDDK
if not defined WINDDK3790_PREFIX (
set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\
)
if not defined IASL_PREFIX (
set IASL_PREFIX=C:\ASL\
)
popd