From 56ae875861ab260b80a030f50c4aff9f9dc8fff0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:32:39 +0200 Subject: Adding upstream version 2.14.2. Signed-off-by: Daniel Baumann --- doc/win-dev.ps1 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 doc/win-dev.ps1 (limited to 'doc/win-dev.ps1') diff --git a/doc/win-dev.ps1 b/doc/win-dev.ps1 new file mode 100644 index 0000000..8077928 --- /dev/null +++ b/doc/win-dev.ps1 @@ -0,0 +1,99 @@ +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, 84, 0) +$OpensslVersion = '3_0_12' + +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 +} + +# Disable the progress bar for downloads from the Web, which will speed up the entire download process +$Global:ProgressPreference = 'SilentlyContinue'; + +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}" -- cgit v1.2.3