Skip to content

Commit 4acf0ac

Browse files
committed
Correct end of line normalisation.
1 parent 3709e0c commit 4acf0ac

File tree

4 files changed

+499
-499
lines changed

4 files changed

+499
-499
lines changed

install_script.bat

Lines changed: 193 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -1,194 +1,194 @@
1-
@echo OFF
2-
setlocal enabledelayedexpansion
3-
4-
REM Defined cript variables
5-
set YASMDL=http://www.tortall.net/projects/yasm/releases
6-
set YASMVERSION=1.3.0
7-
8-
REM Store current directory and ensure working directory is the location of current .bat
9-
set CALLDIR=%CD%
10-
set SCRIPTDIR=%~dp0
11-
12-
REM Initialise error check value
13-
SET ERROR=0
14-
15-
REM Check what architecture we are installing on
16-
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
17-
echo Detected 64 bit system...
18-
set SYSARCH=64
19-
) else if "%PROCESSOR_ARCHITECTURE%"=="x86" (
20-
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" (
21-
echo Detected 64 bit system running 32 bit shell...
22-
set SYSARCH=64
23-
) else (
24-
echo Detected 32 bit system...
25-
set SYSARCH=32
26-
)
27-
) else (
28-
echo Error: Could not detect current platform architecture!"
29-
goto Terminate
30-
)
31-
32-
REM Check if already running in an environment with VS setup
33-
if defined VCINSTALLDIR (
34-
if defined VisualStudioVersion (
35-
echo Existing Visual Studio environment detected...
36-
if "%VisualStudioVersion%"=="15.0" (
37-
set MSVC_VER=15
38-
goto MSVCVarsDone
39-
) else if "%VisualStudioVersion%"=="14.0" (
40-
set MSVC_VER=14
41-
goto MSVCVarsDone
42-
) else if "%VisualStudioVersion%"=="12.0" (
43-
set MSVC_VER=12
44-
goto MSVCVarsDone
45-
) else (
46-
echo Unknown Visual Studio environment detected '%VisualStudioVersion%', Creating a new one...
47-
)
48-
)
49-
)
50-
51-
REM First check for a environment variable to help locate the VS installation
52-
if defined VS140COMNTOOLS (
53-
if exist "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" (
54-
echo Visual Studio 2015 environment detected...
55-
call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" >nul 2>&1
56-
set MSVC_VER=14
57-
goto MSVCVarsDone
58-
)
59-
)
60-
if defined VS120COMNTOOLS (
61-
if exist "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" (
62-
echo Visual Studio 2013 environment detected...
63-
call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" >nul 2>&1
64-
set MSVC_VER=12
65-
goto MSVCVarsDone
66-
)
67-
)
68-
69-
REM Check for default install locations based on current system architecture
70-
if "%SYSARCH%"=="32" (
71-
set MSVCVARSDIR=
72-
set WOWNODE=
73-
) else if "%SYSARCH%"=="64" (
74-
set MSVCVARSDIR=\amd64
75-
set WOWNODE=\WOW6432Node
76-
) else (
77-
goto Terminate
78-
)
79-
80-
reg.exe query "HKLM\SOFTWARE%WOWNODE%\Microsoft\VisualStudio\SxS\VS7" /v 15.0 >nul 2>&1
81-
if not ERRORLEVEL 1 (
82-
echo Visual Studio 2017 installation detected...
83-
for /f "skip=2 tokens=2,*" %%a in ('reg.exe query "HKLM\SOFTWARE%WOWNODE%\Microsoft\VisualStudio\SxS\VS7" /v 15.0') do (set VSINSTALLDIR=%%b)
84-
call "!VSINSTALLDIR!VC\Auxiliary\Build\vcvars%SYSARCH%.bat" >nul 2>&1
85-
set MSVC_VER=15
86-
goto MSVCVarsDone
87-
)
88-
reg.exe query "HKLM\Software%WOWNODE%\Microsoft\VisualStudio\14.0" /v "InstallDir" >nul 2>&1
89-
if not ERRORLEVEL 1 (
90-
echo Visual Studio 2015 installation detected...
91-
for /f "skip=2 tokens=2,*" %%a in ('reg.exe query "HKLM\Software%WOWNODE%\Microsoft\VisualStudio\14.0" /v "InstallDir"') do (set VSINSTALLDIR=%%b)
92-
call "!VSINSTALLDIR!\VC\bin%MSVCVARSDIR%\vcvars%SYSARCH%.bat" >nul 2>&1
93-
set MSVC_VER=14
94-
goto MSVCVarsDone
95-
)
96-
reg.exe query "HKLM\Software%WOWNODE%\Microsoft\VisualStudio\13.0" /v "InstallDir" >nul 2>&1
97-
if not ERRORLEVEL 1 (
98-
echo Visual Studio 2013 installation detected...
99-
for /f "skip=2 tokens=2,*" %%a in ('reg.exe query "HKLM\Software%WOWNODE%\Microsoft\VisualStudio\13.0" /v "InstallDir"') do (set VSINSTALLDIR=%%b)
100-
call "!VSINSTALLDIR!\VC\bin%MSVCVARSDIR%\vcvars%SYSARCH%.bat" >nul 2>&1
101-
set MSVC_VER=13
102-
goto MSVCVarsDone
103-
)
104-
echo Error: Could not find valid Visual Studio installation!
105-
goto Terminate
106-
107-
:MSVCVarsDone
108-
REM Get the location of the current msbuild
109-
powershell.exe -Command ((Get-Command msbuild.exe)[0].Path ^| Split-Path -parent) > msbuild.txt
110-
findstr /C:"Get-Command" msbuild.txt >nul 2>&1
111-
if not ERRORLEVEL 1 (
112-
echo Error: Failed to get location of msbuild!
113-
del /F /Q msbuild.txt >nul 2>&1
114-
goto Terminate
115-
)
116-
set /p MSBUILDDIR=<msbuild.txt
117-
del /F /Q msbuild.txt >nul 2>&1
118-
if "%MSVC_VER%"=="15" (
119-
set VCTargetsPath="..\..\..\Common7\IDE\VC\VCTargets"
120-
) else (
121-
if "%MSBUILDDIR%"=="%MSBUILDDIR:amd64=%" (
122-
set VCTargetsPath="..\..\Microsoft.Cpp\v4.0\V%MSVC_VER%0"
123-
) else (
124-
set VCTargetsPath="..\..\..\Microsoft.Cpp\v4.0\V%MSVC_VER%0"
125-
)
126-
)
127-
128-
REM Convert the relative targets path to an absolute one
129-
set CURRDIR=%CD%
130-
pushd %MSBUILDDIR%
131-
pushd %VCTargetsPath%
132-
set VCTargetsPath=%CD%
133-
popd
134-
popd
135-
if not "%CURRDIR%"=="%CD%" (
136-
echo Error: Failed to resolve VCTargetsPath!
137-
goto Terminate
138-
)
139-
140-
REM copy the BuildCustomizations to VCTargets folder
141-
echo Installing build customisations...
142-
del /F /Q "%VCTargetsPath%\BuildCustomizations\yasm.*" >nul 2>&1
143-
copy /B /Y /V "%SCRIPTDIR%\yasm.*" "%VCTargetsPath%\BuildCustomizations\" >nul 2>&1
144-
if not exist "%VCTargetsPath%\BuildCustomizations\yasm.props" (
145-
echo Error: Failed to copy build customisations!
146-
echo Ensure that this script is run in a shell with the necessary write privileges
147-
goto Terminate
148-
)
149-
150-
REM Check if a yasm binary was bundled
151-
if not exist "%SCRIPTDIR%\yasm\" (
152-
REM Download the latest yasm binary for windows goto Terminate
153-
call :DownloadYasm
154-
) else (
155-
REM Use the bundled binaries
156-
copy /B /Y /V "%SCRIPTDIR%\yasm\yasm-%SYSARCH%.exe" "%SCRIPTDIR%\yasm.exe" >nul 2>&1
157-
)
158-
159-
REM copy yasm executable to VC installation folder
160-
echo Installing required YASM release binary...
161-
del /F /Q "%VCINSTALLDIR%\yasm.exe" >nul 2>&1
162-
move /Y "%SCRIPTDIR%\yasm.exe" "%VCINSTALLDIR%\" >nul 2>&1
163-
set INSTALLED=1
164-
if exist "%SCRIPTDIR%\yasm.exe" set INSTALLED=0
165-
if not exist "%VCINSTALLDIR%\yasm.exe" set INSTALLED=0
166-
if %INSTALLED% equ 0 (
167-
echo Error: Failed to install YASM binary!
168-
echo Ensure that this script is run in a shell with the necessary write privileges
169-
del /F /Q "%SCRIPTDIR%\yasm.exe" >nul 2>&1
170-
goto Terminate
171-
)
172-
echo Finished Successfully
173-
goto Exit
174-
175-
:Terminate
176-
SET ERROR=1
177-
178-
:Exit
179-
cd %CALLDIR%
180-
IF "%APPVEYOR%"=="" (
181-
pause
182-
)
183-
exit /b %ERROR%
184-
185-
:DownloadYasm
186-
echo Downloading required YASM release binary...
187-
set YASMDOWNLOAD=%YASMDL%/yasm-%YASMVERSION%-win%SYSARCH%.exe
188-
powershell.exe -Command (New-Object Net.WebClient).DownloadFile('%YASMDOWNLOAD%', '%SCRIPTDIR%\yasm.exe') >nul 2>&1
189-
if not exist "%SCRIPTDIR%\yasm.exe" (
190-
echo Error: Failed to download required YASM binary!
191-
echo The following link could not be resolved "%YASMDOWNLOAD%"
192-
goto Terminate
193-
)
1+
@echo OFF
2+
setlocal enabledelayedexpansion
3+
4+
REM Defined cript variables
5+
set YASMDL=http://www.tortall.net/projects/yasm/releases
6+
set YASMVERSION=1.3.0
7+
8+
REM Store current directory and ensure working directory is the location of current .bat
9+
set CALLDIR=%CD%
10+
set SCRIPTDIR=%~dp0
11+
12+
REM Initialise error check value
13+
SET ERROR=0
14+
15+
REM Check what architecture we are installing on
16+
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
17+
echo Detected 64 bit system...
18+
set SYSARCH=64
19+
) else if "%PROCESSOR_ARCHITECTURE%"=="x86" (
20+
if "%PROCESSOR_ARCHITEW6432%"=="AMD64" (
21+
echo Detected 64 bit system running 32 bit shell...
22+
set SYSARCH=64
23+
) else (
24+
echo Detected 32 bit system...
25+
set SYSARCH=32
26+
)
27+
) else (
28+
echo Error: Could not detect current platform architecture!"
29+
goto Terminate
30+
)
31+
32+
REM Check if already running in an environment with VS setup
33+
if defined VCINSTALLDIR (
34+
if defined VisualStudioVersion (
35+
echo Existing Visual Studio environment detected...
36+
if "%VisualStudioVersion%"=="15.0" (
37+
set MSVC_VER=15
38+
goto MSVCVarsDone
39+
) else if "%VisualStudioVersion%"=="14.0" (
40+
set MSVC_VER=14
41+
goto MSVCVarsDone
42+
) else if "%VisualStudioVersion%"=="12.0" (
43+
set MSVC_VER=12
44+
goto MSVCVarsDone
45+
) else (
46+
echo Unknown Visual Studio environment detected '%VisualStudioVersion%', Creating a new one...
47+
)
48+
)
49+
)
50+
51+
REM First check for a environment variable to help locate the VS installation
52+
if defined VS140COMNTOOLS (
53+
if exist "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" (
54+
echo Visual Studio 2015 environment detected...
55+
call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" >nul 2>&1
56+
set MSVC_VER=14
57+
goto MSVCVarsDone
58+
)
59+
)
60+
if defined VS120COMNTOOLS (
61+
if exist "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" (
62+
echo Visual Studio 2013 environment detected...
63+
call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" >nul 2>&1
64+
set MSVC_VER=12
65+
goto MSVCVarsDone
66+
)
67+
)
68+
69+
REM Check for default install locations based on current system architecture
70+
if "%SYSARCH%"=="32" (
71+
set MSVCVARSDIR=
72+
set WOWNODE=
73+
) else if "%SYSARCH%"=="64" (
74+
set MSVCVARSDIR=\amd64
75+
set WOWNODE=\WOW6432Node
76+
) else (
77+
goto Terminate
78+
)
79+
80+
reg.exe query "HKLM\SOFTWARE%WOWNODE%\Microsoft\VisualStudio\SxS\VS7" /v 15.0 >nul 2>&1
81+
if not ERRORLEVEL 1 (
82+
echo Visual Studio 2017 installation detected...
83+
for /f "skip=2 tokens=2,*" %%a in ('reg.exe query "HKLM\SOFTWARE%WOWNODE%\Microsoft\VisualStudio\SxS\VS7" /v 15.0') do (set VSINSTALLDIR=%%b)
84+
call "!VSINSTALLDIR!VC\Auxiliary\Build\vcvars%SYSARCH%.bat" >nul 2>&1
85+
set MSVC_VER=15
86+
goto MSVCVarsDone
87+
)
88+
reg.exe query "HKLM\Software%WOWNODE%\Microsoft\VisualStudio\14.0" /v "InstallDir" >nul 2>&1
89+
if not ERRORLEVEL 1 (
90+
echo Visual Studio 2015 installation detected...
91+
for /f "skip=2 tokens=2,*" %%a in ('reg.exe query "HKLM\Software%WOWNODE%\Microsoft\VisualStudio\14.0" /v "InstallDir"') do (set VSINSTALLDIR=%%b)
92+
call "!VSINSTALLDIR!\VC\bin%MSVCVARSDIR%\vcvars%SYSARCH%.bat" >nul 2>&1
93+
set MSVC_VER=14
94+
goto MSVCVarsDone
95+
)
96+
reg.exe query "HKLM\Software%WOWNODE%\Microsoft\VisualStudio\13.0" /v "InstallDir" >nul 2>&1
97+
if not ERRORLEVEL 1 (
98+
echo Visual Studio 2013 installation detected...
99+
for /f "skip=2 tokens=2,*" %%a in ('reg.exe query "HKLM\Software%WOWNODE%\Microsoft\VisualStudio\13.0" /v "InstallDir"') do (set VSINSTALLDIR=%%b)
100+
call "!VSINSTALLDIR!\VC\bin%MSVCVARSDIR%\vcvars%SYSARCH%.bat" >nul 2>&1
101+
set MSVC_VER=13
102+
goto MSVCVarsDone
103+
)
104+
echo Error: Could not find valid Visual Studio installation!
105+
goto Terminate
106+
107+
:MSVCVarsDone
108+
REM Get the location of the current msbuild
109+
powershell.exe -Command ((Get-Command msbuild.exe)[0].Path ^| Split-Path -parent) > msbuild.txt
110+
findstr /C:"Get-Command" msbuild.txt >nul 2>&1
111+
if not ERRORLEVEL 1 (
112+
echo Error: Failed to get location of msbuild!
113+
del /F /Q msbuild.txt >nul 2>&1
114+
goto Terminate
115+
)
116+
set /p MSBUILDDIR=<msbuild.txt
117+
del /F /Q msbuild.txt >nul 2>&1
118+
if "%MSVC_VER%"=="15" (
119+
set VCTargetsPath="..\..\..\Common7\IDE\VC\VCTargets"
120+
) else (
121+
if "%MSBUILDDIR%"=="%MSBUILDDIR:amd64=%" (
122+
set VCTargetsPath="..\..\Microsoft.Cpp\v4.0\V%MSVC_VER%0"
123+
) else (
124+
set VCTargetsPath="..\..\..\Microsoft.Cpp\v4.0\V%MSVC_VER%0"
125+
)
126+
)
127+
128+
REM Convert the relative targets path to an absolute one
129+
set CURRDIR=%CD%
130+
pushd %MSBUILDDIR%
131+
pushd %VCTargetsPath%
132+
set VCTargetsPath=%CD%
133+
popd
134+
popd
135+
if not "%CURRDIR%"=="%CD%" (
136+
echo Error: Failed to resolve VCTargetsPath!
137+
goto Terminate
138+
)
139+
140+
REM copy the BuildCustomizations to VCTargets folder
141+
echo Installing build customisations...
142+
del /F /Q "%VCTargetsPath%\BuildCustomizations\yasm.*" >nul 2>&1
143+
copy /B /Y /V "%SCRIPTDIR%\yasm.*" "%VCTargetsPath%\BuildCustomizations\" >nul 2>&1
144+
if not exist "%VCTargetsPath%\BuildCustomizations\yasm.props" (
145+
echo Error: Failed to copy build customisations!
146+
echo Ensure that this script is run in a shell with the necessary write privileges
147+
goto Terminate
148+
)
149+
150+
REM Check if a yasm binary was bundled
151+
if not exist "%SCRIPTDIR%\yasm\" (
152+
REM Download the latest yasm binary for windows goto Terminate
153+
call :DownloadYasm
154+
) else (
155+
REM Use the bundled binaries
156+
copy /B /Y /V "%SCRIPTDIR%\yasm\yasm-%SYSARCH%.exe" "%SCRIPTDIR%\yasm.exe" >nul 2>&1
157+
)
158+
159+
REM copy yasm executable to VC installation folder
160+
echo Installing required YASM release binary...
161+
del /F /Q "%VCINSTALLDIR%\yasm.exe" >nul 2>&1
162+
move /Y "%SCRIPTDIR%\yasm.exe" "%VCINSTALLDIR%\" >nul 2>&1
163+
set INSTALLED=1
164+
if exist "%SCRIPTDIR%\yasm.exe" set INSTALLED=0
165+
if not exist "%VCINSTALLDIR%\yasm.exe" set INSTALLED=0
166+
if %INSTALLED% equ 0 (
167+
echo Error: Failed to install YASM binary!
168+
echo Ensure that this script is run in a shell with the necessary write privileges
169+
del /F /Q "%SCRIPTDIR%\yasm.exe" >nul 2>&1
170+
goto Terminate
171+
)
172+
echo Finished Successfully
173+
goto Exit
174+
175+
:Terminate
176+
SET ERROR=1
177+
178+
:Exit
179+
cd %CALLDIR%
180+
IF "%APPVEYOR%"=="" (
181+
pause
182+
)
183+
exit /b %ERROR%
184+
185+
:DownloadYasm
186+
echo Downloading required YASM release binary...
187+
set YASMDOWNLOAD=%YASMDL%/yasm-%YASMVERSION%-win%SYSARCH%.exe
188+
powershell.exe -Command (New-Object Net.WebClient).DownloadFile('%YASMDOWNLOAD%', '%SCRIPTDIR%\yasm.exe') >nul 2>&1
189+
if not exist "%SCRIPTDIR%\yasm.exe" (
190+
echo Error: Failed to download required YASM binary!
191+
echo The following link could not be resolved "%YASMDOWNLOAD%"
192+
goto Terminate
193+
)
194194
goto :eof

0 commit comments

Comments
 (0)