|
1 | 1 | #!/bin/bash |
2 | 2 | # Download and install MSYS2, needed primarily for the test suite (run-make) but |
3 | 3 | # also used by the MinGW toolchain for assembling things. |
4 | | -# |
5 | | -# FIXME: we should probe the default azure image and see if we can use the MSYS2 |
6 | | -# toolchain there. (if there's even one there). For now though this gets the job |
7 | | -# done. |
8 | 4 |
|
9 | 5 | set -euo pipefail |
10 | 6 | IFS=$'\n\t' |
11 | 7 |
|
12 | 8 | source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" |
13 | 9 |
|
14 | 10 | if isWindows; then |
15 | | - # Pre-followed the api/v2 URL to the CDN since the API can be a bit flakey |
16 | | - curl -sSL https://packages.chocolatey.org/msys2.20190524.0.0.20191030.nupkg > \ |
17 | | - msys2.nupkg |
18 | | - curl -sSL https://packages.chocolatey.org/chocolatey-core.extension.1.3.5.1.nupkg > \ |
19 | | - chocolatey-core.extension.nupkg |
20 | | - choco install -s . msys2 \ |
21 | | - --params="/InstallDir:$(ciCheckoutPath)/msys2 /NoPath" -y --no-progress |
22 | | - rm msys2.nupkg chocolatey-core.extension.nupkg |
23 | | - mkdir -p "$(ciCheckoutPath)/msys2/home/${USERNAME}" |
24 | | - ciCommandAddPath "$(ciCheckoutPath)/msys2/usr/bin" |
| 11 | + msys2Path="c:/msys64" |
| 12 | + mkdir -p "${msys2Path}/home/${USERNAME}" |
| 13 | + ciCommandAddPath "${msys2Path}/usr/bin" |
25 | 14 |
|
26 | 15 | echo "switching shell to use our own bash" |
27 | | - ciCommandSetEnv CI_OVERRIDE_SHELL "$(ciCheckoutPath)/msys2/usr/bin/bash.exe" |
| 16 | + ciCommandSetEnv CI_OVERRIDE_SHELL "${msys2Path}/usr/bin/bash.exe" |
| 17 | + |
| 18 | + # Detect the native Python version installed on the agent. On GitHub |
| 19 | + # Actions, the C:\hostedtoolcache\windows\Python directory contains a |
| 20 | + # subdirectory for each installed Python version. |
| 21 | + # |
| 22 | + # The -V flag of the sort command sorts the input by version number. |
| 23 | + native_python_version="$(ls /c/hostedtoolcache/windows/Python | sort -Vr | head -n 1)" |
| 24 | + |
| 25 | + # Make sure we use the native python interpreter instead of some msys equivalent |
| 26 | + # one way or another. The msys interpreters seem to have weird path conversions |
| 27 | + # baked in which break LLVM's build system one way or another, so let's use the |
| 28 | + # native version which keeps everything as native as possible. |
| 29 | + python_home="/c/hostedtoolcache/windows/Python/${native_python_version}/x64" |
| 30 | + cp "${python_home}/python.exe" "${python_home}/python3.exe" |
| 31 | + ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64" |
| 32 | + ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64\\Scripts" |
28 | 33 | fi |
0 commit comments