f256/distro/f256-install.bat
2024-06-03 20:28:33 -05:00

158 lines
4.7 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
echo.
for /f "useback delims=" %%_ in (%0) do (
if "%%_"=="___OGOL___" set $=
if defined $ echo(%%_
if "%%_"=="___LOGO___" set $=1
)
echo.
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/f256dev.7z
set LOCAL2=f256dev.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 "%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 pip. 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
if exist f256dev\ rd /s /q f256dev
md f256dev
pushd f256dev
%UNPACK% x -y ..\%LOCAL1%
%UNPACK% x -y ..\%LOCAL4%
popd
%UNPACK% x -y %LOCAL2%
del %LOCAL1%
del %LOCAL2%
del %LOCAL3%
del %LOCAL4%
pushd f256dev
del overlay.linux
del overlay.macos
ren overlay.windows overlay.exe
if exist *.sh del *.sh > NUL
ren FoenixMgr-master FoenixMgr
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
popd
if not exist f256build.bat echo @"%~dp0f256dev\f256build.bat" "%%~dp0" %%* > f256build.bat
if not exist f256run.bat echo @"%~dp0f256dev\f256run.bat" "%%~dp0" %%* > f256run.bat
if not exist foenixmgr.ini (
echo [DEFAULT] > foenixmgr.ini
echo port=COM3 >> foenixmgr.ini
echo labels=sample.lbl >> foenixmgr.ini
echo flash_address=380000 >> foenixmgr.ini
echo chunk_size=1024 >> foenixmgr.ini
echo cpu=65c02 >> foenixmgr.ini
)
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.
pause
goto :eof
___LOGO___
_____ ____ ____ __ ____
| ___|___ \| ___| / /_ | _ \ _____ __
| |_ __) |___ \| '_ \ | | | |/ _ \ \ / /
| _| / __/ ___) | (_) | | |_| | __/\ V /
|_| |_____|____/ \___/ |____/ \___| \_/
___OGOL___