build/windows: Detect local MSYS_ROOT with PowerShell wizardry

This is useful only for local runs. There is no registry key on runners.
This commit is contained in:
Bruno
2025-02-17 13:20:25 -03:00
parent 128b0b81cc
commit 693f95a25c
4 changed files with 12 additions and 9 deletions

View File

@ -799,6 +799,8 @@ dist-installer-weekly:
stage: distribution
tags:
- windows-aarch64
variables:
MSYS_ROOT: 'C:/msys64'
script:
- build/windows/installer/3_dist-gimp-inno.ps1
artifacts:

View File

@ -21,15 +21,16 @@ if (-not $GITLAB_CI)
# Install the required (pre-built) packages for babl, GEGL and GIMP
#MSYS2 forces us to presume 'InstallLocation'. See: https://github.com/msys2/msys2-installer/issues/85
$MSYS_ROOT = 'C:/msys64'
if ($MSYSTEM_PREFIX -eq 'mingw32')
if (-not $MSYS_ROOT)
{
Write-Host '(WARNING): 32-bit builds will be dropped in a future release. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/10922' -ForegroundColor Yellow
$MSYSTEM_PREFIX = 'mingw32'
$MINGW_PACKAGE_PREFIX = 'mingw-w64-i686'
$MSYS_ROOT = $(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall -Recurse | ForEach-Object { Get-ItemProperty $_.PSPath -ErrorAction SilentlyContinue } | Where-Object { $_.PSObject.Properties.Value -like "*The MSYS2 Developers*" } | ForEach-Object { return "$($_.InstallLocation)" }) -replace '\\','/'
if ("$MSYS_ROOT" -eq '')
{
Write-Host '(ERROR): MSYS2 installation not found. Please, install it with: winget install MSYS2.MSYS2' -ForegroundColor Red
exit 1
}
}
elseif ((Get-WmiObject -Class Win32_ComputerSystem).SystemType -like 'ARM64*')
if ((Get-WmiObject -Class Win32_ComputerSystem).SystemType -like 'ARM64*')
{
$MSYSTEM_PREFIX = 'clangarm64'
$MINGW_PACKAGE_PREFIX = 'mingw-w64-clang-aarch64'

View File

@ -23,7 +23,7 @@ if (-not $GITLAB_CI)
# Install the required (pre-built) packages for babl, GEGL and GIMP (again)
Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS_ROOT =' -Context 0,17) -replace '> ','')
Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS_ROOT\)' -Context 0,19) -replace '> ','')
if ($GITLAB_CI)
{

View File

@ -13,7 +13,7 @@ $PSNativeCommandUseErrorActionPreference = $true
# This script needs a bit of MSYS2 to work
Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS_ROOT =' -Context 0,17) -replace '> ','')
Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS_ROOT\)' -Context 0,19) -replace '> ','')
# 1. GET INNO