-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
972aa19
commit d042ef8
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
REM ORIGINAL AT https://github.com/ShiftMediaProject/VSNASM/blob/master/install_script.bat | ||
|
||
@echo OFF | ||
setlocal | ||
|
||
REM Defined cript variables | ||
set NASMDL=http://www.nasm.us/pub/nasm/releasebuilds | ||
set NASMVERSION=2.16.01 | ||
|
||
REM Store current directory and ensure working directory is the location of current .bat | ||
set CALLDIR=%CD% | ||
set SCRIPTDIR=%~dp0 | ||
set SCRIPTDIR=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC | ||
|
||
REM Download the latest nasm binary for windows | ||
if exist "%SCRIPTDIR%\nasm_%NASMVERSION%.zip" ( | ||
echo Using existing NASM binary... | ||
goto InstallNASM | ||
) | ||
echo Checking for existing NASM in NASMPATH... | ||
%NASMPATH%\nasm.exe -v >nul 2>&1 | ||
if ERRORLEVEL 0 ( | ||
echo Using existing NASM binary from %NASMPATH%... | ||
goto SkipInstallNASM | ||
) | ||
set NASMDOWNLOAD=%NASMDL%/%NASMVERSION%/win%SYSARCH%/nasm-%NASMVERSION%-win%SYSARCH%.zip | ||
echo Downloading required NASM release binary... | ||
powershell.exe -Command "(New-Object Net.WebClient).DownloadFile('%NASMDOWNLOAD%', '%SCRIPTDIR%\nasm_%NASMVERSION%.zip')" >nul 2>&1 | ||
if not exist "%SCRIPTDIR%\nasm_%NASMVERSION%.zip" ( | ||
echo Error: Failed to download required NASM binary! | ||
echo The following link could not be resolved "%NASMDOWNLOAD%" | ||
goto Terminate | ||
) | ||
|
||
:InstallNASM | ||
powershell.exe -Command Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('"%SCRIPTDIR%\nasm_%NASMVERSION%.zip"', '"%SCRIPTDIR%\TempNASMUnpack"') >nul 2>&1 | ||
if not exist "%SCRIPTDIR%\TempNASMUnpack" ( | ||
echo Error: Failed to unpack NASM download! | ||
del /F /Q "%SCRIPTDIR%\nasm_.zip" >nul 2>&1 | ||
goto Terminate | ||
) | ||
|
||
REM copy nasm executable to VC installation folder | ||
echo Installing required NASM release binary... | ||
del /F /Q "%VCINSTALLDIR%\nasm.exe" >nul 2>&1 | ||
copy /B /Y /V "%SCRIPTDIR%\TempNASMUnpack\nasm-%NASMVERSION%\nasm.exe" "%VCINSTALLDIR%" >nul 2>&1 | ||
if %ERRORLEVEL% neq 0 ( | ||
echo Error: Failed to install NASM binary! | ||
echo Ensure that this script is run in a shell with the necessary write privileges | ||
rd /S /Q "%SCRIPTDIR%\TempNASMUnpack" >nul 2>&1 | ||
goto Terminate | ||
) | ||
rd /S /Q "%SCRIPTDIR%\TempNASMUnpack" >nul 2>&1 | ||
:SkipInstallNASM | ||
echo Finished Successfully |