f256/distro/f256-install-windows.bat
2024-04-28 19:55:01 -05:00

107 lines
3.5 KiB
Batchfile

@echo off
goto top
#
# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
:top
set REMOTE1=https://github.com/llvm-mos/llvm-mos-sdk/releases/latest/download/llvm-mos-windows.7z
set LOCAL1=llvm-mos-windows.7z
set REMOTE2=https://kangaroopunch.com/files/serve/shared/llvm-mos-f256.7z
set LOCAL2=llvm-mos-f256.7z
set REMOTE3=https://aka.ms/vs/16/release/vc_redist.x64.exe
set LOCAL3=vc_redist.x64.exe
if exist llvm-mos\ (
echo You already have an llvm-mos directory. Exiting.
exit /B
)
where /q curl.exe
if errorlevel 1 (
where /q bitsadmin.exe
if errorlevel 1 (
echo Unable to locate curl or bitsadmin. Exiting.
exit /B
) else (
bitsadmin.exe /transfer GoGoWindows /download /priority normal %REMOTE1% "%~dp0%LOCAL1%"
bitsadmin.exe /transfer GoGoWindows /download /priority normal %REMOTE2% "%~dp0%LOCAL2%"
bitsadmin.exe /transfer GoGoWindows /download /priority normal %REMOTE3% "%~dp0%LOCAL3%"
)
) else (
curl.exe -L %REMOTE1% > %LOCAL1%
curl.exe -L %REMOTE2% > %LOCAL2%
curl.exe -L %REMOTE3% > %LOCAL3%
)
%LOCAL3% /install /passive
if exist "%ProgramFiles%\7-Zip\7z.exe" (
"%ProgramFiles%\7-Zip\7z.exe" x %LOCAL1%
"%ProgramFiles%\7-Zip\7z.exe" x %LOCAL2%
) else (
if exist "%ProgramFiles%\WinRAR\WinRAR.exe" (
"%ProgramFiles%\WinRAR\WinRAR.exe" x %LOCAL1%
"%ProgramFiles%\WinRAR\WinRAR.exe" x %LOCAL2%
) else (
echo Unable to find 7-Zip or WinRAR. Exiting.
del %LOCAL1%
del %LOCAL2%
del %LOCAL3%
exit /B
)
)
del %LOCAL1%
del %LOCAL2%
del %LOCAL3%
del overlay.linux
del overlay.macos
ren overlay.windows overlay.exe
echo @"%%~dp0mos-clang++.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256-clang++.bat
echo @"%%~dp0mos-clang-cpp.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256-clang-cpp.bat
echo @"%%~dp0mos-clang.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256-clang.bat
call mos-f256-clang.bat --version > NUL 2> NUL
if %ERRORLEVEL% equ 0 goto dontaddpath
setx PATH "%PATH%;%~dp0llvm-mos\bin"
set PATH=%PATH%;%~dp0llvm-mos\bin
:dontaddpath
echo.
echo -----------------------------------------------------------------------------
echo Installation complete!
echo.
echo NOTE: The following has been added to your PATH:
echo %~dp0llvm-mos\bin
echo -----------------------------------------------------------------------------
echo.
pause