mirror of https://github.com/qt/qt5.git
Windows: Add a helper to cleanly invoke NMake with zlib
Invoke-NMake helper temporarily clears MAKE flags, such as MAKEFLAGS='-j8', to prevent errors from GNU-style flags and to reduce flakiness with NMAKE. The helper is used to build zlib and to prevent: error U1065: invalid option '-' Pick-to: 6.10 6.9 6.8 6.5 Task-number: QTQAINFRA-7363 Change-Id: Ia80216677eba6fd8f8364741b6999e6155d678ab Reviewed-by: Tero Heikkinen <tero.heikkinen@qt.io>
This commit is contained in:
parent
b8995e0ebc
commit
0f3d085101
|
@ -382,3 +382,22 @@ function Invoke-MtCommand {
|
||||||
& $Env:SystemRoot\system32\cmd.exe /c $cmdLine | Write-Output
|
& $Env:SystemRoot\system32\cmd.exe /c $cmdLine | Write-Output
|
||||||
Remove-Item $tempFile
|
Remove-Item $tempFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Invoke-NMake {
|
||||||
|
param([string[]]$NmakeArgs)
|
||||||
|
# Temporarily remove MAKE flags for NMAKE process
|
||||||
|
$old = @{
|
||||||
|
MAKEFLAGS = (Get-Item Env:MAKEFLAGS -ErrorAction Ignore).Value
|
||||||
|
MFLAGS = (Get-Item Env:MFLAGS -ErrorAction Ignore).Value
|
||||||
|
MAKE = (Get-Item Env:MAKE -ErrorAction Ignore).Value
|
||||||
|
NMAKEFLAGS = (Get-Item Env:NMAKEFLAGS -ErrorAction Ignore).Value
|
||||||
|
}
|
||||||
|
foreach ($n in $old.Keys) {Remove-Item "Env:$n" -ErrorAction SilentlyContinue}
|
||||||
|
try {& nmake @NmakeArgs}
|
||||||
|
finally {
|
||||||
|
foreach ($n in $old.Keys) {
|
||||||
|
if ($old[$n]) {Set-EnvironmentVariable -Key "$n" -Value $old[$n]}
|
||||||
|
else {Remove-Item "Env:$n" -ErrorAction SilentlyContinue}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -42,8 +42,7 @@ function BuildZlib {
|
||||||
)
|
)
|
||||||
|
|
||||||
PrepareBuildEnvironment -HostArchitecture $HostArchitecture -TargetArchitecture $TargetArchitecture
|
PrepareBuildEnvironment -HostArchitecture $HostArchitecture -TargetArchitecture $TargetArchitecture
|
||||||
|
Invoke-NMake -NmakeArgs @('/f', "$MAKEFILE")
|
||||||
nmake /f $MAKEFILE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CopySource {
|
function CopySource {
|
||||||
|
|
Loading…
Reference in New Issue