Skip to content

Commit 4958d0b

Browse files
committed
ci: extract installing mingw into a script
1 parent a0b37b0 commit 4958d0b

File tree

3 files changed

+51
-40
lines changed

3 files changed

+51
-40
lines changed

src/ci/azure-pipelines/steps/install-windows-build-deps.yml

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,4 @@
11
steps:
2-
# If we need to download a custom MinGW, do so here and set the path
3-
# appropriately.
4-
#
5-
# Here we also do a pretty heinous thing which is to mangle the MinGW
6-
# installation we just downloaded. Currently, as of this writing, we're using
7-
# MinGW-w64 builds of gcc, and that's currently at 6.3.0. We use 6.3.0 as it
8-
# appears to be the first version which contains a fix for #40546, builds
9-
# randomly failing during LLVM due to ar.exe/ranlib.exe failures.
10-
#
11-
# Unfortunately, though, 6.3.0 *also* is the first version of MinGW-w64 builds
12-
# to contain a regression in gdb (#40184). As a result if we were to use the
13-
# gdb provided (7.11.1) then we would fail all debuginfo tests.
14-
#
15-
# In order to fix spurious failures (pretty high priority) we use 6.3.0. To
16-
# avoid disabling gdb tests we download an *old* version of gdb, specifically
17-
# that found inside the 6.2.0 distribution. We then overwrite the 6.3.0 gdb
18-
# with the 6.2.0 gdb to get tests passing.
19-
#
20-
# Note that we don't literally overwrite the gdb.exe binary because it appears
21-
# to just use gdborig.exe, so that's the binary we deal with instead.
22-
- bash: |
23-
set -e
24-
curl -o mingw.7z $MINGW_URL/$MINGW_ARCHIVE
25-
7z x -y mingw.7z > /dev/null
26-
curl -o $MINGW_DIR/bin/gdborig.exe $MINGW_URL/2017-04-20-${MSYS_BITS}bit-gdborig.exe
27-
echo "##vso[task.prependpath]`pwd`/$MINGW_DIR/bin"
28-
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['MINGW_URL'],''))
29-
displayName: Download custom MinGW
30-
31-
# Otherwise install MinGW through `pacman`
32-
- bash: |
33-
set -e
34-
arch=i686
35-
if [ "$MSYS_BITS" = "64" ]; then
36-
arch=x86_64
37-
fi
38-
pacman -S --noconfirm --needed mingw-w64-$arch-toolchain mingw-w64-$arch-cmake mingw-w64-$arch-gcc mingw-w64-$arch-python2
39-
echo "##vso[task.prependpath]$(System.Workfolder)/msys2/mingw$MSYS_BITS/bin"
40-
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
41-
displayName: Download standard MinGW
422

433
# Note that this is originally from the github releases patch of Ninja
444
- bash: |

src/ci/azure-pipelines/steps/run.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ steps:
9898
displayName: Install msys2
9999
condition: and(succeeded(), not(variables.SKIP_JOB))
100100

101+
- bash: src/ci/scripts/install-mingw.sh
102+
env:
103+
AGENT_OS: $(Agent.OS)
104+
SYSTEM_WORKFOLDER: $(System.Workfolder)
105+
displayName: Install MinGW
106+
condition: and(succeeded(), not(variables.SKIP_JOB))
107+
101108
- template: install-windows-build-deps.yml
102109

103110
# Looks like docker containers have IPv6 disabled by default, so let's turn it

src/ci/scripts/install-mingw.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
# If we need to download a custom MinGW, do so here and set the path
3+
# appropriately.
4+
#
5+
# Here we also do a pretty heinous thing which is to mangle the MinGW
6+
# installation we just downloaded. Currently, as of this writing, we're using
7+
# MinGW-w64 builds of gcc, and that's currently at 6.3.0. We use 6.3.0 as it
8+
# appears to be the first version which contains a fix for #40546, builds
9+
# randomly failing during LLVM due to ar.exe/ranlib.exe failures.
10+
#
11+
# Unfortunately, though, 6.3.0 *also* is the first version of MinGW-w64 builds
12+
# to contain a regression in gdb (#40184). As a result if we were to use the
13+
# gdb provided (7.11.1) then we would fail all debuginfo tests.
14+
#
15+
# In order to fix spurious failures (pretty high priority) we use 6.3.0. To
16+
# avoid disabling gdb tests we download an *old* version of gdb, specifically
17+
# that found inside the 6.2.0 distribution. We then overwrite the 6.3.0 gdb
18+
# with the 6.2.0 gdb to get tests passing.
19+
#
20+
# Note that we don't literally overwrite the gdb.exe binary because it appears
21+
# to just use gdborig.exe, so that's the binary we deal with instead.
22+
#
23+
# Otherwise install MinGW through `pacman`
24+
25+
set -euo pipefail
26+
IFS=$'\n\t'
27+
28+
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
29+
30+
if isWindows; then
31+
if [[ -z "${MINGW_URL+x}" ]]; then
32+
curl -o mingw.7z "${MINGW_URL}/${MINGW_ARCHIVE}"
33+
7z x -y mingw.7z > /dev/null
34+
curl -o "${MINGW_DIR}/bin/gdborig.exe" "${MINGW_URL}/2017-04-20-${MSYS_BITS}bit-gdborig.exe"
35+
ciCommandAddPath "$(pwd)/${MINGW_DIR}/bin"
36+
else
37+
arch=i686
38+
if [ "$MSYS_BITS" = "64" ]; then
39+
arch=x86_64
40+
fi
41+
pacman -S --noconfirm --needed mingw-w64-$arch-toolchain mingw-w64-$arch-cmake mingw-w64-$arch-gcc mingw-w64-$arch-python2
42+
ciCommandAddPath "${SYSTEM_WORKFOLDER}/msys2/mingw${MSYS_BITS}/bin"
43+
fi
44+
fi

0 commit comments

Comments
 (0)