f256/distro/f256-install-windows.bat
2024-04-29 20:03:36 -05:00

134 lines
4.2 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
set REMOTE4=https://github.com/pweingar/FoenixMgr/archive/refs/heads/master.zip
set LOCAL4=master.zip
if exist llvm-mos\ (
echo You already have an llvm-mos directory. Exiting.
exit /B
)
if exist "%ProgramFiles%\7-Zip\7z.exe" (
set UNPACK="%ProgramFiles%\7-Zip\7z.exe"
) else (
if exist "%ProgramFiles%\WinRAR\WinRAR.exe" (
set UNPACK="%ProgramFiles%\WinRAR\WinRAR.exe"
) else (
echo Unable to find 7-Zip or WinRAR. Exiting.
exit /B
)
)
where /q python.exe
if errorlevel 1 (
echo Unable to find Python. Exiting.
exit /B
)
where /q pip.exe
if errorlevel 1 (
echo Unable to find Python. 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%"
bitsadmin.exe /transfer GoGoWindows /download /priority normal %REMOTE4% "%~dp0%LOCAL4%"
)
) else (
curl.exe -L %REMOTE1% > %LOCAL1%
curl.exe -L %REMOTE2% > %LOCAL2%
curl.exe -L %REMOTE3% > %LOCAL3%
curl.exe -L %REMOTE4% > %LOCAL4%
)
%LOCAL3% /install /passive
%UNPACK% x -y %LOCAL1%
%UNPACK% x -y %LOCAL2%
%UNPACK% x -y %LOCAL4%
del %LOCAL1%
del %LOCAL2%
del %LOCAL3%
del %LOCAL4%
del overlay.linux
del overlay.macos
ren overlay.windows overlay.exe
if exist *.sh del *.sh > NUL
ren FoenixMgr-master FoenixMgr
copy FoenixMgr\foenixmgr.ini . > NUL
pushd FoenixMgr
pip.exe install -r requirements.txt
popd
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 Please visit https://github.com/pweingar/FoenixMgr to learn how to configure
echo FoenixMgr for your machine. Edit the foenixmgr.ini file in this directory.
echo.
echo NOTE: The following has been added to your PATH:
echo %~dp0llvm-mos\bin
echo -----------------------------------------------------------------------------
echo.
pause