mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 11:40:10 +01:00
ci/windows: Use winget to install packages and install Microsoft.WindowsWDK.10.0.26100
And switch all packages use winget to install. bloodrock.pkg-config-lite according https://github.com/microsoft/winget-pkgs/pull/284186 WinFlexBison.win_flex_bison according https://github.com/microsoft/winget-pkgs/pull/284202 Git.Git already contains 'GitHub.GitLFS' according https://github.com/microsoft/winget-pkgs/issues/276985 Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37210>
This commit is contained in:
parent
efb31e2e6a
commit
9592686ca0
5 changed files with 72 additions and 25 deletions
|
|
@ -15,6 +15,10 @@ RUN Write-Output $PSVersionTable $ErrorActionPreference
|
|||
COPY mesa_deps_msvc.ps1 C:\
|
||||
RUN C:\mesa_deps_msvc.ps1
|
||||
|
||||
COPY mesa_deps_winget.ps1 C:\
|
||||
RUN C:\mesa_deps_winget.ps1
|
||||
COPY mesa_deps_winget_settings.json C:\Users\ContainerAdministrator\AppData\Local\Microsoft\WinGet\Settings\defaultState\settings.json
|
||||
|
||||
COPY mesa_deps_packages.ps1 C:\
|
||||
RUN C:\mesa_deps_packages.ps1
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ $MyPath = $MyInvocation.MyCommand.Path | Split-Path -Parent
|
|||
. "$MyPath\mesa_init_msvc.ps1" "-vcvars_ver=14.29"
|
||||
|
||||
# we want more secure TLS 1.2 for most things, but it breaks SourceForge
|
||||
# downloads so must be done after Chocolatey use
|
||||
# downloads so must be done after winget use
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13;
|
||||
|
||||
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "deps" | Out-Null
|
||||
|
|
|
|||
|
|
@ -31,35 +31,51 @@ if (!$graphics_tools_installed) {
|
|||
Exit 1
|
||||
}
|
||||
|
||||
Write-Host "Installing Chocolatey at:"
|
||||
Get-Date
|
||||
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
||||
Import-Module "$env:ProgramData\chocolatey\helpers\chocolateyProfile.psm1"
|
||||
# Add Chocolatey's native install path
|
||||
Update-SessionEnvironment
|
||||
Write-Host "Installing Chocolatey packages at:"
|
||||
Get-Date
|
||||
$USER_PATH=[System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::User)
|
||||
$MACHINE_PATH=[System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
|
||||
Write-Output "Before winget install USER_PATH:$USER_PATH MACHINE_PATH:$MACHINE_PATH"
|
||||
|
||||
# Chocolatey tries to download winflexbison3 from github, which is not super reliable, and has no retry
|
||||
# loop of its own - so we give it a helping hand here
|
||||
For ($i = 0; $i -lt 5; $i++) {
|
||||
choco install --no-progress -y python3
|
||||
$python_install = $?
|
||||
choco install --allow-empty-checksums --no-progress -y cmake git git-lfs ninja pkgconfiglite winflexbison3 --installargs "ADD_CMAKE_TO_PATH=System"
|
||||
$other_install = $?
|
||||
$choco_installed = $other_install -and $python_install
|
||||
if ($choco_installed) {
|
||||
Break
|
||||
$Packages = @(
|
||||
'Microsoft.WindowsWDK.10.0.26100',
|
||||
'Python.Python.3.13',
|
||||
'Ninja-build.Ninja',
|
||||
'Kitware.CMake',
|
||||
'Git.Git',
|
||||
'WinFlexBison.win_flex_bison',
|
||||
'bloodrock.pkg-config-lite'
|
||||
)
|
||||
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
New-Item -Force -ItemType 'directory' -Name 'flexbison' -Path 'C:\temp'
|
||||
foreach ($package in $Packages)
|
||||
{
|
||||
Write-Output "Installing $package with winget"
|
||||
For ($i = 0; $i -lt 5; $i++) {
|
||||
winget install --verbose --silent --accept-package-agreements --source winget --exact --id $package --log C:\temp\wdk-install.log
|
||||
$packages_installed = $?
|
||||
if ($packages_installed) {
|
||||
Break
|
||||
}
|
||||
}
|
||||
if (!$packages_installed) {
|
||||
Write-Host "Couldn't install $package with winget"
|
||||
Exit 1
|
||||
} else {
|
||||
Write-Output "Installed $package with winget"
|
||||
}
|
||||
}
|
||||
|
||||
if (!$choco_installed) {
|
||||
Write-Host "Couldn't install dependencies from Chocolatey"
|
||||
Exit 1
|
||||
}
|
||||
# The win_flex.exe should be directly accessed than use symbolic link https://github.com/lexxmark/winflexbison/issues/97
|
||||
$win_flex_target=((Get-ChildItem -Path (Get-Command win_flex).Path -Force | Select-Object Target).Target | Split-Path -Parent)
|
||||
$NEW_USER_PATH="$win_flex_target;"
|
||||
[Environment]::SetEnvironmentVariable('PATH', $NEW_USER_PATH + [Environment]::GetEnvironmentVariable('PATH', "User"), 'User')
|
||||
|
||||
# Add Chocolatey's newly installed package path
|
||||
Update-SessionEnvironment
|
||||
$USER_PATH=[System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::User)
|
||||
$MACHINE_PATH=[System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
|
||||
Write-Output "After winget install USER_PATH:$USER_PATH MACHINE_PATH:$MACHINE_PATH"
|
||||
|
||||
# Setup tmp path for git and python
|
||||
$env:PATH="$env:LOCALAPPDATA\Programs\Python\Python313\Scripts\;$env:LOCALAPPDATA\Programs\Python\Python313\;$env:ProgramFiles\Git\cmd;$env:PATH"
|
||||
|
||||
Start-Process -NoNewWindow -Wait git -ArgumentList 'config --global core.autocrlf false'
|
||||
|
||||
|
|
|
|||
21
.gitlab-ci/windows/mesa_deps_winget.ps1
Normal file
21
.gitlab-ci/windows/mesa_deps_winget.ps1
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# According to https://github.com/microsoft/winget-cli/issues/3037#issuecomment-2155167046
|
||||
Write-Host "Install winget"
|
||||
New-Item -Force -ItemType 'directory' -Name 'winget-cli' -Path 'C:/temp'
|
||||
Invoke-WebRequest 'https://aka.ms/vs/16/release/vc_redist.x64.exe' -OutFile 'C:/temp/vc_redist.x64.exe' -UseBasicParsing
|
||||
powershell -c C:/temp/vc_redist.x64.exe /install /quiet /norestart
|
||||
Invoke-WebRequest 'https://aka.ms/getwinget' -OutFile 'C:/temp/winget-cli/winget.zip' -UseBasicParsing
|
||||
Expand-Archive -LiteralPath 'C:/temp/winget-cli/winget.zip' -DestinationPath 'C:/temp/winget-cli' -Force
|
||||
Move-Item -Path 'C:/temp/winget-cli/AppInstaller_x64.msix' -Destination 'C:/temp/winget-cli/AppInstaller_x64.zip'
|
||||
Expand-Archive -LiteralPath 'C:/temp/winget-cli/AppInstaller_x64.zip' -DestinationPath 'C:/temp/winget-cli' -Force
|
||||
New-Item -Force -ItemType 'directory' -Name 'winget-cli' -Path 'C:/'
|
||||
Move-Item -Path 'C:/temp/winget-cli/winget.exe' -Destination 'C:/winget-cli/winget.exe'
|
||||
Move-Item -Path 'C:/temp/winget-cli/WindowsPackageManager.dll' -Destination 'C:/winget-cli/WindowsPackageManager.dll'
|
||||
Move-Item -Path 'C:/temp/winget-cli/resources.pri' -Destination 'C:/winget-cli'
|
||||
|
||||
$env:PATH="C:/winget-cli;$env:PATH"
|
||||
winget settings export
|
||||
|
||||
$NEW_USER_PATH="$env:LOCALAPPDATA\Microsoft\WinGet\Links;C:\winget-cli;"
|
||||
[Environment]::SetEnvironmentVariable('PATH', $NEW_USER_PATH + [Environment]::GetEnvironmentVariable('PATH', "User"), 'User')
|
||||
Remove-Item -Recurse -Path "C:/temp"
|
||||
Write-Host "Install winget done"
|
||||
6
.gitlab-ci/windows/mesa_deps_winget_settings.json
Normal file
6
.gitlab-ci/windows/mesa_deps_winget_settings.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"$schema": "https://aka.ms/winget-settings.schema.json",
|
||||
"installBehavior": {
|
||||
"archiveExtractionMethod": "tar"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue