Build unified Windows installer bundles

This commit is contained in:
Cameron Gutman 2020-11-29 21:13:27 -06:00
parent f81509a892
commit 0fc30a70ca
6 changed files with 117 additions and 57 deletions

View File

@ -64,7 +64,7 @@ You can follow development on our [Discord server](https://moonlight-stream.org/
2. Run `git submodule update --init --recursive` from within `moonlight-qt/`
3. Open the project in Qt Creator or build from qmake on the command line.
* To build a binary for use on non-development machines, use the scripts in the `scripts` folder.
* For Windows builds, use `scripts\generate-installers.bat`. Execute this script from the root of the repository within a Qt command prompt. Ensure WiX and 7-Zip binary directories are in your `%PATH%`.
* For Windows builds, use `scripts\build-arch.bat` and `scripts\generate-bundle.bat`. Execute these scripts from the root of the repository within a Qt command prompt. Ensure WiX and 7-Zip binary directories are in your `%PATH%`.
* For macOS builds, use `scripts/generate-dmg.sh`. Execute this script from the root of the repository and ensure Qt's `bin` folder is in your `$PATH`.
* For Steam Link builds, run `scripts/build-steamlink-app.sh` from the root of the repository.
* To build from the command line for development use, run `qmake moonlight-qt.pro` then `make debug` or `make release`

View File

@ -5,13 +5,9 @@ clone_depth: 1
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
QTDIR: C:\Qt\5.15\msvc2019_64
ARCH: x64
QTDIR: C:\Qt\5.15
- APPVEYOR_BUILD_WORKER_IMAGE: macOS
BUILD_TARGET: macos
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
QTDIR: C:\Qt\5.15\msvc2019
ARCH: x86
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1604
BUILD_TARGET: steamlink
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1604
@ -37,13 +33,16 @@ install:
before_build:
- 'git submodule update --init --recursive'
- cmd: 'set PATH=%PATH%;%QTDIR%\bin;%ProgramFiles(x86)%\WiX Toolset v3.11\bin'
- cmd: 'set OLDPATH=%PATH%'
- cmd: 'set /p VERSION=<app\version.txt'
- sh: 'export VERSION=`cat app/version.txt`'
build_script:
- cmd: 'scripts\generate-installers.bat Debug %ARCH%'
- cmd: 'scripts\generate-installers.bat Release %ARCH%'
- cmd: 'set PATH=%OLDPATH%;%QTDIR%\msvc2019_64\bin;%ProgramFiles(x86)%\WiX Toolset v3.11\bin'
- cmd: 'scripts\build-arch.bat Release x64'
- cmd: 'set PATH=%OLDPATH%;%QTDIR%\msvc2019\bin;%ProgramFiles(x86)%\WiX Toolset v3.11\bin'
- cmd: 'scripts\build-arch.bat Release x86'
- cmd: 'scripts\generate-bundle.bat Release'
- sh: '[ "$BUILD_TARGET" != linux ] || source /opt/qt514/bin/qt514-env.sh'
- sh: '[ "$BUILD_TARGET" != linux ] || PATH=$PATH:$HOME/bin scripts/build-appimage.sh'
- sh: '[ "$BUILD_TARGET" != macos ] || scripts/generate-dmg.sh Release'

View File

@ -177,26 +177,6 @@ if "%SIGN%"=="1" (
if !ERRORLEVEL! NEQ 0 goto Error
)
echo Building bundle
rem Bundles are always x86 binaries
msbuild %SOURCE_ROOT%\wix\MoonlightSetup\MoonlightSetup.wixproj /p:Configuration=%BUILD_CONFIG% /p:Platform=x86
if !ERRORLEVEL! NEQ 0 goto Error
if "%SIGN%"=="1" (
echo Signing bundle
"%WIX%\bin\insignia" -ib %INSTALLER_FOLDER%\MoonlightSetup.exe -o %BUILD_FOLDER%\engine.exe
if !ERRORLEVEL! NEQ 0 goto Error
signtool %SIGNTOOL_PARAMS% %BUILD_FOLDER%\engine.exe
if !ERRORLEVEL! NEQ 0 goto Error
"%WIX%\bin\insignia" -ab %BUILD_FOLDER%\engine.exe %INSTALLER_FOLDER%\MoonlightSetup.exe -o %INSTALLER_FOLDER%\MoonlightSetup.exe
if !ERRORLEVEL! NEQ 0 goto Error
signtool %SIGNTOOL_PARAMS% %INSTALLER_FOLDER%\MoonlightSetup.exe
if !ERRORLEVEL! NEQ 0 goto Error
)
rem Rename the installer to match the publishing convention
ren %INSTALLER_FOLDER%\MoonlightSetup.exe MoonlightSetup-%ARCH%-%VERSION%.exe
echo Building portable package
rem This must be done after WiX harvesting and signing, since the VCRT dlls are MS signed
rem and should not be harvested for inclusion in the full installer
@ -208,7 +188,7 @@ if !ERRORLEVEL! NEQ 0 goto Error
7z a %INSTALLER_FOLDER%\MoonlightPortable-%ARCH%-%VERSION%.zip %DEPLOY_FOLDER%\*
if !ERRORLEVEL! NEQ 0 goto Error
echo Build successful for Moonlight v%VERSION%!
echo Build successful for Moonlight v%VERSION% %ARCH% binaries!
exit /b 0
:Error

View File

@ -0,0 +1,93 @@
@echo off
setlocal enableDelayedExpansion
rem Run from Qt command prompt with working directory set to root of repo
set BUILD_CONFIG=%1
rem Convert to lower case for windeployqt
if /I "%BUILD_CONFIG%"=="debug" (
set BUILD_CONFIG=debug
set WIX_MUMS=10
) else (
if /I "%BUILD_CONFIG%"=="release" (
set BUILD_CONFIG=release
set WIX_MUMS=10
) else (
if /I "%BUILD_CONFIG%"=="signed-release" (
set BUILD_CONFIG=release
set SIGN=1
set MUST_DEPLOY_SYMBOLS=1
rem Fail if there are unstaged changes
git diff-index --quiet HEAD --
if !ERRORLEVEL! NEQ 0 (
echo Signed release builds must not have unstaged changes!
exit /b 1
)
) else (
echo Invalid build configuration - expected 'debug' or 'release'
exit /b 1
)
)
)
set SIGNTOOL_PARAMS=sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /sha1 1B3C676E831A94EC0327C3347EB32C68C26B3A67 /v
set BUILD_ROOT=%cd%\build
set SOURCE_ROOT=%cd%
set BUILD_FOLDER=%BUILD_ROOT%\build-%BUILD_CONFIG%
set INSTALLER_FOLDER=%BUILD_ROOT%\installer-%BUILD_CONFIG%
set /p VERSION=<%SOURCE_ROOT%\app\version.txt
rem Ensure that all architectures have been built before the final bundle
if not exist "%BUILD_ROOT%\build-x86-%BUILD_CONFIG%\Moonlight.msi" (
echo Unable to build bundle - missing binaries for %BUILD_CONFIG% x86
echo You must run 'build-arch.bat %BUILD_CONFIG% x86' first
exit /b 1
)
if not exist "%BUILD_ROOT%\build-x64-%BUILD_CONFIG%\Moonlight.msi" (
echo Unable to build bundle - missing binaries for %BUILD_CONFIG% x64
echo You must run 'build-arch.bat %BUILD_CONFIG% x64' first
exit /b 1
)
echo Cleaning output directories
rmdir /s /q %BUILD_FOLDER%
rmdir /s /q %INSTALLER_FOLDER%
mkdir %BUILD_FOLDER%
mkdir %INSTALLER_FOLDER%
rem Find Visual Studio and run vcvarsall.bat
set VSWHERE="%SOURCE_ROOT%\scripts\vswhere.exe"
for /f "usebackq delims=" %%i in (`%VSWHERE% -latest -property installationPath`) do (
call "%%i\VC\Auxiliary\Build\vcvarsall.bat" x86
)
if !ERRORLEVEL! NEQ 0 goto Error
echo Building bundle
rem Bundles are always x86 binaries
msbuild %SOURCE_ROOT%\wix\MoonlightSetup\MoonlightSetup.wixproj /p:Configuration=%BUILD_CONFIG% /p:Platform=x86
if !ERRORLEVEL! NEQ 0 goto Error
if "%SIGN%"=="1" (
echo Signing bundle
"%WIX%\bin\insignia" -ib %INSTALLER_FOLDER%\MoonlightSetup.exe -o %BUILD_FOLDER%\engine.exe
if !ERRORLEVEL! NEQ 0 goto Error
signtool %SIGNTOOL_PARAMS% %BUILD_FOLDER%\engine.exe
if !ERRORLEVEL! NEQ 0 goto Error
"%WIX%\bin\insignia" -ab %BUILD_FOLDER%\engine.exe %INSTALLER_FOLDER%\MoonlightSetup.exe -o %INSTALLER_FOLDER%\MoonlightSetup.exe
if !ERRORLEVEL! NEQ 0 goto Error
signtool %SIGNTOOL_PARAMS% %INSTALLER_FOLDER%\MoonlightSetup.exe
if !ERRORLEVEL! NEQ 0 goto Error
)
rem Rename the installer to match the publishing convention
ren %INSTALLER_FOLDER%\MoonlightSetup.exe MoonlightSetup-%VERSION%.exe
echo Build successful for Moonlight v%VERSION% installer!
exit /b 0
:Error
echo Build failed!
exit /b !ERRORLEVEL!

View File

@ -13,7 +13,7 @@
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="Moonlight Game Streaming Client"
Version="!(bind.PackageVersion.Moonlight)"
Version="!(bind.PackageVersion.Moonlight_x64)"
Manufacturer="Moonlight Game Streaming Project"
UpgradeCode="466fa35d-4be4-40ef-9ce5-afadc3b63bc5"
HelpUrl="https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide"
@ -25,24 +25,10 @@
<![CDATA[VersionNT >= v6.1]]>
</bal:Condition>
<?if $(env.ARCH) ~= x64 ?>
<bal:Condition Message="This Moonlight installer requires a 64-bit (x64) OS. Please download the 32-bit (x86) installer.">
VersionNT64
</bal:Condition>
<?elseif $(env.ARCH) ~= x86 ?>
<bal:Condition Message="This Moonlight installer requires a 32-bit (x86) OS. Please download the 64-bit (x64) installer.">
NOT VersionNT64
</bal:Condition>
<?endif ?>
<!-- HACK: Force replacement of lower versioned files too. This is only safe because we don't install any shared files -->
<Variable Name="REINSTALLMODE" bal:Overridable="yes" Value="dmus" />
<?if $(env.ARCH) ~= x64 ?>
<Variable Name="InstallFolder" Type="string" Value="[ProgramFiles64Folder]Moonlight Game Streaming" />
<?elseif $(env.ARCH) ~= x86 ?>
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]Moonlight Game Streaming" />
<?endif ?>
<Variable Name="InstallFolder" Type="string" Value="[ProgramFiles6432Folder]Moonlight Game Streaming" />
<!-- Define "Add desktop shortcut" -checkbox's state by defining a variable
which has same name as the checkbox has. Value 1 means that checkbox
@ -123,7 +109,19 @@
<ExitCode Value="1638" Behavior="success" />
</ExePackage>
<MsiPackage Id="Moonlight" SourceFile="$(var.Moonlight.TargetPath)" Vital="yes">
<MsiPackage Id="Moonlight_x86"
SourceFile="$(env.BUILD_ROOT)\build-x86-$(env.BUILD_CONFIG)\Moonlight.msi"
InstallCondition="NOT VersionNT64"
Vital="yes">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
<MsiProperty Name="REINSTALLMODE" Value="[REINSTALLMODE]" />
<MsiProperty Name="ADDDESKTOPSHORTCUT" Value="[AddDesktopShortcutCheckbox]" />
</MsiPackage>
<MsiPackage Id="Moonlight_x64"
SourceFile="$(env.BUILD_ROOT)\build-x64-$(env.BUILD_CONFIG)\Moonlight.msi"
InstallCondition="VersionNT64"
Vital="yes">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
<MsiProperty Name="REINSTALLMODE" Value="[REINSTALLMODE]" />
<MsiProperty Name="ADDDESKTOPSHORTCUT" Value="[AddDesktopShortcutCheckbox]" />

View File

@ -28,16 +28,6 @@
<Name>WixUtilExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Moonlight\Moonlight.wixproj">
<Name>Moonlight</Name>
<Project>{8468ef94-3bb8-47a5-af15-0e314afe664d}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">