Simplified setup scripts

This commit is contained in:
Vladimir Borisov 2024-03-08 10:02:52 +02:00
parent 22b9074ddd
commit 6d912cfa82
6 changed files with 1 additions and 101 deletions

3
.gitignore vendored
View file

@ -1,3 +1,2 @@
/target
/bin
/stremio*.exe
stremio*.exe

BIN
bin/ffmpeg.exe Normal file

Binary file not shown.

BIN
bin/ffprobe.exe Normal file

Binary file not shown.

View file

@ -1,26 +1,6 @@
@echo off
set mypath=%~dp0
:: Download ffmpeg and node
set missing=
if not exist "%mypath%..\bin" set missing=1
if not exist "%mypath%..\bin\node.exe" set missing=1
if not exist "%mypath%..\bin\ResourceHacker.exe" set missing=1
if not exist "%mypath%..\bin\ffmpeg.exe" set missing=1
if not exist "%mypath%..\bin\ffprobe.exe" set missing=1
if defined missing (
powershell -nologo -executionpolicy bypass -File "%mypath%get_exe_from_zip.ps1"
) else (
echo Binaries for ffmpeg, ffprobe, node and ResHack are already present
)
:: Convert node to stremio-runtime
if not exist "%mypath%..\bin\stremio-runtime.exe" (
call "%mypath%generate_stremio-runtime.bat" %mypath%..\bin
) else (
echo The executable stremio-runtime.exe is already generated
)
:: Compile the main executable
if not exist "%mypath%..\target\release\stremio-shell-ng.exe" (
cargo build --release

View file

@ -1,78 +0,0 @@
@echo off
:: Prepare paths and environment
set "rt_path=%~dpf1"
set rt_exe="%rt_path%\stremio-runtime.exe"
::set rh="C:\RH\ResourceHacker.exe"
pushd %~dp0
pushd ..\bin
set node="%cd%\node.exe"
set rh="%cd%\ResourceHacker.exe"
popd
pushd ..\images
set rt_icon="%cd%\stremio_gray.ico"
popd
popd
:: Check if all paths are correct
if not exist %rh% goto :norh
if not exist %node% goto :nonode
if not exist %rt_icon% goto :noico
if not exist "%rt_path%\" goto :nodir
:: Create temp dir
set "res_dir=%TEMP%\srres"
md "%res_dir%"
:: Copy node.exe to the temp dir and remove signature
copy %node% "%res_dir%\node.exe"
set node="%res_dir%\node.exe"
signtool remove /s %node%
:: Extract Node.js resources
%rh% -open %node% -save "%res_dir%\resources.rc" -action extract -mask ",,"
:: Replace desired resources
copy /D /Y %rt_icon% "%res_dir%\ICON1_1.ico"
set textFile="%res_dir%\resources.rc"
for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do (
set "line=%%i"
setlocal enabledelayedexpansion
set line=!line:Node.js=Stremio Runtime!
>>"%textFile%" echo !line:node.exe=stremio-runtime.exe!
endlocal
)
:: Compile new resource file
pushd "%res_dir%"
%rh% -open .\resources.rc -save .\stremio-rt.res -action compile
popd
:: Build the stremio-runtime executable
%rh% -open %node% -saveas %rt_exe% -action addoverwrite -res "%res_dir%\stremio-rt.res"
:: Cleanup
rd /S /Q "%res_dir%"
exit /b 0
:: Error states
:norh
echo ResourceHacker.exe not found at %rh%
exit /b 1
:nonode
echo Node.exe not found at %node%
exit /b 2
:noico
echo Icon file not found at %rt_icon%
exit /b 3
:nodir
echo Destination directory does not exists at %rt_path%
exit /b 4

View file

@ -4,7 +4,6 @@ $files = @(
"https://github.com/vot/ffbinaries-prebuilt/releases/download/v3.3/ffmpeg-3.3.4-win-32.zip"
"https://github.com/vot/ffbinaries-prebuilt/releases/download/v3.3/ffprobe-3.3.4-win-32.zip"
"https://nodejs.org/dist/v16.17.0/node-v16.17.0-win-x86.zip"
"http://www.angusj.com/resourcehacker/resource_hacker.zip"
)
New-Item -Path ".\bin" -ItemType Directory -Force