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