From bbfd6dfe2ef901979590ca440d91c86c937e64c2 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 5 May 2022 19:44:02 +0800 Subject: [PATCH] ci: Prepare the container for building all mesa components with mingw under linux `x86_build-base-wine.sh` are usd to install wine and xvfb `x86_build-mingw-patch.sh` are used to pull packages from msys2 that can be directly used. `x86_build-mingw-source-deps.sh` are used to building llvm, libclc, clang, spirv-tools and directx-headers from source xvfb are used to enable wgl tests on debian Signed-off-by: Yonggang Luo Acked-by: Jesse Natalie Acked-by: Daniel Stone Part-of: --- .../container/debian/x86_build-base-wine.sh | 19 ++++ .gitlab-ci/container/debian/x86_build-base.sh | 6 +- .../container/debian/x86_build-mingw-patch.sh | 74 +++++++++++++ .../debian/x86_build-mingw-source-deps.sh | 100 ++++++++++++++++++ .../container/debian/x86_build-mingw.sh | 13 +++ .gitlab-ci/container/debian/x86_build.sh | 21 +--- .../debian/x86_mingw-toolchain.cmake | 8 ++ .gitlab-ci/meson/build.sh | 2 + .gitlab-ci/x86_64-w64-mingw32 | 7 +- 9 files changed, 225 insertions(+), 25 deletions(-) create mode 100644 .gitlab-ci/container/debian/x86_build-base-wine.sh create mode 100644 .gitlab-ci/container/debian/x86_build-mingw-patch.sh create mode 100644 .gitlab-ci/container/debian/x86_build-mingw-source-deps.sh create mode 100644 .gitlab-ci/container/debian/x86_build-mingw.sh create mode 100644 .gitlab-ci/container/debian/x86_mingw-toolchain.cmake diff --git a/.gitlab-ci/container/debian/x86_build-base-wine.sh b/.gitlab-ci/container/debian/x86_build-base-wine.sh new file mode 100644 index 00000000000..dec8f790cf4 --- /dev/null +++ b/.gitlab-ci/container/debian/x86_build-base-wine.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e +set -o xtrace + +# Installing wine, need this for testing mingw or nine + +# We need multiarch for Wine +dpkg --add-architecture i386 +apt-get update +apt-get install -y --no-remove \ + wine \ + wine32 \ + wine64 \ + xvfb + +# Used to initialize the Wine environment to reduce build time +wine64 whoami.exe + diff --git a/.gitlab-ci/container/debian/x86_build-base.sh b/.gitlab-ci/container/debian/x86_build-base.sh index 85a6a6f0002..0a56d479bf2 100644 --- a/.gitlab-ci/container/debian/x86_build-base.sh +++ b/.gitlab-ci/container/debian/x86_build-base.sh @@ -25,7 +25,7 @@ apt-get install -y --no-remove \ dpkg-cross \ flex \ g++ \ - g++-mingw-w64-x86-64 \ + cmake \ gcc \ git \ glslang-tools \ @@ -54,7 +54,6 @@ apt-get install -y --no-remove \ libxshmfence-dev \ libxvmc-dev \ libxxf86vm-dev \ - libz-mingw-w64-dev \ make \ meson \ pkg-config \ @@ -64,7 +63,6 @@ apt-get install -y --no-remove \ qemu-user \ valgrind \ wget \ - wine64 \ x11proto-dri2-dev \ x11proto-gl-dev \ x11proto-randr-dev \ @@ -74,6 +72,8 @@ apt-get install -y --no-remove \ # Needed for ci-fairy, this revision is able to upload files to MinIO pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates@34f4ade99434043f88e164933f570301fd18b125 +. .gitlab-ci/container/debian/x86_build-base-wine.sh + ############### Uninstall ephemeral packages apt-get purge -y $STABLE_EPHEMERAL diff --git a/.gitlab-ci/container/debian/x86_build-mingw-patch.sh b/.gitlab-ci/container/debian/x86_build-mingw-patch.sh new file mode 100644 index 00000000000..6dbb743f913 --- /dev/null +++ b/.gitlab-ci/container/debian/x86_build-mingw-patch.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +# Pull packages from msys2 repository that can be directly used. +# We can use https://packages.msys2.org/ to retrieve the newest package +mkdir ~/tmp +pushd ~/tmp +MINGW_PACKET_LIST=" +mingw-w64-x86_64-headers-git-10.0.0.r14.ga08c638f8-1-any.pkg.tar.zst +mingw-w64-x86_64-vulkan-loader-1.3.211-1-any.pkg.tar.zst +mingw-w64-x86_64-libelf-0.8.13-6-any.pkg.tar.zst +mingw-w64-x86_64-zlib-1.2.12-1-any.pkg.tar.zst +mingw-w64-x86_64-zstd-1.5.2-2-any.pkg.tar.zst +" + +for i in $MINGW_PACKET_LIST +do + wget -q --tries=3 https://mirror.msys2.org/mingw/mingw64/$i + tar xf $i --strip-components=1 -C /usr/x86_64-w64-mingw32/ +done +popd +rm -rf ~/tmp + +mkdir -p /usr/x86_64-w64-mingw32/bin + +# The output of `wine64 llvm-config --system-libs --cxxflags mcdisassembler` +# containes absolute path like '-IZ:' +# The sed is used to replace `-IZ:/usr/x86_64-w64-mingw32/include` +# to `-I/usr/x86_64-w64-mingw32/include` + +# Debian's pkg-config wrapers for mingw are broken, and there's no sign that +# they're going to be fixed, so we'll just have to fix it ourselves +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930492 +cat >/usr/x86_64-w64-mingw32/bin/pkg-config </usr/x86_64-w64-mingw32/bin/llvm-config </usr/x86_64-w64-mingw32/bin/clang </usr/x86_64-w64-mingw32/bin/llvm-as </usr/x86_64-w64-mingw32/bin/llvm-link </usr/x86_64-w64-mingw32/bin/opt </usr/x86_64-w64-mingw32/bin/llvm-spirv </usr/local/bin/x86_64-w64-mingw32-pkg-config <