Mitigate hazardous boost::adaptors::reversed
[inkscape.git] / buildtools / windows-deps-part2.ps1
blobe2bc3300157e5f2125d51cfbe66f15edacaffd02
1 # SPDX-License-Identifier: GPL-v2-or-later
3 # Part of the Inkscape Windows dependency installation.
4 # For the main script, see windows-deps-clickHere.bat
5 #
6 # This script assumes to be started with Admin permissions.
9 $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
10 cd $scriptDir
13 echo "Part 2. Installing MSYS2"
14 winget install --accept-package-agreements --accept-source-agreements MSYS2.MSYS2
16 echo "Installing WiX v4 and DotNetSDK (for building MSI installer)"
17 & .\windows-deps-install-wix4.ps1
19 function RunInMsys {
20 # Run command in msys terminal window and wait for it to to finish
21 param (
22 # MSYS architecture: MSYS2 / UCRT64 / MINGW64
23 $msysArch,
24 # shell command to be run
25 $cmd
27 # Ensure no mintty.exe is running -- otherwise the check later will be stuck
28 while (Get-Process mintty -ErrorAction SilentlyContinue) {
29 Start-Sleep 1
30 echo "Please close all open MSYS terminals so that this script can continue."
33 echo "Running in MSYS $msysArch terminal: $cmd"
35 $cmd = $cmd + " && echo Ok. The window will close in 5 seconds. && sleep 5 || (echo Error. Press Enter to exit; read)"
36 &"C:\msys64\${msysArch}.exe" bash -c $cmd
37 # wait until mintty window has opened (dirty hack)
38 Start-Sleep 5
39 # Wait until mintty (terminal window) spawned by MSYS has finished
40 echo "Waiting until all MSYS tasks have finished..."
41 while (Get-Process mintty -ErrorAction SilentlyContinue) {
42 Start-Sleep 1
46 # call MSYS system upgrade repeatedly. If the dependencies were already installed before, then this will upgrade everything. Repeating is needed because sometimes MSYS doesn't upgrade everything at once.
47 Echo "Running MSYS system upgrade multiple times..."
48 For ($i=0; $i -lt 5; $i += 1)
50 RunInMsys "MSYS2" "pacman --noconfirm -Syuu"
53 # start msys2installdeps.sh
54 Echo "Installing Inkscape build dependencies"
55 RunInMsys "UCRT64" "./msys2installdeps.sh"
57 Write-Host ""
58 Write-Host ""
59 Write-Host ""
60 Write-Host "Everything is installed that you need to compile Inkscape." -ForegroundColor Green
61 Write-Host ""
62 Write-Host "Done :-) Press Enter to exit." -ForegroundColor Green
64 # Print some empty lines because Windows sometimes places the PS window such that the bottom is hidden by the taskbar.
65 For ($i=0; $i -lt 10; $i += 1)
67 echo ""
69 Read-Host