28499e484ced0d7aead78e0dc766da62fd07ec40
[mesa.git] / .gitlab-ci / windows / mesa_deps.ps1
1 Get-Date
2 Write-Host "Installing Chocolatey"
3 Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
4 Import-Module "$env:ProgramData\chocolatey\helpers\chocolateyProfile.psm1"
5 Update-SessionEnvironment
6 Write-Host "Installing Chocolatey packages"
7
8 # Chocolatey tries to download winflexbison from SourceForge, which is not super reliable, and has no retry
9 # loop of its own - so we give it a helping hand here
10 For ($i = 0; $i -lt 5; $i++) {
11 choco install -y python3 --params="/InstallDir:C:\python3"
12 $python_install = $?
13 choco install --allow-empty-checksums -y cmake git git-lfs ninja pkgconfiglite winflexbison
14 $other_install = $?
15 $choco_installed = $other_install -and $python_install
16 if ($choco_installed) {
17 Break
18 }
19 }
20
21 if (!$choco_installed) {
22 Write-Host "Couldn't install dependencies from Chocolatey"
23 Exit 1
24 }
25
26 # Add Chocolatey's native install path
27 Update-SessionEnvironment
28 # Python adds itself to the system environment path, which doesn't get refreshed until we start a new shell
29 $env:PATH = "C:\python3;C:\python3\scripts;$env:PATH"
30
31 Start-Process -NoNewWindow -Wait git -ArgumentList 'config --global core.autocrlf false'
32
33 Get-Date
34 Write-Host "Installing Meson and Mako"
35 pip3 install meson mako
36 if (!$?) {
37 Write-Host "Failed to install dependencies from pip"
38 Exit 1
39 }
40
41 # we want more secure TLS 1.2 for most things, but it breaks SourceForge
42 # downloads so must be done after Chocolatey use
43 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
44
45 # VS16.x is 2019
46 $msvc_2019_url = 'https://aka.ms/vs/16/release/vs_buildtools.exe'
47
48 Get-Date
49 Write-Host "Downloading Visual Studio 2019 build tools"
50 Invoke-WebRequest -Uri $msvc_2019_url -OutFile C:\vs_buildtools.exe
51
52 Get-Date
53 Write-Host "Installing Visual Studio 2019"
54 Start-Process -NoNewWindow -Wait C:\vs_buildtools.exe -ArgumentList '--wait --quiet --norestart --nocache --installPath C:\BuildTools --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.ATLMFC --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Graphics.Tools --add Microsoft.VisualStudio.Component.Windows10SDK.18362 --includeRecommended'
55 Remove-Item C:\vs_buildtools.exe -Force
56
57 Get-Date
58 Write-Host "Complete"