From 081bc4d3a0b90ca8de9d031a25d3e13f70947ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Mon, 14 Nov 2022 19:55:00 +0100 Subject: [PATCH] wix: enable a first installer upgradable --- .gitlab-ci.yml | 24 ++++++----- ci/build_gps.ps1 | 6 +++ ci/run_windows.ps1 | 2 - installer/wix/build_installer.ps1 | 62 ++++++++++++++++++++++++++++ installer/wix/gps.bat | 8 ++++ installer/wix/gps.wxs | 62 ++++++++++++++++++++++++++++ installer/wix/icon.ico | Bin 0 -> 4286 bytes installer/wix/prepare_gstreamer.ps1 | 11 +++++ installer/wix/prepare_wix.ps1 | 40 ++++++++++++++++++ 9 files changed, 203 insertions(+), 12 deletions(-) create mode 100644 ci/build_gps.ps1 delete mode 100644 ci/run_windows.ps1 create mode 100644 installer/wix/build_installer.ps1 create mode 100644 installer/wix/gps.bat create mode 100644 installer/wix/gps.wxs create mode 100644 installer/wix/icon.ico create mode 100644 installer/wix/prepare_gstreamer.ps1 create mode 100644 installer/wix/prepare_wix.ps1 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a0aabe..9472d9f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -98,22 +98,26 @@ windows rust docker stable: - 'docker' - 'windows' - '2022' - script: - - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=amd64 && - powershell ./ci/run_windows.ps1" - - | - if (!$?) { - Write-Host "Tests Failed!" - Exit 1 - } - -test windows stable: +windows installer stable: needs: - job: 'windows rust docker stable' artifacts: false image: "$WINDOWS_RUST_STABLE_IMAGE" 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: extends: diff --git a/ci/build_gps.ps1 b/ci/build_gps.ps1 new file mode 100644 index 0000000..2d66f1e --- /dev/null +++ b/ci/build_gps.ps1 @@ -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 +} \ No newline at end of file diff --git a/ci/run_windows.ps1 b/ci/run_windows.ps1 deleted file mode 100644 index 04afde9..0000000 --- a/ci/run_windows.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -meson buildddir -ninja -C builddir \ No newline at end of file diff --git a/installer/wix/build_installer.ps1 b/installer/wix/build_installer.ps1 new file mode 100644 index 0000000..28e4c3a --- /dev/null +++ b/installer/wix/build_installer.ps1 @@ -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 +} \ No newline at end of file diff --git a/installer/wix/gps.bat b/installer/wix/gps.bat new file mode 100644 index 0000000..3e501bd --- /dev/null +++ b/installer/wix/gps.bat @@ -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 \ No newline at end of file diff --git a/installer/wix/gps.wxs b/installer/wix/gps.wxs new file mode 100644 index 0000000..ed4b17e --- /dev/null +++ b/installer/wix/gps.wxs @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/installer/wix/icon.ico b/installer/wix/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..7ac652434d8d07c2be510d55814b4757e1d44283 GIT binary patch literal 4286 zcmc(jc~sU_8pnUlnKR8yi#cG-si*UWsVaS>4sU6`IEXAb0NEVdKV)oIZWJV|0Ce zJyuqOdFpXJJ^y0OGtXKHl}{TUf1)qJ!NIh)ws!RI>ZPr%joR8;N=r*gO-*IVk|iu! zv`FcK1q;yY_4xYwa{2OQHC0`G9m9sWGSYk-ey^QpROHWiPWu7xH)^nQO(A&vgl^-@ zea)XgA2&BQ{QUfwIddin2?-=7CMsRHa3Q9qri>XgrUU=ht($~Q2%}d|TU;E9@eMx5 z^Ml6m><4EN5)7}!wW6~Lp|BvYGg#HOd-rY}930rQXOAj> zQCx(hy$1vOj>X0BA>JVy8Sa~d?dZ<+m4G5fN7geo4*X`_KxZ+UugiCJivPke(W5+mq?k6lwNAl6a)9m^d0%EVBvkqbE)X9{UZd2zd&+<`PUcQs$q$PayRVg=b z-t2VW?Tsf-p2XAB6Ukq4yuObgWx4-mrEu910VTM5_;6MDM|Wh?rcIcbm@s?xY~-09 zJa`c4Tb)T|Wu@Bxl`B^$Dcy=`pK+9bd52}|VTfloVPO%97w(-y#{Z?dOVnPh<%*cU zUT|PbOA9Mjte{7a9?F-(!^73SyuH0yzI-_sFJ8QNijMc1ni@PjJUD;;Jl`IwK;PF$ ze&$uOOTb0&hxJfr4j(?$(OXN_ z2Ub>X+J9ctI_<`imb?eqCe#y_z|IHfW z#VnxFWH`t#F7Y>sYV#gcPrm8)!TD3~~Q+wWQ zH^iw^r_>rEBO^I`_N=OwIq;ir_EA)nPhMV*QiH)D@S=F(Z^6tQ_82p)H4$rGY{|c3*}q>n>pgP0p#d*9XY#x?nm10N>G(GMN9fqG zbCh{TaT8W$Ib(P%{OS90|B?IH>OD$;iC_WSkv(caYYoGS9lznnB~ zr~Ay57aZb+ap0eb8~Gdw{^nh3QlL3y zZ`;$9;VZZxhnAXhVn$i=&Kz+u5%T`~?<<~s7~Z{ga;@GYUuCi2n1%&9$nuAEL0xOn zTO$4iR>dc@9$ZVtTON#bvg0QaQ!=jI-QC%>tMfaVTt|Aw8iEJ?j>egPrY*xu;0k{G zT;O-6>jeKD%H+jv%aCNZd8{yB=UnSSe`;O$8uH+wYzDbI+@ZSZ!X!|UX zjWg_c%Uw^jN9P*pX-2TU4wqqOL`6kWEpn{HPESu)-xSr=)m=f0{tzBIkxYZ|--N#0 z{xpCwFZUxl=55kfXOOn)lSis-FDNYHw1^vt+t}EkzMEu@k-pa*xp1KtpHZWj|FXu> z$llz{@Mnyz37J{h>aNk*9P&!jSyh9g*L3zD5shd;cES0Z$TT z&~YW*k67bCYzFjU&6+ijoJL|V6}ex=x8$u!lP0NeC3&~*uKe(0HIC-JDGSgzF>f%{ z%Z&V-GMck1ggr(NRNrQgnoHVSa+TyZ`TZ*IW&f>6|IoeA8+}g=%id35_53qf_U(bS Vc>ewAKXfa0yNlWWe}Mnj^FLS;MIrzI literal 0 HcmV?d00001 diff --git a/installer/wix/prepare_gstreamer.ps1 b/installer/wix/prepare_gstreamer.ps1 new file mode 100644 index 0000000..54dd11c --- /dev/null +++ b/installer/wix/prepare_gstreamer.ps1 @@ -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 + diff --git a/installer/wix/prepare_wix.ps1 b/installer/wix/prepare_wix.ps1 new file mode 100644 index 0000000..4ddcb48 --- /dev/null +++ b/installer/wix/prepare_wix.ps1 @@ -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 +} \ No newline at end of file