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 0000000..7ac6524 Binary files /dev/null and b/installer/wix/icon.ico differ 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