diff --git a/appveyor.yml b/appveyor.yml index ddfd2720..8d0a6c64 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,6 +25,12 @@ install: - ps: del "$env:OPENSSL_INSTALLER" - set OPENSSL_BIN_PATH=C:\OpenSSL-Win32\bin + # Install Resource Hacker + - ps: $env:RH_INSTALLER = "reshacker_setup.exe" + - ps: Start-FileDownload "http://www.angusj.com/resourcehacker/$env:RH_INSTALLER" + - ps: Start-Process "$env:RH_INSTALLER" -ArgumentList "/silent /verysilent /sp- /suppressmsgboxes /dir=C:\RH" -Wait + - ps: del "$env:RH_INSTALLER" + # Temp debugging - ps: $env:DLL_DIR = "windows" - echo DLL_DIR %DLL_DIR% @@ -47,7 +53,6 @@ install: - set VSCDIR=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC - set NSISDIR=C:\Program Files (x86)\NSIS - set PATH=%PATH%;%QTDIR%\bin;%VSCDIR%\bin;%NSISDIR% - - ps: $env:NODE_BIN_PATH=(Get-Command node.exe | Split-Path) # Install NsProcess NSIS Plugin - move windows\NsProcess\Include\nsProcess.nsh "%NSISDIR%\Include" @@ -67,8 +72,6 @@ build: off test_script: - ps: $env:UPLOAD_PATH = If ($env:TAG) { $env:TAG } else { If ($env:APPVEYOR_REPO_TAG_NAME) { $env:APPVEYOR_REPO_TAG_NAME } else { $env:APPVEYOR_REPO_BRANCH } } - ps: $env:TAG = If (!$env:TAG) { "master" } else { $env:TAG } - # Install packages - - yarn install - ps: $env:package_version = git grep -hoP '^\s*VERSION\s*=\s*\K.*$' HEAD -- stremio.pro # Pull pre-built resources from S3; those were generated by the travis build for "stremio" @@ -83,7 +86,6 @@ test_script: - if exist shell/deps/qBreakpad ( cd shell/deps/qBreakpad/handler && qmake && nmake && cd ../../../.. ) - qmake . - nmake - #- node .\node_modules\gulp\bin\gulp gulp-deploy - mkdir dist-win # copy-windows-mpv @@ -94,8 +96,8 @@ test_script: - copy "%OPENSSL_BIN_PATH%\libeay32.dll" dist-win # copy-windows-ffmpeg - copy "%FFMPEG_BIN_PATH%\ffmpeg.exe" dist-win - # copy-windows-node - - copy "%NODE_BIN_PATH%\node.exe" dist-win + # copy-windows-node (stremio-runtime) + - %DLL_DIR%\generate_stremio-runtime.cmd dist-win # copy-windows-server - appveyor DownloadFile https://s3-eu-west-1.amazonaws.com/stremio-artifacts/four/v%package_version%/server.js -FileName dist-win\server.js # copy-windows-msvc diff --git a/images/stremio_gray.ico b/images/stremio_gray.ico new file mode 100644 index 00000000..517ad756 Binary files /dev/null and b/images/stremio_gray.ico differ diff --git a/main.qml b/main.qml index f2d5c213..601564a7 100644 --- a/main.qml +++ b/main.qml @@ -258,7 +258,7 @@ ApplicationWindow { } function launchServer() { var node_executable = applicationDirPath + "/node" - if (Qt.platform.os === "windows") node_executable = applicationDirPath + "/node.exe" + if (Qt.platform.os === "windows") node_executable = applicationDirPath + "/stremio-runtime.exe" streamingServer.start(node_executable, [applicationDirPath +"/server.js"].concat(Qt.application.arguments.slice(1)), "EngineFS server started at " diff --git a/windows/generate_stremio-runtime.cmd b/windows/generate_stremio-runtime.cmd new file mode 100644 index 00000000..5b7aeb81 --- /dev/null +++ b/windows/generate_stremio-runtime.cmd @@ -0,0 +1,72 @@ +@echo off + +:: Prepare paths and environment +set "rt_path=%~dpf1" +set rt_exe="%rt_path%\stremio-runtime.exe" + +set rh="C:\RH\ResourceHacker.exe" + +FOR /f "tokens=* USEBACKQ" %%p IN (`where node.exe`) DO ( + set node="%%p" +) + +pushd %~dp0 +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%" + +:: 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 modify -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