]> git.lizzy.rs Git - rust.git/blobdiff - src/ci/scripts/install-mingw.sh
ci: remove the MSYS_BITS env var
[rust.git] / src / ci / scripts / install-mingw.sh
index cf3e3e7ec258c89560786b505f3d4f041b6164f4..8b579587b9e1f6ffc255468833fa02eeaf33ecc3 100755 (executable)
@@ -27,18 +27,38 @@ IFS=$'\n\t'
 
 source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
 
+MINGW_ARCHIVE_32="i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z"
+MINGW_ARCHIVE_64="x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z"
+
 if isWindows; then
-    if [[ -z "${MINGW_URL+x}" ]]; then
-        curl -o mingw.7z "${MINGW_URL}/${MINGW_ARCHIVE}"
-        7z x -y mingw.7z > /dev/null
-        curl -o "${MINGW_DIR}/bin/gdborig.exe" "${MINGW_URL}/2017-04-20-${MSYS_BITS}bit-gdborig.exe"
-        ciCommandAddPath "$(pwd)/${MINGW_DIR}/bin"
+    case "${CI_JOB_NAME}" in
+        *i686*)
+            bits=32
+            arch=i686
+            mingw_archive="${MINGW_ARCHIVE_32}"
+            ;;
+        *x86_64*)
+            bits=64
+            arch=x86_64
+            mingw_archive="${MINGW_ARCHIVE_64}"
+            ;;
+        *)
+            echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
+            echo "please tweak it to recognize the builder named '${CI_JOB_NAME}'"
+            exit 1
+            ;;
+    esac
+
+    if [[ "${CUSTOM_MINGW-0}" -ne 1 ]]; then
+        pacman -S --noconfirm --needed mingw-w64-$arch-toolchain mingw-w64-$arch-cmake \
+            mingw-w64-$arch-gcc mingw-w64-$arch-python2
+        ciCommandAddPath "${SYSTEM_WORKFOLDER}/msys2/mingw${bits}/bin"
     else
-        arch=i686
-        if [ "$MSYS_BITS" = "64" ]; then
-          arch=x86_64
-        fi
-        pacman -S --noconfirm --needed mingw-w64-$arch-toolchain mingw-w64-$arch-cmake mingw-w64-$arch-gcc mingw-w64-$arch-python2
-        ciCommandAddPath "${SYSTEM_WORKFOLDER}/msys2/mingw${MSYS_BITS}/bin"
+        mingw_dir="mingw${bits}"
+
+        curl -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
+        7z x -y mingw.7z > /dev/null
+        curl -o "${mingw_dir}/bin/gdborig.exe" "${MIRRORS_BASE}/2017-04-20-${bits}bit-gdborig.exe"
+        ciCommandAddPath "$(pwd)/${mingw_dir}/bin"
     fi
 fi