about summary refs log tree commit diff
path: root/src/ci/scripts
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2019-10-07 18:48:50 +0200
committerPietro Albini <pietro@pietroalbini.org>2019-10-25 16:08:27 +0200
commit852dfd7a17bffadfd79f323d3291808dd10c854e (patch)
tree18f6f0d58c37c6099bb73bea1159e4979c3bd4df /src/ci/scripts
parente0b1b3bbc1c796e3a35a723e875ec82c8ad371c0 (diff)
downloadrust-852dfd7a17bffadfd79f323d3291808dd10c854e.tar.gz
rust-852dfd7a17bffadfd79f323d3291808dd10c854e.zip
ci: extract installing msys2 into a script
Diffstat (limited to 'src/ci/scripts')
-rwxr-xr-xsrc/ci/scripts/install-msys2.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/ci/scripts/install-msys2.sh b/src/ci/scripts/install-msys2.sh
new file mode 100755
index 00000000000..bfd3f2c1edb
--- /dev/null
+++ b/src/ci/scripts/install-msys2.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# Download and install MSYS2, needed primarily for the test suite (run-make) but
+# also used by the MinGW toolchain for assembling things.
+#
+# FIXME: we should probe the default azure image and see if we can use the MSYS2
+# toolchain there. (if there's even one there). For now though this gets the job
+# done.
+
+set -euo pipefail
+IFS=$'\n\t'
+
+source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
+
+if isWindows; then
+    # FIXME(#65767): workaround msys bug, step 1
+    arch=i686
+    if [ "$MSYS_BITS" = "64" ]; then
+      arch=x86_64
+    fi
+    curl -O "${MIRRORS_BASE}/msys2-repo/mingw/$arch/mingw-w64-$arch-ca-certificates-20180409-1-any.pkg.tar.xz"
+
+    choco install msys2 --params="/InstallDir:${SYSTEM_WORKFOLDER}/msys2 /NoPath" -y --no-progress
+    mkdir -p "${SYSTEM_WORKFOLDER}/msys2/home/${USERNAME}"
+
+    ciCommandAddPath "${SYSTEM_WORKFOLDER}/msys2/usr/bin"
+    export PATH="${SYSTEM_WORKFOLDER}/msys2/usr/bin"
+
+    pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar
+
+    # FIXME(#65767): workaround msys bug, step 2
+    pacman -U --noconfirm --noprogressbar mingw-w64-$arch-ca-certificates-20180409-1-any.pkg.tar.xz
+    rm mingw-w64-$arch-ca-certificates-20180409-1-any.pkg.tar.xz
+
+    # Make sure we use the native python interpreter instead of some msys equivalent
+    # one way or another. The msys interpreters seem to have weird path conversions
+    # baked in which break LLVM's build system one way or another, so let's use the
+    # native version which keeps everything as native as possible.
+    cp C:/Python27amd64/python.exe C:/Python27amd64/python2.7.exe
+    ciCommandAddPath "C:\\Python27amd64"
+fi