| 1 |
# escape=` |
| 2 |
|
| 3 |
FROM 'mcr.microsoft.com/windows/servercore:ltsc2022' |
| 4 |
|
| 5 |
# Make sure any failure in PowerShell scripts is fatal |
| 6 |
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] |
| 7 |
ENV ErrorActionPreference='Stop' |
| 8 |
|
| 9 |
# Install Chocolatey |
| 10 |
RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) |
| 11 |
# Install required packages |
| 12 |
RUN choco install -y vcredist140 |
| 13 |
RUN choco install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' |
| 14 |
RUN choco install -y git --params '/NoAutoCrlf /NoCredentialManager /NoShellHereIntegration /NoGuiHereIntegration /NoShellIntegration' |
| 15 |
RUN choco install -y windows-sdk-8.1 |
| 16 |
RUN choco install -y python3 |
| 17 |
RUN choco install -y msys2 --params '/NoPath /NoUpdate /InstallDir:C:\\msys64' |
| 18 |
|
| 19 |
RUN 'git config --global user.email "[email protected]"; git config --global user.name "D-Bus CI system"' |
| 20 |
|
| 21 |
RUN pip3 install meson |
| 22 |
# FIXME: Python fails to validate SSL certificates, for unclear reasons |
| 23 |
# try various ways to update the store, certifi-win32 seems to work as long as we fetch before |
| 24 |
# See also: https://bugs.python.org/issue36011 |
| 25 |
RUN pip3 install --upgrade certifi |
| 26 |
RUN pip3 install python-certifi-win32 |
| 27 |
RUN (New-Object System.Net.WebClient).DownloadString('https://sourceforge.net/projects/pcre/files/pcre/8.37/pcre-8.37.tar.gz.sig') >$null |
| 28 |
RUN (New-Object System.Net.WebClient).DownloadString('https://wrapdb.mesonbuild.com/v2/pcre_8.37-2/get_patch') >$null |
| 29 |
RUN (New-Object System.Net.WebClient).DownloadString('https://zlib.net/fossils/') >$null |
| 30 |
|
| 31 |
# MinGW environment |
| 32 |
RUN c:\msys64\usr\bin\bash -lc 'pacman -S --noconfirm mingw-w64-ucrt-x86_64-toolchain expat glib2-devel ninja' |
| 33 |
|
| 34 |
# Visual Studio can't be installed with choco. |
| 35 |
# It depends on dotnetfx v4.8.0.20190930, which requires a reboot: dotnetfx (exit code 3010) |
| 36 |
# https://github.com/microsoft/vs-dockerfiles/blob/main/native-desktop/ |
| 37 |
# Set up environment to collect install errors. |
| 38 |
COPY Install.cmd C:\TEMP\ |
| 39 |
ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe |
| 40 |
# Download channel for fixed install. |
| 41 |
ARG CHANNEL_URL=https://aka.ms/vs/15/release/channel |
| 42 |
ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman |
| 43 |
# Download and install Build Tools for Visual Studio 2017 for native desktop workload. |
| 44 |
ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe |
| 45 |
RUN C:\TEMP\Install.cmd C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache ` |
| 46 |
--channelUri C:\TEMP\VisualStudio.chman ` |
| 47 |
--installChannelUri C:\TEMP\VisualStudio.chman ` |
| 48 |
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended` |
| 49 |
--installPath C:\BuildTools |
| 50 |
|
| 51 |
# Upstream expat doesn't ship devel? let's build it then... |
| 52 |
# ADD https://github.com/libexpat/libexpat/releases/download/R_2_4_1/expat-win32bin-2.4.1.exe C:\TEMP\expat.exe |
| 53 |
# RUN C:\TEMP\expat.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- |
| 54 |
RUN git clone --depth 1 --branch R_2_4_2 https://github.com/libexpat/libexpat |
| 55 |
WORKDIR "/libexpat/expat" |
| 56 |
RUN cmake --install-prefix c:/ -G '"Visual Studio 15 2017 Win64"' . |
| 57 |
RUN cmake --build . --config Release |
| 58 |
RUN cmake --install . --config Release |
| 59 |
|
| 60 |
# Build glib for MSVC |
| 61 |
RUN git clone --depth 1 --branch 2.70.2 https://gitlab.gnome.org/GNOME/glib.git \glib |
| 62 |
WORKDIR "/glib" |
| 63 |
RUN cmd /c 'C:\BuildTools\Common7\Tools\VsDevCmd.bat -arch=amd64 & meson setup builddir' |
| 64 |
RUN meson compile -C builddir |
| 65 |
RUN meson install --no-rebuild -C builddir |