Skip to content

Commit 47fadc4

Browse files
committed
Update mingw in windows-2019 image
1 parent e72f29b commit 47fadc4

File tree

2 files changed

+32
-57
lines changed

2 files changed

+32
-57
lines changed

images/windows/scripts/build/Install-Mingw64.ps1

Lines changed: 29 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,68 +3,40 @@
33
## Desc: Install GNU tools for Windows
44
################################################################################
55

6-
if (Test-IsWin19) {
7-
# If Windows 2019, install version 8.1.0 form sourceforge
8-
$baseUrl = "https://sourceforge.net/projects/mingw-w64/files"
9-
10-
$("mingw32", "mingw64") | ForEach-Object {
11-
if ($_ -eq "mingw32") {
12-
$url = "$baseUrl/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z/download"
13-
$sha256sum = 'adb84b70094c0225dd30187ff995e311d19424b1eb8f60934c60e4903297f946'
14-
} elseif ($_ -eq "mingw64") {
15-
$url = "$baseUrl/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z/download"
16-
$sha256sum = '853970527b5de4a55ec8ca4d3fd732c00ae1c69974cc930c82604396d43e79f8'
17-
} else {
18-
throw "Unknown architecture $_"
19-
}
20-
21-
$packagePath = Invoke-DownloadWithRetry $url
22-
Test-FileChecksum -Path $packagePath -ExpectedSHA256Sum $sha256sum
23-
Expand-7ZipArchive -Path $packagePath -DestinationPath "C:\"
24-
25-
# Make a copy of mingw-make.exe to make.exe, which is a more discoverable name
26-
# and so the same command line can be used on Windows as on macOS and Linux
27-
$path = "C:\$_\bin\mingw32-make.exe" | Get-Item
28-
Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe')
6+
$version = (Get-ToolsetContent).mingw.version
7+
$runtime = (Get-ToolsetContent).mingw.runtime
8+
9+
$("mingw32", "mingw64") | ForEach-Object {
10+
if ($_ -eq "mingw32") {
11+
$arch = "i686"
12+
$threads = "posix"
13+
$exceptions = "dwarf"
14+
} elseif ($_ -eq "mingw64") {
15+
$arch = "x86_64"
16+
$threads = "posix"
17+
$exceptions = "seh"
18+
} else {
19+
throw "Unknown architecture $_"
2920
}
30-
31-
Add-MachinePathItem "C:\mingw64\bin"
32-
33-
}
3421

35-
if (Test-IsWin22) {
36-
# If Windows 2022, install version specified in the toolset
37-
$version = (Get-ToolsetContent).mingw.version
38-
$runtime = (Get-ToolsetContent).mingw.runtime
39-
40-
$("mingw32", "mingw64") | ForEach-Object {
41-
if ($_ -eq "mingw32") {
42-
$arch = "i686"
43-
$threads = "posix"
44-
$exceptions = "dwarf"
45-
} elseif ($_ -eq "mingw64") {
46-
$arch = "x86_64"
47-
$threads = "posix"
48-
$exceptions = "seh"
49-
} else {
50-
throw "Unknown architecture $_"
51-
}
22+
if ($runtime) {
23+
$runtimeSuffix = "$runtime-"
24+
}
5225

53-
$url = Resolve-GithubReleaseAssetUrl `
54-
-Repo "niXman/mingw-builds-binaries" `
55-
-Version "$version" `
56-
-Asset "$arch-*-release-$threads-$exceptions-$runtime-*.7z"
26+
$url = Resolve-GithubReleaseAssetUrl `
27+
-Repo "niXman/mingw-builds-binaries" `
28+
-Version "$version" `
29+
-Asset "$arch-*-release-$threads-$exceptions-$runtimeSuffix*.7z"
5730

58-
$packagePath = Invoke-DownloadWithRetry $url
59-
Expand-7ZipArchive -Path $packagePath -DestinationPath "C:\"
31+
$packagePath = Invoke-DownloadWithRetry $url
32+
Expand-7ZipArchive -Path $packagePath -DestinationPath "C:\"
6033

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

40+
Add-MachinePathItem "C:\mingw64\bin"
41+
7042
Invoke-PesterTests -TestFile "Tools" -TestName "Mingw64"

images/windows/toolsets/toolset-2019.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@
162162
]
163163
}
164164
},
165+
"mingw": {
166+
"version": "8.5.0"
167+
},
165168
"MsysPackages": {
166169
"msys2": [
167170
"base-devel",

0 commit comments

Comments
 (0)