wix: enable a first installer upgradable

This commit is contained in:
Stéphane Cerveau 2022-11-14 19:55:00 +01:00
parent 9c83ff6123
commit 081bc4d3a0
9 changed files with 203 additions and 12 deletions

View file

@ -98,22 +98,26 @@ windows rust docker stable:
- 'docker' - 'docker'
- 'windows' - 'windows'
- '2022' - '2022'
script:
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
powershell ./ci/run_windows.ps1"
- | windows installer stable:
if (!$?) {
Write-Host "Tests Failed!"
Exit 1
}
test windows stable:
needs: needs:
- job: 'windows rust docker stable' - job: 'windows rust docker stable'
artifacts: false artifacts: false
image: "$WINDOWS_RUST_STABLE_IMAGE" image: "$WINDOWS_RUST_STABLE_IMAGE"
extends: '.msvc2019 build' extends: '.msvc2019 build'
script:
- "& ./ci/build_gps.ps1"
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
powershell ./installer/wix/prepare_wix.ps1"
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
powershell ./installer/wix/prepare_gstreamer.ps1"
- cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 &&
powershell ./installer/wix/build_installer.ps1"
artifacts:
paths:
- installer/wix/*.msi
expire_in: 1 days
rustfmt-clippy: rustfmt-clippy:
extends: extends:

6
ci/build_gps.ps1 Normal file
View file

@ -0,0 +1,6 @@
$env:MESON_ARGS = "--prefix=C:\gst-install\"
cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && meson _build $env:MESON_ARGS && meson compile -C _build && ninja -C _build install"
if (!$?) {
Write-Host "Failed to build and install GstPipelineStudio"
Exit 1
}

View file

@ -1,2 +0,0 @@
meson buildddir
ninja -C builddir

View file

@ -0,0 +1,62 @@
$wixFolder = Join-Path $PSScriptRoot -ChildPath 'wix/'
$candleToolPath = Join-Path $wixFolder -ChildPath candle.exe
$lightToolPath = Join-Path $wixFolder -ChildPath light.exe
$heatToolPath = Join-Path $wixFolder -ChildPath heat.exe
try
{
Push-Location $PSScriptRoot
if(-not (Test-Path $wixFolder))
{
throw "Folder $wixFolder does not exist. Start DownloadAndExtractWix.ps1 script to create it."
}
if((-not (Test-Path $candleToolPath)) -or (-not (Test-Path $lightToolPath)))
{
throw "Tools required to build installer (candle.exe and light.exe) do not exist in wix folder."
}
# GST and GTK are installed in this folder by prepare_gstreamer.ps1.
# GST and GTK are built by the docker image.
$gstreamerInstallDir="c:\gst-install-clean"
$gstreamerBinInstallDir= Join-Path $gstreamerInstallDir -ChildPath "bin/"
$gstreamerPluginInstallDir= Join-Path $gstreamerInstallDir -ChildPath "lib\gstreamer-1.0"
& "$heatToolPath" dir "$gstreamerBinInstallDir" -gg -sfrag -template:fragment -out gstreamer-1.0.wxs -cg "_gstreamer" -var var.gstreamerBinInstallDir -dr INSTALLFOLDER
& "$heatToolPath" dir "$gstreamerPluginInstallDir" -gg -sfrag -template:fragment -out gstreamer-plugins-1.0.wxs -cg "_gstreamer_plugins" -var var.gstreamerPluginInstallDir -dr INSTALLFOLDER
$files = "gps gstreamer-1.0 gstreamer-plugins-1.0"
$wxs_files = @()
$obj_files = @()
foreach ($f in $files.split(" ")){
$wxs_files += "$f.wxs"
$obj_files += "$f.wixobj"
}
Write-Output $wxs_files
Write-Output $obj_files
# compiling wxs file into wixobj
$msiFileName = "GstPipelineStudio.msi"
foreach ($f in $wxs_files){
& "$candleToolPath" "$f" -dPlatform=x64 -dgstreamerBinInstallDir="$gstreamerBinInstallDir" -dgstreamerPluginInstallDir="$gstreamerPluginInstallDir"
if($LASTEXITCODE -ne 0)
{
throw "Compilation of $wxsFileName failed with exit code $LASTEXITCODE"
}
}
$AllArgs = $obj_files + @('-out', $msiFileName)
& $lightToolPath $AllArgs
if($LASTEXITCODE -ne 0)
{
throw "Linking of $wixobjFileName failed with exit code $LASTEXITCODE"
}
}
catch
{
Write-Error $_
exit 1
}
finally
{
Pop-Location
}

8
installer/wix/gps.bat Normal file
View file

@ -0,0 +1,8 @@
@echo off
set MYDIR=%~dp0
setlocal
set PATH=%MYDIR%bin;%PATH%
echo %PATH%
set GST_PLUGIN_PATH=%MYDIR%/gstreamer-1.0
echo %GST_PLUGIN_PATH%
gst_pipeline_studio.exe

62
installer/wix/gps.wxs Normal file
View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Language="1033"
Manufacturer="dabrain34"
Name="GstPipelineStudio"
UpgradeCode="B28B3FA8-9310-4AA7-B0CA-CBCCA5FD00B2"
Version="1.0.0.0">
<Package InstallScope="perMachine" Compressed="yes" />
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
<MediaTemplate EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder">
<Directory Id="GPSAppShortcuts" Name="GStreamer Pipeline Studio" />
</Directory>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="GstPipelineStudio">
<Component Id="ProductComponent">
<File KeyPath="yes" Source="gps.bat">
<Shortcut Id="GPSAppShortcut"
Directory="GPSAppShortcuts"
Name="GPSApp"
WorkingDirectory="INSTALLFOLDER"
Advertise="yes"
Icon="icon.ico"
IconIndex="0"
>
</Shortcut>
</File>
<RemoveFolder Id="DeleteTheGPSAppShortcut"
Directory="GPSAppShortcuts"
On="uninstall" />
</Component>
</Directory>
</Directory>
</Directory>
<Icon Id="icon.ico" SourceFile="icon.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Component Id="UninstallShortcut" Guid="*" Directory="GPSAppShortcuts">
<Shortcut Id="UninstallGPS"
Name="Uninstall GPS App"
Description="Uninstalls GPS App"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]" />
<RegistryValue Root="HKCU" Key="Software\GPS\GPSApp" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Feature Id="GPSFeature">
<ComponentRef Id="ProductComponent" />
<ComponentGroupRef Id="_gstreamer" />
<ComponentGroupRef Id="_gstreamer_plugins" />
<ComponentRef Id="UninstallShortcut" />
</Feature>
</Product>
</Wix>

BIN
installer/wix/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -0,0 +1,11 @@
# install gtk, gstreamer built within the docker image to a clean folder used by wix to generate the package.
Remove-Item -Recurse -Force c:\gst-install-clean
New-Item c:\gst-install-clean -ItemType Directory
New-Item c:\gst-install-clean\bin -ItemType Directory
Copy-Item -Path C:\gst-install\bin\*.dll -Destination c:\gst-install-clean\bin\
Copy-Item -Path C:\gst-install\bin\*.exe -Destination c:\gst-install-clean\bin\
New-Item c:\gst-install-clean\lib\gstreamer-1.0 -ItemType Directory
Copy-Item -Path C:\gst-install\lib\gstreamer-1.0\*.dll -Destination c:\gst-install-clean\lib\gstreamer-1.0

View file

@ -0,0 +1,40 @@
#FIXME: The latest gstreamer windows image contains wix.
$source = "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip"
$destination = Join-Path $PSScriptRoot -ChildPath 'wix.zip'
$wixFolder = Join-Path $PSScriptRoot -ChildPath 'wix/'
try
{
Push-Location $PSScriptRoot
if(Test-Path $destination)
{
Write-Host "WiX already download at: $destination"
}
else
{
Write-Host "Downloading $source ..."
Invoke-WebRequest -Uri $source -OutFile $destination
Write-Host "Download finished" -ForegroundColor Green
}
if(Test-Path $wixFolder)
{
Write-Host "WiX already extracted at: $wixFolder"
}
else
{
Write-Host "Extracting $destination ..."
Expand-Archive -LiteralPath $destination -DestinationPath $wixFolder
Write-Host "Extraction finished" -ForegroundColor Green
}
}
catch
{
Write-Error $_
exit 1
}
finally
{
Pop-Location
}