ci: Build a working wine installation in build-wine.sh.

The wine prefix is dropped from build-vkd3d-proton, where it's not needed
(no remaining references in the tree).  We do set up a /wineprefix (as a
more obvious name) in the wine installation, and include /usr/lib/*/wine
in test-vk container images and in a tarball uploaded as a LAVA rootfs
overlay.

With this, one should be able to run "wine" successfully.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40959>
This commit is contained in:
Emma Anholt 2026-03-19 12:53:40 -07:00 committed by Marge Bot
parent 61a41591d4
commit 0596569722
10 changed files with 92 additions and 42 deletions

View file

@ -5,3 +5,4 @@ variables:
CONDITIONAL_BUILD_FLUSTER_TAG: e13f8521875ebd70e207ec0f6f3d3e5b
CONDITIONAL_BUILD_PIGLIT_TAG: 7c554632e450496da9382764f449abae
CONDITIONAL_BUILD_VKD3D_PROTON_TAG: 3c680463034cc7273d9e98393861c61c
CONDITIONAL_BUILD_WINE_TAG: 2b47b2d3460e7f2c8d6bacccaee3902d

View file

@ -15,14 +15,8 @@ VKD3D_PROTON_COMMIT="a83811bf228ec4e7fc09727388521c725126d868"
VKD3D_PROTON_DST_DIR="/vkd3d-proton-tests"
VKD3D_PROTON_SRC_DIR="/vkd3d-proton-src"
VKD3D_PROTON_WINE_DIR="/vkd3d-proton-wine64"
VKD3D_PROTON_S3_ARTIFACT="vkd3d-proton.tar.zst"
if [ ! -d "$VKD3D_PROTON_WINE_DIR" ]; then
echo "Fatal: Directory '$VKD3D_PROTON_WINE_DIR' does not exist. Aborting."
exit 1
fi
mkdir -p "$VKD3D_PROTON_SRC_DIR"
pushd "$VKD3D_PROTON_SRC_DIR"
git init
@ -54,7 +48,7 @@ if FOUND_ARTIFACT_URL="$(find_s3_project_artifact "${ARTIFACT_PATH}")"; then
echo "Found vkd3d-proton at: ${FOUND_ARTIFACT_URL}, skipping upload"
else
echo "Uploaded vkd3d-proton not found, reuploading..."
tar --zstd -cf "$VKD3D_PROTON_S3_ARTIFACT" -C / "${VKD3D_PROTON_DST_DIR#/}" "${VKD3D_PROTON_WINE_DIR#/}"
tar --zstd -cf "$VKD3D_PROTON_S3_ARTIFACT" -C / "${VKD3D_PROTON_DST_DIR#/}"
ci-fairy s3cp --token-file "${S3_JWT_FILE}" "$VKD3D_PROTON_S3_ARTIFACT" \
"https://${S3_BASE_PATH}/${CI_PROJECT_PATH}/${ARTIFACT_PATH}"
rm "$VKD3D_PROTON_S3_ARTIFACT"

View file

@ -0,0 +1,60 @@
#!/bin/bash
# When changing this file, you need to bump the following
# .gitlab-ci/image-tags.yml tags:
# DEBIAN_TEST_VK_TAG
set -eux
# This script sets up the wine components and the wine prefix that will be used
# when running wine. All of this gets bundled up into a tarball that's
# conditionally overlaid on LAVA runners when we need wine (container-based jobs
# will have the wine contents in them). Everything that's included in the
# WINE_S3_ARTIFACT (other than the debian wine packages) must go in this script,
# because that determines the cached hash it's uploaded under for LAVA runners.
section_start wine "Setting up Wine"
# Do a very early check to make sure the tag is correct without the need of
# setting up the environment variables locally
ci_tag_build_time_check "WINE_TAG"
export WINEPREFIX="/wineprefix"
export WINEDEBUG="-all"
# We don't want crash dialogs
cat >crashdialog.reg <<EOF
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Wine\WineDbg]
"ShowCrashDialog"=dword:00000000
EOF
# Set the wine prefix and disable the crash dialog
wine regedit crashdialog.reg
rm crashdialog.reg
# An immediate wine command may fail with: "${WINEPREFIX}: Not a
# valid wine prefix." and that is just spit because of checking
# the existance of the system.reg file, which fails. Just giving
# it a bit more of time for it to be created solves the problem
# ...
while ! test -f "${WINEPREFIX}/system.reg"; do sleep 1; done
section_end wine
# Archive and upload wine for use as a LAVA overlay, if the archive doesn't exist yet
WINE_S3_ARTIFACT="wine.tar.zst"
ARTIFACT_PATH="${DATA_STORAGE_PATH}/wine/${DEBIAN_TEST_VK_TAG}-${WINE_TAG}/${CI_JOB_NAME}/${WINE_S3_ARTIFACT}"
if FOUND_ARTIFACT_URL="$(find_s3_project_artifact "${ARTIFACT_PATH}")"; then
echo "Found wine at: ${FOUND_ARTIFACT_URL}, skipping upload"
else
echo "Uploaded wine not found, reuploading..."
tar --zstd -cf "$WINE_S3_ARTIFACT" -C / \
"${WINEPREFIX#/}" \
/usr/lib/*/wine
ci-fairy s3cp --token-file "${S3_JWT_FILE}" "$WINE_S3_ARTIFACT" \
"https://${S3_BASE_PATH}/${CI_PROJECT_PATH}/${ARTIFACT_PATH}"
rm "$WINE_S3_ARTIFACT"
fi

View file

