1#!/bin/bash
2
3set -e
4set -o xtrace
5
6export DEBIAN_FRONTEND=noninteractive
7
8# Ephemeral packages (installed for this script and removed again at the end)
9STABLE_EPHEMERAL=" \
10      ccache \
11      cmake \
12      g++ \
13      libgbm-dev \
14      libgles2-mesa-dev \
15      liblz4-dev \
16      libpng-dev \
17      libvulkan-dev \
18      libxcb-ewmh-dev \
19      libxkbcommon-dev \
20      libxrandr-dev \
21      libxrender-dev \
22      libzstd-dev \
23      meson \
24      p7zip \
25      pkg-config \
26      python3-distutils \
27      wget \
28      "
29
30# Unfortunately, gfxreconstruct needs the -dev packages:
31# https://github.com/LunarG/gfxreconstruct/issues/402
32apt-get install -y --no-remove \
33      libwayland-dev \
34      libx11-xcb-dev \
35      libxcb-keysyms1-dev \
36      libxcb1-dev \
37      $STABLE_EPHEMERAL
38
39# We need multiarch for Wine
40dpkg --add-architecture i386
41
42apt-get update
43
44apt-get install -y --no-remove \
45      wine \
46      wine32 \
47      wine64
48
49
50############### Set up Wine env variables
51
52export WINEDEBUG="-all"
53export WINEPREFIX="/dxvk-wine64"
54
55############### Install DXVK
56
57DXVK_VERSION="1.6"
58
59# We don't want crash dialogs
60cat >crashdialog.reg <<EOF
61Windows Registry Editor Version 5.00
62
63[HKEY_CURRENT_USER\Software\Wine\WineDbg]
64"ShowCrashDialog"=dword:00000000
65
66EOF
67
68# Set the wine prefix and disable the crash dialog
69wine regedit crashdialog.reg
70rm crashdialog.reg
71
72# DXVK's setup often fails with:
73# "${WINEPREFIX}: Not a valid wine prefix."
74# and that is just spit because of checking the existance of the
75# system.reg file, which fails.
76# Just giving it a bit more of time for it to be created solves the
77# problem ...
78test -f  "${WINEPREFIX}/system.reg" || sleep 2
79
80wget "https://github.com/doitsujin/dxvk/releases/download/v${DXVK_VERSION}/dxvk-${DXVK_VERSION}.tar.gz"
81tar xzpf dxvk-"${DXVK_VERSION}".tar.gz
82dxvk-"${DXVK_VERSION}"/setup_dxvk.sh install
83rm -rf dxvk-"${DXVK_VERSION}"
84rm dxvk-"${DXVK_VERSION}".tar.gz
85
86############### Install Windows' apitrace binaries
87
88APITRACE_VERSION="9.0"
89APITRACE_VERSION_DATE="20191126"
90
91wget "https://github.com/apitrace/apitrace/releases/download/${APITRACE_VERSION}/apitrace-${APITRACE_VERSION}.${APITRACE_VERSION_DATE}-win64.7z"
927zr x "apitrace-${APITRACE_VERSION}.${APITRACE_VERSION_DATE}-win64.7z" \
93      "apitrace-${APITRACE_VERSION}.${APITRACE_VERSION_DATE}-win64/bin/apitrace.exe" \
94      "apitrace-${APITRACE_VERSION}.${APITRACE_VERSION_DATE}-win64/bin/d3dretrace.exe"
95mv "apitrace-${APITRACE_VERSION}.${APITRACE_VERSION_DATE}-win64" /apitrace-msvc-win64
96rm "apitrace-${APITRACE_VERSION}.${APITRACE_VERSION_DATE}-win64.7z"
97
98# Add the apitrace path to the registry
99wine \
100    reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment" \
101    /v Path \
102    /t REG_EXPAND_SZ \
103    /d "C:\windows\system32;C:\windows;C:\windows\system32\wbem;Z:\apitrace-msvc-win64\bin" \
104    /f
105
106############### Building ...
107
108. .gitlab-ci/container/container_pre_build.sh
109
110############### Build dEQP runner (and install rust temporarily for it)
111. .gitlab-ci/build-rust.sh
112. .gitlab-ci/build-deqp-runner.sh
113rm -rf /root/.rustup /root/.cargo
114
115############### Build Fossilize
116
117. .gitlab-ci/build-fossilize.sh
118
119############### Build dEQP VK
120. .gitlab-ci/build-deqp.sh
121
122############### Build gfxreconstruct
123
124. .gitlab-ci/build-gfxreconstruct.sh
125
126############### Build VulkanTools
127
128. .gitlab-ci/build-vulkantools.sh
129
130############### Uninstall the build software
131
132ccache --show-stats
133
134apt-get purge -y \
135      $STABLE_EPHEMERAL
136
137apt-get autoremove -y --purge
138