From ecce57c3320944db9abf2d467063ed5a8c57a4b1 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Tue, 21 Jun 2022 15:53:27 -0700
Subject: [PATCH] CI: Use -fcommon to build libX11 for mingw

See discussions at https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/140
               and https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/913

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
 .gitlab-ci/cross-prereqs-build.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci/cross-prereqs-build.sh b/.gitlab-ci/cross-prereqs-build.sh
index 53cf8259fc..c3502e9320 100755
--- a/.gitlab-ci/cross-prereqs-build.sh
+++ b/.gitlab-ci/cross-prereqs-build.sh
@@ -56,7 +56,9 @@ build 'https://gitlab.freedesktop.org/xorg/lib/libxcb.git' 'libxcb-1.14'
 build 'https://gitlab.freedesktop.org/xorg/lib/libxtrans.git' 'xtrans-1.4.0'
 # the default value of keysymdefdir is taken from the includedir variable for
 # xproto, which isn't adjusted by pkg-config for the sysroot
-build 'https://gitlab.freedesktop.org/xorg/lib/libX11.git' 'libX11-1.6.9' "--with-keysymdefdir=/usr/${HOST}/include/X11"
+# Using -fcommon to address build failure when cross-compiling for windows.
+# See discussion at https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/913
+CFLAGS="-fcommon" build 'https://gitlab.freedesktop.org/xorg/lib/libX11.git' 'libX11-1.6.9' "--with-keysymdefdir=/usr/${HOST}/include/X11"
 build 'https://gitlab.freedesktop.org/xorg/lib/libxkbfile.git' 'libxkbfile-1.1.0'
 # freetype needs an explicit --build to know it's cross-compiling
 # disable png as freetype tries to use libpng-config, even when cross-compiling
-- 
GitLab