@ -108,12 +108,17 @@ if [ "$DEBIAN_ARCH" != "armhf" ]; then
. .gitlab-ci/container/build-gfxreconstruct.sh
fi
############### Build Wine
# Wine isn't available on 32-bit ARM
if [ "$DEBIAN_ARCH" != "armhf" ]; then
. .gitlab-ci/container/build-wine.sh
fi
############### Build VKD3D-Proton
# Wine isn't available on 32-bit ARM
if [ "$DEBIAN_ARCH" != "armhf" ]; then
uncollapsed_section_switch proton "Installing Proton (Wine/D3DVK emulation)"
. .gitlab-ci/container/setup-wine.sh "/vkd3d-proton-wine64"
. .gitlab-ci/container/build-vkd3d-proton.sh
fi

View file

@ -50,8 +50,9 @@ buildah_export() {
rm -rf "${mountpoint}/android-cts"
rm -rf "${mountpoint}/cuttlefish"
rm -rf "${mountpoint}/fluster/resources"
rm -rf "${mountpoint}/usr/lib/*/wine"
rm -rf "${mountpoint}/vkd3d-proton-tests"
rm -rf "${mountpoint}/vkd3d-proton-wine64"
rm -rf "${mountpoint}/wineprefix"
# Compress to zstd
ZSTD_CLEVEL=10 tar -C "$mountpoint" -I zstd -cf "$2" .

View file

@ -40,7 +40,7 @@
FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/container/container_job_trampoline.sh "${CI_JOB_NAME}"'
# no need to pull the whole repo to build the container image
GIT_STRATEGY: none
CI_BUILD_COMPONENTS: "$CI_BUILD_COMPONENTS_ANDROID_CTS $CI_BUILD_COMPONENTS_ANGLE $CI_BUILD_COMPONENTS_CROSVM $CI_BUILD_COMPONENTS_FLUSTER $CI_BUILD_COMPONENTS_PIGLIT $CI_BUILD_COMPONENTS_VKD3D_PROTON"
CI_BUILD_COMPONENTS: "$CI_BUILD_COMPONENTS_ANDROID_CTS $CI_BUILD_COMPONENTS_ANGLE $CI_BUILD_COMPONENTS_CROSVM $CI_BUILD_COMPONENTS_FLUSTER $CI_BUILD_COMPONENTS_PIGLIT $CI_BUILD_COMPONENTS_VKD3D_PROTON $CI_BUILD_COMPONENTS_WINE"
.container-builds-angle:
variables:
@ -67,6 +67,11 @@
VKD3D_PROTON_TAG: "${CONDITIONAL_BUILD_VKD3D_PROTON_TAG}"
CI_BUILD_COMPONENTS_VKD3D_PROTON: vkd3d-proton
.container-builds-wine:
variables:
WINE_TAG: "${CONDITIONAL_BUILD_WINE_TAG}"
CI_BUILD_COMPONENTS_WINE: wine
.container-builds-android-cts:
variables:
ANDROID_CTS_TAG: "${CONDITIONAL_BUILD_ANDROID_CTS_TAG}"
@ -98,6 +103,7 @@
extends:
- .container-builds-piglit
- .container-builds-vkd3d-proton
- .container-builds-wine
# Export the container rootfs and upload it to S3
.export-container:

View file

@ -1,30 +0,0 @@
#!/usr/bin/env bash
set -u
section_start wine "Setting up Wine"
export WINEPREFIX="$1"
export WINEDEBUG="-all"
# We don't want crash dialogs
cat >crashdialog.reg <<EOF
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Wine\WineDbg]
"ShowCrashDialog"=dword:00000000
EOF
# Set the wine prefix and disable the crash dialog
wine regedit crashdialog.reg
rm crashdialog.reg
# An immediate wine command may fail with: "${WINEPREFIX}: Not a
# valid wine prefix." and that is just spit because of checking
# the existance of the system.reg file, which fails. Just giving
# it a bit more of time for it to be created solves the problem
# ...
while ! test -f "${WINEPREFIX}/system.reg"; do sleep 1; done
section_end wine

View file

@ -113,7 +113,6 @@ directories=(
/usr/lib/*/libdb-5.3.so # libdb-5.3.so that is only used by this pam module ^
/usr/lib/*/libnss_hesiod* # remove NSS support for nis, nisplus and hesiod
/usr/lib/*/libnss_nis*
/usr/lib/*/wine # don't need Wine's implementation, using Proton instead
/usr/local/bin/mold
/usr/local/bin/bindgen
/usr/local/bin/cargo*

View file

@ -99,6 +99,16 @@ if [ -n "${VKD3D_PROTON_TAG:-}" ]; then
--compression=zstd
)
fi
if [ -n "${WINE_TAG:-}" ]; then
LAVA_EXTRA_OVERLAYS+=(
- append-overlay
--name=wine
--url="$(fdo_find_s3_path "${DATA_STORAGE_PATH}/wine/${DEBIAN_TEST_VK_TAG}-${WINE_TAG}/${MESA_IMAGE_PATH}/wine.tar.zst")"
--path="/"
--format=tar
--compression=zstd
)
fi
if [ -n "${S3_ANDROID_ARTIFACT_NAME:-}" ]; then
LAVA_EXTRA_OVERLAYS+=(
- append-overlay

View file

@ -120,6 +120,10 @@
VKD3D_PROTON_TAG: ${CONDITIONAL_BUILD_VKD3D_PROTON_TAG}
HWCI_TEST_SCRIPT: install/vkd3d-runner.sh
.test-wine:
variables:
WINE_TAG: ${CONDITIONAL_BUILD_WINE_TAG}
.piglit-traces-test:
artifacts:
when: on_failure