summaryrefslogtreecommitdiffstats
path: root/doc/win-dev.ps1
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:34:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:34:54 +0000
commit0915b3ef56dfac3113cce55a59a5765dc94976be (patch)
treea8fea11d50b4f083e1bf0f90025ece7f0824784a /doc/win-dev.ps1
parentInitial commit. (diff)
downloadicinga2-0915b3ef56dfac3113cce55a59a5765dc94976be.tar.xz
icinga2-0915b3ef56dfac3113cce55a59a5765dc94976be.zip
Adding upstream version 2.13.6.upstream/2.13.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--doc/win-dev.ps197
1 files changed, 97 insertions, 0 deletions
diff --git a/doc/win-dev.ps1 b/doc/win-dev.ps1
new file mode 100644
index 0000000..d2fc8be
--- /dev/null
+++ b/doc/win-dev.ps1
@@ -0,0 +1,97 @@
+Set-PSDebug -Trace 1
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = 'Stop'
+$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
+
+function ThrowOnNativeFailure {
+ if (-not $?) {
+ throw 'Native failure'
+ }
+}
+
+
+$VsVersion = 2019
+$MsvcVersion = '14.2'
+$BoostVersion = @(1, 80, 0)
+$OpensslVersion = '1_1_1s'
+
+switch ($Env:BITS) {
+ 32 { }
+ 64 { }
+ default {
+ $Env:BITS = 64
+ }
+}
+
+
+function Install-Exe {
+ param (
+ [string]$Url,
+ [string]$Dir
+ )
+
+ $TempDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.Guid]::NewGuid().Guid)
+ $ExeFile = Join-Path $TempDir inst.exe
+
+ New-Item -ItemType Directory -Path $TempDir
+
+ for ($trial = 1;; ++$trial) {
+ try {
+ Invoke-WebRequest -Uri $Url -OutFile $ExeFile -UseBasicParsing
+ } catch {
+ if ($trial -ge 2) {
+ throw
+ }
+
+ continue
+ }
+
+ break
+ }
+
+ Start-Process -Wait -FilePath $ExeFile -ArgumentList @('/VERYSILENT', '/INSTALL', '/PASSIVE', '/NORESTART', "/DIR=${Dir}")
+ ThrowOnNativeFailure
+
+ Remove-Item -Recurse -Path $TempDir
+}
+
+
+try {
+ Get-Command choco
+} catch {
+ Invoke-Expression (New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
+ ThrowOnNativeFailure
+
+ $RegEnv = 'Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
+ $ChocoPath = ";$(Join-Path $Env:AllUsersProfile chocolatey\bin)"
+
+ Set-ItemProperty -Path $RegEnv -Name Path -Value ((Get-ItemProperty -Path $RegEnv -Name Path).Path + $ChocoPath)
+ $Env:Path += $ChocoPath
+}
+
+# GitHub Actions uses an image that comes with most dependencies preinstalled. Don't install them twice.
+if (-not $Env:GITHUB_ACTIONS) {
+ choco install -y `
+ "visualstudio${VsVersion}community" `
+ "visualstudio${VsVersion}-workload-netcoretools" `
+ "visualstudio${VsVersion}-workload-vctools" `
+ "visualstudio${VsVersion}-workload-manageddesktop" `
+ "visualstudio${VsVersion}-workload-nativedesktop" `
+ "visualstudio${VsVersion}-workload-universal" `
+ "visualstudio${VsVersion}buildtools" `
+ git `
+ cmake `
+ winflexbison3 `
+ windows-sdk-8.1 `
+ wixtoolset
+ ThrowOnNativeFailure
+} else {
+ choco install -y winflexbison3
+ ThrowOnNativeFailure
+}
+
+
+Install-Exe -Url "https://packages.icinga.com/windows/dependencies/boost_$($BoostVersion -join '_')-msvc-${MsvcVersion}-${Env:BITS}.exe" -Dir "C:\local\boost_$($BoostVersion -join '_')-Win${Env:BITS}"
+
+Install-Exe -Url "https://packages.icinga.com/windows/dependencies/Win${Env:BITS}OpenSSL-${OpensslVersion}.exe" -Dir "C:\local\OpenSSL_${OpensslVersion}-Win${Env:BITS}"