|
3 | 3 | ## Desc: Install GNU tools for Windows
|
4 | 4 | ################################################################################
|
5 | 5 |
|
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 $_" |
29 | 20 | }
|
30 |
| - |
31 |
| - Add-MachinePathItem "C:\mingw64\bin" |
32 |
| - |
33 |
| -} |
34 | 21 |
|
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 | + } |
52 | 25 |
|
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" |
57 | 30 |
|
58 |
| - $packagePath = Invoke-DownloadWithRetry $url |
59 |
| - Expand-7ZipArchive -Path $packagePath -DestinationPath "C:\" |
| 31 | + $packagePath = Invoke-DownloadWithRetry $url |
| 32 | + Expand-7ZipArchive -Path $packagePath -DestinationPath "C:\" |
60 | 33 |
|
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') |
68 | 38 | }
|
69 | 39 |
|
| 40 | +Add-MachinePathItem "C:\mingw64\bin" |
| 41 | + |
70 | 42 | Invoke-PesterTests -TestFile "Tools" -TestName "Mingw64"
|
0 commit comments