small refactor and void library
Signed-off-by: Aleksei (Faumaray) Selikhov <contact@faumaray.com>
This commit is contained in:
1 parent
74b89ae3ca
commit
083b84e11a
12 files changed
+646
-343
No files matched your search
+35
-12
@@ -9,15 +9,38 @@ $portableRoot = Join-Path $toolRoot 'msys64'
|
||||
if (-not $Msys2Root) { $Msys2Root = $portableRoot }
|
||||
$bash = Join-Path $Msys2Root 'usr\bin\bash.exe'
|
||||
$bin = Join-Path $Msys2Root 'ucrt64\bin'
|
||||
$compiler = Join-Path $bin 'g++.exe'
|
||||
if ((Test-Path -LiteralPath $compiler -PathType Leaf) -and
|
||||
(Test-Path -LiteralPath (Join-Path $bin 'cmake.exe') -PathType Leaf) -and
|
||||
(Test-Path -LiteralPath (Join-Path $bin 'ninja.exe') -PathType Leaf)) {
|
||||
$version = & $compiler -dumpfullversion
|
||||
if ($LASTEXITCODE -eq 0 -and $version -match '^16(\.|$)') {
|
||||
Write-Output "MSYS2 UCRT64 GCC $version is ready."
|
||||
$git = Join-Path $Msys2Root 'usr\bin\git.exe'
|
||||
|
||||
function Get-ReadyCompilerVersion {
|
||||
foreach ($tool in @('gcc.exe', 'g++.exe', 'cmake.exe', 'ctest.exe', 'ninja.exe', 'windres.exe')) {
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $bin $tool) -PathType Leaf)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $git -PathType Leaf)) {
|
||||
return
|
||||
}
|
||||
$version = & (Join-Path $bin 'g++.exe') -dumpfullversion
|
||||
if ($LASTEXITCODE -ne 0 -or $version -notmatch '^\d+\.\d+(\.\d+)?$' -or
|
||||
[version]$version -lt [version]'16.0') {
|
||||
return
|
||||
}
|
||||
$cVersion = & (Join-Path $bin 'gcc.exe') -dumpfullversion
|
||||
if ($LASTEXITCODE -ne 0 -or $cVersion -ne $version) {
|
||||
return
|
||||
}
|
||||
$cmakeVersion = & (Join-Path $bin 'cmake.exe') --version
|
||||
if ($LASTEXITCODE -ne 0 -or $cmakeVersion[0] -notmatch '^cmake version (\d+\.\d+\.\d+)' -or
|
||||
[version]$Matches[1] -lt [version]'4.0') {
|
||||
return
|
||||
}
|
||||
return $version
|
||||
}
|
||||
|
||||
$version = Get-ReadyCompilerVersion
|
||||
if ($version) {
|
||||
Write-Output "MSYS2 UCRT64 GCC $version, CMake, Ninja, and Git are ready."
|
||||
return
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $bash -PathType Leaf)) {
|
||||
if ([IO.Path]::GetFullPath($Msys2Root) -ne [IO.Path]::GetFullPath($portableRoot)) {
|
||||
@@ -45,13 +68,13 @@ try {
|
||||
# An MSYS2 runtime upgrade can close the first shell. Start a fresh shell for the remaining packages.
|
||||
& $bash --login -c 'pacman -Syu --noconfirm'
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
& $bash --login -c 'pacman -Syu --needed --noconfirm mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja'
|
||||
& $bash --login -c 'pacman -Syu --needed --noconfirm git mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja'
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
} finally {
|
||||
$env:MSYSTEM = $previousMsysSystem
|
||||
}
|
||||
$version = & $compiler -dumpfullversion
|
||||
if ($LASTEXITCODE -ne 0 -or $version -notmatch '^16(\.|$)') {
|
||||
throw "Expected GCC 16 in MSYS2 UCRT64. Found: $version"
|
||||
$version = Get-ReadyCompilerVersion
|
||||
if (-not $version) {
|
||||
throw 'Expected MSYS2 UCRT64 with matching GCC 16+ compilers, windres, CMake 4+, CTest, Ninja, and Git.'
|
||||
}
|
||||
Write-Output "MSYS2 UCRT64 GCC $version is ready."
|
||||
Write-Output "MSYS2 UCRT64 GCC $version, CMake, Ninja, and Git are ready."
|
||||
Reference in new issue
Block a user