Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mingw in windows-2019 image #10353

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 29 additions & 57 deletions images/windows/scripts/build/Install-Mingw64.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,40 @@
## Desc: Install GNU tools for Windows
################################################################################

if (Test-IsWin19) {
# If Windows 2019, install version 8.1.0 form sourceforge
$baseUrl = "https://download.qt.io/development_releases/prebuilt"

$("mingw32", "mingw64") | ForEach-Object {
if ($_ -eq "mingw32") {
$url = "$baseUrl/mingw_32/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z"
$sha256sum = 'adb84b70094c0225dd30187ff995e311d19424b1eb8f60934c60e4903297f946'
} elseif ($_ -eq "mingw64") {
$url = "$baseUrl/mingw_64/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z"
$sha256sum = '853970527b5de4a55ec8ca4d3fd732c00ae1c69974cc930c82604396d43e79f8'
} else {
throw "Unknown architecture $_"
}

$packagePath = Invoke-DownloadWithRetry $url
Test-FileChecksum -Path $packagePath -ExpectedSHA256Sum $sha256sum
Expand-7ZipArchive -Path $packagePath -DestinationPath "C:\"

# Make a copy of mingw-make.exe to make.exe, which is a more discoverable name
# and so the same command line can be used on Windows as on macOS and Linux
$path = "C:\$_\bin\mingw32-make.exe" | Get-Item
Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe')
$version = (Get-ToolsetContent).mingw.version
$runtime = (Get-ToolsetContent).mingw.runtime

$("mingw32", "mingw64") | ForEach-Object {
if ($_ -eq "mingw32") {
$arch = "i686"
$threads = "posix"
$exceptions = "dwarf"
} elseif ($_ -eq "mingw64") {
$arch = "x86_64"
$threads = "posix"
$exceptions = "seh"
} else {
throw "Unknown architecture $_"
}

Add-MachinePathItem "C:\mingw64\bin"

}

if (Test-IsWin22) {
# If Windows 2022, install version specified in the toolset
$version = (Get-ToolsetContent).mingw.version
$runtime = (Get-ToolsetContent).mingw.runtime

$("mingw32", "mingw64") | ForEach-Object {
if ($_ -eq "mingw32") {
$arch = "i686"
$threads = "posix"
$exceptions = "dwarf"
} elseif ($_ -eq "mingw64") {
$arch = "x86_64"
$threads = "posix"
$exceptions = "seh"
} else {
throw "Unknown architecture $_"
}
if ($runtime) {
$runtimeSuffix = "$runtime-"
}

$url = Resolve-GithubReleaseAssetUrl `
-Repo "niXman/mingw-builds-binaries" `
-Version "$version" `
-Asset "$arch-*-release-$threads-$exceptions-$runtime-*.7z"
$url = Resolve-GithubReleaseAssetUrl `
-Repo "niXman/mingw-builds-binaries" `
-Version "$version" `
-Asset "$arch-*-release-$threads-$exceptions-$runtimeSuffix*.7z"

$packagePath = Invoke-DownloadWithRetry $url
Expand-7ZipArchive -Path $packagePath -DestinationPath "C:\"
$packagePath = Invoke-DownloadWithRetry $url
Expand-7ZipArchive -Path $packagePath -DestinationPath "C:\"

# Make a copy of mingw-make.exe to make.exe, which is a more discoverable name
# and so the same command line can be used on Windows as on macOS and Linux
$path = "C:\$_\bin\mingw32-make.exe" | Get-Item
Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe')
}

Add-MachinePathItem "C:\mingw64\bin"
# Make a copy of mingw-make.exe to make.exe, which is a more discoverable name
# and so the same command line can be used on Windows as on macOS and Linux
$path = "C:\$_\bin\mingw32-make.exe" | Get-Item
Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe')
}

Add-MachinePathItem "C:\mingw64\bin"

Invoke-PesterTests -TestFile "Tools" -TestName "Mingw64"
3 changes: 3 additions & 0 deletions images/windows/toolsets/toolset-2019.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
]
}
},
"mingw": {
"version": "8.5.0"
},
"MsysPackages": {
"msys2": [
"base-devel",
Expand Down