[Windows] Refactor Msys2 installation to use toolset part 1 (#3487)

* Refactor Msys2 installation to use toolset

* fix indent in the toolset files

* Resolve nitpicks

* Remove typo (extra $)
This commit is contained in:
Mikhail Timofeev
2021-06-02 13:08:05 +03:00
committed by GitHub
parent 62046bdeb9
commit 4d72ed1fd9
5 changed files with 174 additions and 21 deletions

View File

@@ -52,41 +52,42 @@ Write-Host "`n$dash pacman --noconfirm -Syuu (2nd pass)"
pacman.exe -Syuu --noconfirm pacman.exe -Syuu --noconfirm
taskkill /f /fi "MODULES eq msys-2.0.dll" taskkill /f /fi "MODULES eq msys-2.0.dll"
$toolsetContent = (Get-ToolsetContent).MsysPackages
Write-Host "`n$dash Install msys2 packages" Write-Host "`n$dash Install msys2 packages"
pacman.exe -S --noconfirm --needed --noprogressbar base-devel compression $msys2Packages = $toolsetContent.msys2
pacman.exe -S --noconfirm --needed --noprogressbar $msys2Packages
taskkill /f /fi "MODULES eq msys-2.0.dll" taskkill /f /fi "MODULES eq msys-2.0.dll"
Write-Host "`n$dash Remove p7zip/7z package due to conflicts" Write-Host "`n$dash Remove p7zip/7z package due to conflicts"
pacman.exe -R --noconfirm --noprogressbar p7zip pacman.exe -R --noconfirm --noprogressbar p7zip
# mingw package list # install mingw packages
# libxml2 can be removed from the list after the issue is fixed https://github.com/msys2/MINGW-packages/issues/8658 $archs = $toolsetContent.mingw.arch
$tools64 = "___clang ___clang-tools-extra ___cmake ___libxml2 ___llvm ___toolchain ___ragel" foreach ($arch in $archs)
$tools32 = "___clang ___cmake ___libxml2 ___llvm ___toolchain ___ragel" {
Write-Host "Installing $arch packages"
# install mingw64 packages $archPackages = $toolsetContent.mingw | Where-Object { $_.arch -eq $arch }
Write-Host "`n$dash Install mingw64 packages" $runtimePackages = $archPackages.runtime_packages.name | ForEach-Object { "${arch}-$_" }
$pre = "mingw-w64-x86_64-" $additionalPackages = $archPackages.additional_packages | ForEach-Object { "${arch}-$_" }
pacman.exe -S --noconfirm --needed --noprogressbar $tools64.replace('___', $pre).split(' ') $packagesToInstall = $runtimePackages + $additionalPackages
Write-Host "The following packages will be installed: $packagesToInstall"
# install mingw32 packages pacman.exe -S --noconfirm --needed --noprogressbar $packagesToInstall
Write-Host "`n$dash Install mingw32 packages" }
$pre = "mingw-w64-i686-"
pacman.exe -S --noconfirm --needed --noprogressbar $tools32.replace('___', $pre).split(' ')
# clean all packages to decrease image size # clean all packages to decrease image size
Write-Host "`n$dash Clean packages" Write-Host "`n$dash Clean packages"
pacman.exe -Scc --noconfirm pacman.exe -Scc --noconfirm
Write-Host "`n$dash Installed mingw64 packages"
pacman.exe -Q | grep ^mingw-w64-x86_64-
Write-Host "`n$dash Installed mingw32 packages"
pacman.exe -Q | grep ^mingw-w64-i686-
Write-Host "`n$dash Installed msys2 packages" Write-Host "`n$dash Installed msys2 packages"
pacman.exe -Q | grep -v ^mingw-w64- pacman.exe -Q | grep -v ^mingw-w64-
foreach ($arch in $archs)
{
Write-Host "`n$dash Installed $arch packages"
pacman.exe -Q | grep ^${arch}-
}
Write-Host "`nMSYS2 installation completed" Write-Host "`nMSYS2 installation completed"
Invoke-PesterTests -TestFile "MSYS2" Invoke-PesterTests -TestFile "MSYS2"

View File

@@ -173,6 +173,79 @@
"latest": "22" "latest": "22"
} }
}, },
"MsysPackages": {
"msys2": [
"base-devel",
"compression"
],
"mingw": [
{
"arch": "mingw-w64-x86_64",
"runtime_packages": [
{
"name": "clang",
"executables": [
"clang",
"g++",
"gcc"
]
},
{
"name": "cmake",
"executables": [
"cmake",
"cpack",
"ctest"
]
},
{
"name": "ragel",
"executables": [
"ragel"
]
}
],
"additional_packages": [
"clang-tools-extra",
"libxml2",
"llvm",
"toolchain"
]
},
{
"arch": "mingw-w64-i686",
"runtime_packages": [
{
"name": "clang",
"executables": [
"clang",
"g++",
"gcc"
]
},
{
"name": "cmake",
"executables": [
"cmake",
"cpack",
"ctest"
]
},
{
"name": "ragel",
"executables": [
"ragel"
]
}
],
"additional_packages": [
"libxml2",
"llvm",
"toolchain"
]
}
]
},
"visualStudio": { "visualStudio": {
"version" : "2017", "version" : "2017",
"subversion" : "15", "subversion" : "15",

View File

@@ -173,6 +173,79 @@
"latest": "22" "latest": "22"
} }
}, },
"MsysPackages": {
"msys2": [
"base-devel",
"compression"
],
"mingw": [
{
"arch": "mingw-w64-x86_64",
"runtime_packages": [
{
"name": "clang",
"executables": [
"clang",
"g++",
"gcc"
]
},
{
"name": "cmake",
"executables": [
"cmake",
"cpack",
"ctest"
]
},
{
"name": "ragel",
"executables": [
"ragel"
]
}
],
"additional_packages": [
"clang-tools-extra",
"libxml2",
"llvm",
"toolchain"
]
},
{
"arch": "mingw-w64-i686",
"runtime_packages": [
{
"name": "clang",
"executables": [
"clang",
"g++",
"gcc"
]
},
{
"name": "cmake",
"executables": [
"cmake",
"cpack",
"ctest"
]
},
{
"name": "ragel",
"executables": [
"ragel"
]
}
],
"additional_packages": [
"libxml2",
"llvm",
"toolchain"
]
}
]
},
"visualStudio": { "visualStudio": {
"version" : "2019", "version" : "2019",
"subversion" : "16", "subversion" : "16",

View File

@@ -299,6 +299,9 @@
}, },
{ {
"type": "powershell", "type": "powershell",
"environment_vars": [
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}"
],
"elevated_user": "SYSTEM", "elevated_user": "SYSTEM",
"elevated_password": "", "elevated_password": "",
"scripts": [ "scripts": [

View File

@@ -270,6 +270,9 @@
}, },
{ {
"type": "powershell", "type": "powershell",
"environment_vars": [
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}"
],
"elevated_user": "SYSTEM", "elevated_user": "SYSTEM",
"elevated_password": "", "elevated_password": "",
"scripts": [ "scripts": [