]> git.lizzy.rs Git - rust.git/blob - .azure-pipelines/steps/install-windows-build-deps.yml
Refactor azure pipelines configuration
[rust.git] / .azure-pipelines / steps / install-windows-build-deps.yml
1 steps:
2 # FIXME: are these still needed?
3 # - bash: |
4 #     set -x
5 #     git submodule
6 #     export SUBMODULES_EXCLUDES=$(git submodule | grep -Eow 'src/[^ ]+' | sed 's/\(.*\)/--exclude=\1\/\.git/')
7 #     echo "##vso[task.setvariable variable=SUBMODULES_EXCLUDES;]$SUBMODULES_EXCLUDES"
8 #
9 # - script: |
10 #     REM echo hack as drive D is too small
11 #     IF NOT "%DISABLE_DISK_SPACE_HACK%"=="1" (
12 #       mkdir c:\MORE_SPACE
13 #       mklink /J build c:\MORE_SPACE
14 #     )
15
16 - script: |
17     set MSYS_PATH=%CD%\citools\msys64
18     choco install msys2 --params="/InstallDir:%MSYS_PATH% /NoPath" -y
19     set PATH=%MSYS_PATH%\usr\bin;%PATH%
20     pacman -S --noconfirm --needed base-devel ca-certificates make diffutils tar
21     IF "%MINGW_URL%"=="" (
22       IF "%MSYS_BITS%"=="32" pacman -S --noconfirm --needed mingw-w64-i686-toolchain mingw-w64-i686-cmake mingw-w64-i686-gcc mingw-w64-i686-python2
23       IF "%MSYS_BITS%"=="64" pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-python2
24     )
25     where rev
26     rev --help
27     where make
28
29     echo ##vso[task.setvariable variable=MSYS_PATH]%MSYS_PATH%
30     echo ##vso[task.prependpath]%MSYS_PATH%\usr\bin
31   displayName: Install msys2
32   condition: eq(variables['Agent.OS'], 'Windows_NT')
33
34 # If we need to download a custom MinGW, do so here and set the path
35 # appropriately.
36 #
37 # Note that this *also* means that we're not using what is typically
38 # /mingw32/bin/python2.7.exe, which is a "correct" python interpreter where
39 # /usr/bin/python2.7.exe is not. To ensure we use the right interpreter we
40 # move `C:\Python27` ahead in PATH and then also make sure the `python2.7.exe`
41 # file exists in there (which it doesn't by default).
42 - script: |
43     powershell -Command "iwr -outf %MINGW_ARCHIVE% %MINGW_URL%/%MINGW_ARCHIVE%"
44     7z x -y %MINGW_ARCHIVE% > nul
45     echo ##vso[task.prependpath]%CD%\%MINGW_DIR%\bin
46   condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['MINGW_URL'],''))
47   displayName: Download custom MinGW
48
49 # Here we do a pretty heinous thing which is to mangle the MinGW installation
50 # we just had above. Currently, as of this writing, we're using MinGW-w64
51 # builds of gcc, and that's currently at 6.3.0. We use 6.3.0 as it appears to
52 # be the first version which contains a fix for #40546, builds randomly
53 # failing during LLVM due to ar.exe/ranlib.exe failures.
54 #
55 # Unfortunately, though, 6.3.0 *also* is the first version of MinGW-w64 builds
56 # to contain a regression in gdb (#40184). As a result if we were to use the
57 # gdb provided (7.11.1) then we would fail all debuginfo tests.
58 #
59 # In order to fix spurious failures (pretty high priority) we use 6.3.0. To
60 # avoid disabling gdb tests we download an *old* version of gdb, specifically
61 # that found inside the 6.2.0 distribution. We then overwrite the 6.3.0 gdb
62 # with the 6.2.0 gdb to get tests passing.
63 #
64 # Note that we don't literally overwrite the gdb.exe binary because it appears
65 # to just use gdborig.exe, so that's the binary we deal with instead.
66 - script: |
67     echo ON
68     powershell -Command "iwr -outf 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_URL%/2017-04-20-%MSYS_BITS%bit-gdborig.exe"
69     mv 2017-04-20-%MSYS_BITS%bit-gdborig.exe %MINGW_DIR%\bin\gdborig.exe
70   condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['MINGW_URL'],''))
71   displayName: Override with 6.3.0 gdb with 6.2.0 gdb
72
73 # Otherwise pull in the MinGW installed on appveyor
74 - script: |
75     echo ##vso[task.prependpath]%MSYS_PATH%\mingw%MSYS_BITS%\bin
76   condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
77   displayName: Add MinGW to path
78
79 - script: |
80     copy C:\Python27amd64\python.exe C:\Python27amd64\python2.7.exe
81     echo ##vso[task.prependpath]C:\Python27amd64
82   displayName: Prefer the "native" Python as LLVM has trouble building with MSYS sometimes
83   condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
84
85 # Note that this is originally from the github releases patch of Ninja
86 - script: |
87     md ninja
88     powershell -Command "iwr -outf 2017-03-15-ninja-win.zip https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/2017-03-15-ninja-win.zip"
89     7z x -oninja 2017-03-15-ninja-win.zip
90     del 2017-03-15-ninja-win.zip
91     set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --enable-ninja
92     echo ##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]%RUST_CONFIGURE_ARGS%
93     echo ##vso[task.prependpath]%CD%\ninja
94   displayName: Download and install ninja
95   condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))