-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Install MSYS2 to Windows. #585
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
Merged
AlenaSviridenko
merged 29 commits into
actions:master
from
vsafonkin:v-vlsafo/msys2-install
Mar 26, 2020
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
1773dd7
Add msys2 install script
vsafonkin 9630ed7
Add msys2 to template
vsafonkin 25ed304
Fix filename
vsafonkin d4ef717
Fix filename
vsafonkin ab8fb88
Add validate spript
vsafonkin 8583664
Test elevated user
vsafonkin 0b0f210
Test elevated user
vsafonkin e68c39c
Test
vsafonkin 7339af8
Test
vsafonkin e269c20
Test
vsafonkin 3f05ba0
Add msys2 to windows-2016
vsafonkin 07b107e
Minor fix
vsafonkin 326bf84
Fix var names
vsafonkin 3fdcbbd
Fix gcc version parsing
vsafonkin 58591f9
Remove redirect stderr to stdout
vsafonkin 5f459a3
Remove errors ignore command
vsafonkin 7720b74
Minor fix
vsafonkin 418d168
Minor fix
vsafonkin de43464
Minor fix
vsafonkin 303d675
Reworked validation
vsafonkin 4f00d9b
Add tool versions to description
vsafonkin a9c6335
Minor fix
vsafonkin 53536ce
Add cmake check
vsafonkin e80bf9e
Minor fix
vsafonkin 9f55156
Fix typo
vsafonkin 9e12e18
Reworked validation
vsafonkin 8c2cd2b
Merge branch 'master' into v-vlsafo/msys2-install
vsafonkin b0a54cf
Minor change
vsafonkin 89c2c31
Minor fix
vsafonkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| ################################################################################ | ||
| ## File: Install-Msys2.ps1 | ||
| ## Desc: Install Msys2 and 64-bit gcc, cmake, & llvm (32-bit commented out) | ||
| ################################################################################ | ||
|
|
||
| # References | ||
| # https://github.com/msys2/MINGW-packages/blob/master/azure-pipelines.yml | ||
| # https://packages.msys2.org/group/ | ||
|
|
||
| $origPath = $env:PATH | ||
| $gitPath = "$env:ProgramFiles\Git" | ||
|
|
||
| # get info from https://sourceforge.net/projects/msys2/files/Base/x86_64/ | ||
| $msys2Uri = "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz" | ||
| $msys2File = "$env:TEMP\msys2.tar.xz" | ||
|
|
||
| # Download the latest msys2 x86_64 | ||
| Write-Host "Starting msys2 download" | ||
| (New-Object System.Net.WebClient).DownloadFile($msys2Uri, $msys2File) | ||
| Write-Host "Finished download" | ||
|
|
||
| $msys2FileU = "/$msys2File".replace(':', '') | ||
vsafonkin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| $tar = "$gitPath\usr\bin\tar.exe" | ||
|
|
||
| # extract tar.xz to C:\ | ||
| Write-Host "Starting msys2 extraction" | ||
| &$tar -Jxf $msys2FileU -C /c/ | ||
| Remove-Item $msys2File | ||
| Write-Host "Finished extraction" | ||
|
|
||
| # Add msys2 bin tools folders to PATH temporary | ||
| $env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$origPath" | ||
|
|
||
| Write-Host "bash pacman-key --init" | ||
| bash.exe -c "pacman-key --init 2>&1" | ||
|
|
||
| Write-Host "bash pacman-key --populate msys2" | ||
| bash.exe -c "pacman-key --populate msys2 2>&1" | ||
|
|
||
| Write-Host "pacman --noconfirm -Syyuu" | ||
| pacman.exe -Syyuu --noconfirm | ||
| pacman.exe -Syuu --noconfirm | ||
|
|
||
| Write-Host "Install msys2 packages" | ||
| pacman.exe -S --noconfirm --needed --noprogressbar base-devel compression | ||
|
|
||
| # mingw package list | ||
| $tools = "___clang ___cmake ___llvm ___toolchain ___ragel" | ||
|
|
||
| # install mingw64 packages | ||
| Write-Host "Install mingw64 packages" | ||
| $pre = "mingw-w64-x86_64-" | ||
| pacman.exe -S --noconfirm --needed --noprogressbar $tools.replace('___', $pre).split(' ') | ||
|
|
||
| # install mingw32 packages | ||
| Write-Host "Install mingw32 packages" | ||
| $pre = "mingw-w64-i686-" | ||
| pacman.exe -S --noconfirm --needed --noprogressbar $tools.replace('___', $pre).split(' ') | ||
|
|
||
| # clean all packages to decrease image size | ||
| Write-Host "Clean packages" | ||
| pacman.exe -Scc --noconfirm | ||
|
|
||
| Write-Host "Installed mingw64 packages" | ||
| pacman.exe -Qs --noconfirm mingw-w64-x86_64- | ||
|
|
||
| Write-Host "Installed mingw32 packages" | ||
| pacman.exe -Qs --noconfirm mingw-w64-i686- | ||
|
|
||
| Write-Host "Installed msys2 packages" | ||
| pacman.exe -Qs --noconfirm | ||
|
|
||
| Write-Host "MSYS2 installation completed" | ||
|
|
||
| exit 0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| ################################################################################ | ||
| ## File: Validate-Msys2.ps1 | ||
| ## Desc: Validate Msys2 | ||
| ################################################################################ | ||
|
|
||
| $msys2BinDir = "C:\msys64\usr\bin" | ||
| $msys2mingwDir = "C:\msys64\mingw64\bin" | ||
|
|
||
| $installedTools = @( | ||
| "bash", | ||
| "tar", | ||
| "make" | ||
| ) | ||
|
|
||
| $installedMinGWTools = @( | ||
| "gcc", | ||
| "cmake" | ||
| ) | ||
|
|
||
| Write-Host "Check installed tools in msys2/usr/bin directory" | ||
| $installedTools | ForEach-Object { | ||
| $toolName = $_ | ||
| try { | ||
| Invoke-Expression "$msys2BinDir\$_ --version" | ||
| } catch { | ||
| Write-Host "$toolName was not installed in MSYS2 bin directory" | ||
| Write-Error $_ | ||
| exit 1 | ||
| } | ||
| } | ||
|
|
||
| Write-Host "Check installed tools in msys2/mingw/bin directory" | ||
| $installedMinGWTools | ForEach-Object { | ||
| $toolName = $_ | ||
| try { | ||
| Invoke-Expression "$msys2mingwDir\$_ --version" | ||
| } catch { | ||
| Write-Error "$toolName was not installed in MSYS2 mingw bin directory" | ||
| Write-Error $_ | ||
| exit 1 | ||
| } | ||
| } | ||
|
|
||
| # Adding description of the software to Markdown | ||
|
|
||
| function Get-ToolVersion { | ||
| param( | ||
| [string] $ToolPath, | ||
| [int] $VersionLineNumber | ||
| ) | ||
|
|
||
| $toolRawVersion = Invoke-Expression "$ToolPath --version" | ||
| $toolRawVersion.Split([System.Environment]::NewLine)[$VersionLineNumber] -match "\d+\.\d+(\.\d+)?" | Out-Null | ||
| $toolVersion = $matches[0] | ||
| return $toolVersion | ||
| } | ||
|
|
||
| $SoftwareName = "MSYS2" | ||
| $pacmanVersion = Get-ToolVersion -ToolPath "$msys2BinDir/pacman" -VersionLineNumber 1 | ||
| $bashVersion = Get-ToolVersion -ToolPath "$msys2BinDir/bash" -VersionLineNumber 0 | ||
| $gccVersion = Get-ToolVersion -ToolPath "$msys2mingwDir/gcc" -VersionLineNumber 0 | ||
| $tarVersion = Get-ToolVersion -ToolPath "$msys2BinDir/tar" -VersionLineNumber 0 | ||
|
|
||
| $Description = @" | ||
| _Tool versions_ | ||
| _pacman:_ $pacmanVersion<br/> | ||
| _bash:_ $bashVersion<br/> | ||
| _gcc:_ $gccVersion<br/> | ||
| _tar:_ $tarVersion<br/> | ||
| MSYS2 location: C:\msys64 | ||
| "@ | ||
|
|
||
| Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.