1bf215546Sopenharmony_ci#!/bin/bash 2bf215546Sopenharmony_ci# The relative paths in this file only become valid at runtime. 3bf215546Sopenharmony_ci# shellcheck disable=SC1091 4bf215546Sopenharmony_ci 5bf215546Sopenharmony_ciset -e 6bf215546Sopenharmony_ciset -o xtrace 7bf215546Sopenharmony_ci 8bf215546Sopenharmony_ciexport DEBIAN_FRONTEND=noninteractive 9bf215546Sopenharmony_ci 10bf215546Sopenharmony_ci# Ephemeral packages (installed for this script and removed again at the end) 11bf215546Sopenharmony_ciSTABLE_EPHEMERAL=" \ 12bf215546Sopenharmony_ci ccache \ 13bf215546Sopenharmony_ci cmake \ 14bf215546Sopenharmony_ci g++ \ 15bf215546Sopenharmony_ci g++-mingw-w64-i686-posix \ 16bf215546Sopenharmony_ci g++-mingw-w64-x86-64-posix \ 17bf215546Sopenharmony_ci glslang-tools \ 18bf215546Sopenharmony_ci libexpat1-dev \ 19bf215546Sopenharmony_ci gnupg2 \ 20bf215546Sopenharmony_ci libgbm-dev \ 21bf215546Sopenharmony_ci libgles2-mesa-dev \ 22bf215546Sopenharmony_ci liblz4-dev \ 23bf215546Sopenharmony_ci libpciaccess-dev \ 24bf215546Sopenharmony_ci libudev-dev \ 25bf215546Sopenharmony_ci libvulkan-dev \ 26bf215546Sopenharmony_ci libwaffle-dev \ 27bf215546Sopenharmony_ci libx11-xcb-dev \ 28bf215546Sopenharmony_ci libxcb-ewmh-dev \ 29bf215546Sopenharmony_ci libxcb-keysyms1-dev \ 30bf215546Sopenharmony_ci libxkbcommon-dev \ 31bf215546Sopenharmony_ci libxrandr-dev \ 32bf215546Sopenharmony_ci libxrender-dev \ 33bf215546Sopenharmony_ci libzstd-dev \ 34bf215546Sopenharmony_ci meson \ 35bf215546Sopenharmony_ci mingw-w64-i686-dev \ 36bf215546Sopenharmony_ci mingw-w64-tools \ 37bf215546Sopenharmony_ci mingw-w64-x86-64-dev \ 38bf215546Sopenharmony_ci p7zip \ 39bf215546Sopenharmony_ci patch \ 40bf215546Sopenharmony_ci pkg-config \ 41bf215546Sopenharmony_ci python3-dev \ 42bf215546Sopenharmony_ci python3-distutils \ 43bf215546Sopenharmony_ci python3-pip \ 44bf215546Sopenharmony_ci python3-setuptools \ 45bf215546Sopenharmony_ci python3-wheel \ 46bf215546Sopenharmony_ci software-properties-common \ 47bf215546Sopenharmony_ci wget \ 48bf215546Sopenharmony_ci wine64-tools \ 49bf215546Sopenharmony_ci xz-utils \ 50bf215546Sopenharmony_ci " 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_ciapt-get install -y --no-remove \ 53bf215546Sopenharmony_ci $STABLE_EPHEMERAL \ 54bf215546Sopenharmony_ci libxcb-shm0 \ 55bf215546Sopenharmony_ci pciutils \ 56bf215546Sopenharmony_ci python3-lxml \ 57bf215546Sopenharmony_ci python3-simplejson \ 58bf215546Sopenharmony_ci xinit \ 59bf215546Sopenharmony_ci xserver-xorg-video-amdgpu \ 60bf215546Sopenharmony_ci xserver-xorg-video-ati 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ci# We need multiarch for Wine 63bf215546Sopenharmony_cidpkg --add-architecture i386 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci# Install a more recent version of Wine than exists in Debian. 66bf215546Sopenharmony_ciapt-key add .gitlab-ci/container/debian/winehq.gpg.key 67bf215546Sopenharmony_ciapt-add-repository https://dl.winehq.org/wine-builds/debian/ 68bf215546Sopenharmony_ciapt update -qyy 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_ci# Needed for Valve's tracing jobs to collect information about the graphics 71bf215546Sopenharmony_ci# hardware on the test devices. 72bf215546Sopenharmony_cipip3 install gfxinfo-mupuf==0.0.9 73bf215546Sopenharmony_ci 74bf215546Sopenharmony_ciapt install -y --no-remove --install-recommends winehq-stable 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_cifunction setup_wine() { 77bf215546Sopenharmony_ci export WINEDEBUG="-all" 78bf215546Sopenharmony_ci export WINEPREFIX="$1" 79bf215546Sopenharmony_ci 80bf215546Sopenharmony_ci # We don't want crash dialogs 81bf215546Sopenharmony_ci cat >crashdialog.reg <<EOF 82bf215546Sopenharmony_ciWindows Registry Editor Version 5.00 83bf215546Sopenharmony_ci 84bf215546Sopenharmony_ci[HKEY_CURRENT_USER\Software\Wine\WineDbg] 85bf215546Sopenharmony_ci"ShowCrashDialog"=dword:00000000 86bf215546Sopenharmony_ci 87bf215546Sopenharmony_ciEOF 88bf215546Sopenharmony_ci 89bf215546Sopenharmony_ci # Set the wine prefix and disable the crash dialog 90bf215546Sopenharmony_ci wine regedit crashdialog.reg 91bf215546Sopenharmony_ci rm crashdialog.reg 92bf215546Sopenharmony_ci 93bf215546Sopenharmony_ci # An immediate wine command may fail with: "${WINEPREFIX}: Not a 94bf215546Sopenharmony_ci # valid wine prefix." and that is just spit because of checking 95bf215546Sopenharmony_ci # the existance of the system.reg file, which fails. Just giving 96bf215546Sopenharmony_ci # it a bit more of time for it to be created solves the problem 97bf215546Sopenharmony_ci # ... 98bf215546Sopenharmony_ci while ! test -f "${WINEPREFIX}/system.reg"; do sleep 1; done 99bf215546Sopenharmony_ci} 100bf215546Sopenharmony_ci 101bf215546Sopenharmony_ci############### Install DXVK 102bf215546Sopenharmony_ci 103bf215546Sopenharmony_cidxvk_install_release() { 104bf215546Sopenharmony_ci local DXVK_VERSION=${1:-"1.10.1"} 105bf215546Sopenharmony_ci 106bf215546Sopenharmony_ci wget "https://github.com/doitsujin/dxvk/releases/download/v${DXVK_VERSION}/dxvk-${DXVK_VERSION}.tar.gz" 107bf215546Sopenharmony_ci tar xzpf dxvk-"${DXVK_VERSION}".tar.gz 108bf215546Sopenharmony_ci "dxvk-${DXVK_VERSION}"/setup_dxvk.sh install 109bf215546Sopenharmony_ci rm -rf "dxvk-${DXVK_VERSION}" 110bf215546Sopenharmony_ci rm dxvk-"${DXVK_VERSION}".tar.gz 111bf215546Sopenharmony_ci} 112bf215546Sopenharmony_ci 113bf215546Sopenharmony_ci# Install from a Github PR number 114bf215546Sopenharmony_cidxvk_install_pr() { 115bf215546Sopenharmony_ci local __prnum=$1 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci # NOTE: Clone all the ensite history of the repo so as not to think 118bf215546Sopenharmony_ci # harder about cloning just enough for 'git describe' to work. 'git 119bf215546Sopenharmony_ci # describe' is used by the dxvk build system to generate a 120bf215546Sopenharmony_ci # dxvk_version Meson variable, which is nice-to-have. 121bf215546Sopenharmony_ci git clone https://github.com/doitsujin/dxvk 122bf215546Sopenharmony_ci pushd dxvk 123bf215546Sopenharmony_ci git fetch origin pull/"$__prnum"/head:pr 124bf215546Sopenharmony_ci git checkout pr 125bf215546Sopenharmony_ci ./package-release.sh pr ../dxvk-build --no-package 126bf215546Sopenharmony_ci popd 127bf215546Sopenharmony_ci pushd ./dxvk-build/dxvk-pr 128bf215546Sopenharmony_ci ./setup_dxvk.sh install 129bf215546Sopenharmony_ci popd 130bf215546Sopenharmony_ci rm -rf ./dxvk-build ./dxvk 131bf215546Sopenharmony_ci} 132bf215546Sopenharmony_ci 133bf215546Sopenharmony_ci# Sets up the WINEPREFIX for the DXVK installation commands below. 134bf215546Sopenharmony_cisetup_wine "/dxvk-wine64" 135bf215546Sopenharmony_cidxvk_install_release "1.10.1" 136bf215546Sopenharmony_ci#dxvk_install_pr 2359 137bf215546Sopenharmony_ci 138bf215546Sopenharmony_ci############### Install apitrace binaries for wine 139bf215546Sopenharmony_ci 140bf215546Sopenharmony_ci. .gitlab-ci/container/install-wine-apitrace.sh 141bf215546Sopenharmony_ci# Add the apitrace path to the registry 142bf215546Sopenharmony_ciwine \ 143bf215546Sopenharmony_ci reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment" \ 144bf215546Sopenharmony_ci /v Path \ 145bf215546Sopenharmony_ci /t REG_EXPAND_SZ \ 146bf215546Sopenharmony_ci /d "C:\windows\system32;C:\windows;C:\windows\system32\wbem;Z:\apitrace-msvc-win64\bin" \ 147bf215546Sopenharmony_ci /f 148bf215546Sopenharmony_ci 149bf215546Sopenharmony_ci############### Building ... 150bf215546Sopenharmony_ci 151bf215546Sopenharmony_ci. .gitlab-ci/container/container_pre_build.sh 152bf215546Sopenharmony_ci 153bf215546Sopenharmony_ci############### Build libdrm 154bf215546Sopenharmony_ci 155bf215546Sopenharmony_ci. .gitlab-ci/container/build-libdrm.sh 156bf215546Sopenharmony_ci 157bf215546Sopenharmony_ci############### Build Wayland 158bf215546Sopenharmony_ci 159bf215546Sopenharmony_ci. .gitlab-ci/container/build-wayland.sh 160bf215546Sopenharmony_ci 161bf215546Sopenharmony_ci############### Build parallel-deqp-runner's hang-detection tool 162bf215546Sopenharmony_ci 163bf215546Sopenharmony_ci. .gitlab-ci/container/build-hang-detection.sh 164bf215546Sopenharmony_ci 165bf215546Sopenharmony_ci############### Build piglit 166bf215546Sopenharmony_ci 167bf215546Sopenharmony_ciPIGLIT_BUILD_TARGETS="piglit_replayer" . .gitlab-ci/container/build-piglit.sh 168bf215546Sopenharmony_ci 169bf215546Sopenharmony_ci############### Build Fossilize 170bf215546Sopenharmony_ci 171bf215546Sopenharmony_ci. .gitlab-ci/container/build-fossilize.sh 172bf215546Sopenharmony_ci 173bf215546Sopenharmony_ci############### Build dEQP VK 174bf215546Sopenharmony_ci 175bf215546Sopenharmony_ci. .gitlab-ci/container/build-deqp.sh 176bf215546Sopenharmony_ci 177bf215546Sopenharmony_ci############### Build apitrace 178bf215546Sopenharmony_ci 179bf215546Sopenharmony_ci. .gitlab-ci/container/build-apitrace.sh 180bf215546Sopenharmony_ci 181bf215546Sopenharmony_ci############### Build gfxreconstruct 182bf215546Sopenharmony_ci 183bf215546Sopenharmony_ci. .gitlab-ci/container/build-gfxreconstruct.sh 184bf215546Sopenharmony_ci 185bf215546Sopenharmony_ci############### Build VKD3D-Proton 186bf215546Sopenharmony_ci 187bf215546Sopenharmony_cisetup_wine "/vkd3d-proton-wine64" 188bf215546Sopenharmony_ci 189bf215546Sopenharmony_ci. .gitlab-ci/container/build-vkd3d-proton.sh 190bf215546Sopenharmony_ci 191bf215546Sopenharmony_ci############### Uninstall the build software 192bf215546Sopenharmony_ci 193bf215546Sopenharmony_ciccache --show-stats 194bf215546Sopenharmony_ci 195bf215546Sopenharmony_ciapt-get purge -y \ 196bf215546Sopenharmony_ci $STABLE_EPHEMERAL 197bf215546Sopenharmony_ci 198bf215546Sopenharmony_ciapt-get autoremove -y --purge 199