slimbootloader/BaseTools/get_vsvars.bat

101 lines
3.8 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 Windows batch file to find the Visual Studio set up script
@REM
@REM Copyright (c) 2013-2014, ARM Limited. All rights reserved.
@REM SPDX-License-Identifier: BSD-2-Clause-Patent
@REM
@echo off
set SCRIPT_ERROR=0
if "%1"=="" goto main
if /I "%1"=="VS2019" goto VS2019Vars
if /I "%1"=="VS2017" goto VS2017Vars
if /I "%1"=="VS2015" goto VS2015Vars
if /I "%1"=="VS2013" goto VS2013Vars
if /I "%1"=="VS2012" goto VS2012Vars
:set_vsvars
if defined VCINSTALLDIR goto :EOF
call %* > vswhereInfo
for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
if /i "%%i"=="installationPath" (
call "%%j\VC\Auxiliary\Build\vcvars32.bat"
)
)
del vswhereInfo
goto :EOF
:read_vsvars
@rem Do nothing if already found, otherwise call vsvars32.bat if there
if defined VCINSTALLDIR goto :EOF
set GET_VSVARS_BAT_CHECK_DIR=%*
set GET_VSVARS_BAT_CHECK_DIR=%GET_VSVARS_BAT_CHECK_DIR:"=%
if exist "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat" call "%GET_VSVARS_BAT_CHECK_DIR%\vsvars32.bat"
:vsvars_done
goto :EOF
:ToolNotInstall
set SCRIPT_ERROR=1
goto :EOF
REM NOTE: This file will find the most recent Visual Studio installation
REM apparent from the environment.
REM To use an older version, modify your environment set up.
REM (Or invoke the relevant vsvars32 file beforehand).
:main
if defined VCINSTALLDIR goto :done
:VS2019Vars
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17
) else (
call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17
)
)
if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17
) else (
call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17
)
)
if /I "%1"=="VS2019" goto ToolNotInstall
:VS2017Vars
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16
) else (
call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16
)
)
if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16
) else (
call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16
)
)
if /I "%1"=="VS2017" goto ToolNotInstall
:VS2015Vars
if defined VS140COMNTOOLS (call :read_vsvars "%VS140COMNTOOLS%") else (if /I "%1"=="VS2015" goto ToolNotInstall)
:VS2013Vars
if defined VS120COMNTOOLS ( call :read_vsvars "%VS120COMNTOOLS%") else (if /I "%1"=="VS2013" goto ToolNotInstall)
:VS2012Vars
if defined VS110COMNTOOLS (call :read_vsvars "%VS110COMNTOOLS%") else (if /I "%1"=="VS2012" goto ToolNotInstall)
if defined VS100COMNTOOLS call :read_vsvars "%VS100COMNTOOLS%"
if defined VS90COMNTOOLS call :read_vsvars "%VS90COMNTOOLS%"
if defined VS80COMNTOOLS call :read_vsvars "%VS80COMNTOOLS%"
if defined VS71COMNTOOLS call :read_vsvars "%VS71COMNTOOLS%"
:done
set GET_VSVARS_BAT_CHECK_DIR=