[vlc-devel] [PATCH 3.0 22/41] contrib: qt: update to 5.12, compile it with ANGLE support

Steve Lhomme robux4 at ycbcr.xyz
Tue Jul 7 15:11:21 CEST 2020


From: Pierre Lamot <pierre at videolabs.io>

Compiling ANGLE support in Qt requires to compile HLSL shaders with fxc.exe.
When crosscompiling from Linux, this is provided by running fxc through wine.

An alternative solution might be to use d3dcompiler implementation
from wine.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>
(cherry picked from commit 07fb07360e2afbf42e4b96cc5a7e319fb354ad4d) (edited)

edited:
- removed ANGLE support for 3.0 branch.

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
---
 ...at-win32-clang-g-the-same-as-win32-g.patch | 30 -------
 ...ash.c-mingw-clang-64-bit-compilation.patch | 25 ++++++
 ...ilding-with-lld-with-mingw-makefiles.patch | 80 -------------------
 ...mpilation-with-trunk-clang-for-mingw.patch | 40 ----------
 contrib/src/qt/FixQtPcFiles.sh                |  7 ++
 contrib/src/qt/SHA512SUMS                     |  2 +-
 contrib/src/qt/fix-glibc-2.28-build.patch     | 49 ------------
 contrib/src/qt/rules.mak                      | 25 +++---
 8 files changed, 47 insertions(+), 211 deletions(-)
 delete mode 100644 contrib/src/qt/0003-configure-Treat-win32-clang-g-the-same-as-win32-g.patch
 create mode 100644 contrib/src/qt/0004-Fix-PMurHash.c-mingw-clang-64-bit-compilation.patch
 delete mode 100644 contrib/src/qt/0004-qmake-Fix-building-with-lld-with-mingw-makefiles.patch
 delete mode 100644 contrib/src/qt/0005-qsimd-Fix-compilation-with-trunk-clang-for-mingw.patch
 create mode 100755 contrib/src/qt/FixQtPcFiles.sh
 delete mode 100644 contrib/src/qt/fix-glibc-2.28-build.patch

diff --git a/contrib/src/qt/0003-configure-Treat-win32-clang-g-the-same-as-win32-g.patch b/contrib/src/qt/0003-configure-Treat-win32-clang-g-the-same-as-win32-g.patch
deleted file mode 100644
index f7a9a9e510..0000000000
--- a/contrib/src/qt/0003-configure-Treat-win32-clang-g-the-same-as-win32-g.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 0d14106535d7d3c3a5a006ebe600142b187e98c8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
-Date: Tue, 9 Oct 2018 13:38:53 +0300
-Subject: [PATCH 3/4] configure: Treat win32-clang-g++ the same as win32-g++
-
-This fixes configure with win32-clang-g++ as the native compiler.
-
-Change-Id: Iced43d70b9a0aa413d1f5f6034b42b976cb7c39e
-Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen at qt.io>
-Cherry-picked-from: 9436e3c315420c7ebfb36628e6bf388c780bf0ca
----
- configure | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure b/configure
-index 2830a1b189..ef7bad1bfc 100755
---- a/configure
-+++ b/configure
-@@ -771,7 +771,7 @@ setBootstrapVariable()
-         echo "RM_RF = rm -rf" >> "$mkfile"
- 
-         case `basename "$PLATFORM"` in
--        win32-g++*)
-+        win32-*g++*)
-             cat "$in_mkfile.win32" >> "$mkfile"
-             ;;
-         *)
--- 
-2.17.1 (Apple Git-112)
-
diff --git a/contrib/src/qt/0004-Fix-PMurHash.c-mingw-clang-64-bit-compilation.patch b/contrib/src/qt/0004-Fix-PMurHash.c-mingw-clang-64-bit-compilation.patch
new file mode 100644
index 0000000000..47f98a5014
--- /dev/null
+++ b/contrib/src/qt/0004-Fix-PMurHash.c-mingw-clang-64-bit-compilation.patch
@@ -0,0 +1,25 @@
+From 7e0e146443663db23ea0164e0b72694b8f9a1b69 Mon Sep 17 00:00:00 2001
+From: LLVM MinGW <root at localhost>
+Date: Fri, 21 Dec 2018 14:41:36 +0000
+Subject: [PATCH] Fix PMurHash.c mingw clang 64-bit compilation.
+
+---
+ .../angle/src/common/third_party/smhasher/src/PMurHash.cpp      | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
+index 071bc31..ff75759 100644
+--- a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
++++ b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp
+@@ -208,7 +208,7 @@ void PMurHash32_Process(uint32_t *ph1, uint32_t *pcarry, const void *key, int le
+   /* This CPU does not handle unaligned word access */
+ 
+   /* Consume enough so that the next data byte is word aligned */
+-  int i = -(long)ptr & 3;
++  int i = -(intptr_t)ptr & 3;
+   if(i && i <= len) {
+       DOBYTES(i, h1, c, n, ptr, len);
+   }
+-- 
+2.20.0.rc1
+
diff --git a/contrib/src/qt/0004-qmake-Fix-building-with-lld-with-mingw-makefiles.patch b/contrib/src/qt/0004-qmake-Fix-building-with-lld-with-mingw-makefiles.patch
deleted file mode 100644
index 4fffae74d2..0000000000
--- a/contrib/src/qt/0004-qmake-Fix-building-with-lld-with-mingw-makefiles.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From 923173268e6ec96f683e31317ad6f55d71b89aac Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
-Date: Tue, 9 Oct 2018 13:51:46 +0300
-Subject: [PATCH 4/4] qmake: Fix building with lld with mingw makefiles
-
-lld for coff/mingw doesn't support linker scripts, which qmake used
-for passing larger numbers of input file names to the linker.
-
-Instead of using a fullblown linker script for this, just use a plain
-response file, which both lld and binutils ld support.
-
-Change-Id: I3aace7902fa6ca861a0a9fe67feaa236e7ea417b
-Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen at qt.io>
-Cherry-picked-from: d92c25b1b4ac0423a824715a08b2db2def4b6e25
----
- qmake/generators/win32/mingw_make.cpp | 32 ++++++++++++++-------------
- 1 file changed, 17 insertions(+), 15 deletions(-)
-
-diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
-index d6d6b04148..58d6a371bb 100644
---- a/qmake/generators/win32/mingw_make.cpp
-+++ b/qmake/generators/win32/mingw_make.cpp
-@@ -119,22 +119,25 @@ QString MingwMakefileGenerator::installRoot() const
-     return QStringLiteral("$(INSTALL_ROOT:@msyshack@%=%)");
- }
- 
--void createLdObjectScriptFile(const QString &fileName, const ProStringList &objList)
-+void createLdResponseFile(const QString &fileName, const ProStringList &objList)
- {
-     QString filePath = Option::output_dir + QDir::separator() + fileName;
-     QFile file(filePath);
-     if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
-         QTextStream t(&file);
--        t << "INPUT(\n";
-         for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
-             QString path = (*it).toQString();
--            // ### quoting?
--            if (QDir::isRelativePath(path))
--                t << "./" << path << endl;
--            else
--                t << path << endl;
-+            // In response files, whitespace and special characters are
-+            // escaped with a backslash; backslashes themselves can either
-+            // be escaped into double backslashes, or, as this is a list of
-+            // path names, converted to forward slashes.
-+            path.replace(QLatin1Char('\\'), QLatin1String("/"))
-+                .replace(QLatin1Char(' '), QLatin1String("\\ "))
-+                .replace(QLatin1Char('\t'), QLatin1String("\\\t"))
-+                .replace(QLatin1Char('"'), QLatin1String("\\\""))
-+                .replace(QLatin1Char('\''), QLatin1String("\\'"));
-+            t << path << endl;
-         }
--        t << ");\n";
-         t.flush();
-         file.close();
-     }
-@@ -297,14 +300,13 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
-         createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS"));
-         objectsLinkLine = ar_cmd + " -M < " + escapeFilePath(ar_script_file);
-     } else {
--        QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
--        if (!var("BUILD_NAME").isEmpty()) {
--            ld_script_file += "." + var("BUILD_NAME");
--        }
-+        QString ld_response_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
-+        if (!var("BUILD_NAME").isEmpty())
-+            ld_response_file += "." + var("BUILD_NAME");
-         if (!var("MAKEFILE").isEmpty())
--            ld_script_file += "." + var("MAKEFILE");
--        createLdObjectScriptFile(ld_script_file, project->values("OBJECTS"));
--        objectsLinkLine = escapeFilePath(ld_script_file);
-+            ld_response_file += "." + var("MAKEFILE");
-+        createLdResponseFile(ld_response_file, project->values("OBJECTS"));
-+        objectsLinkLine = "@" + escapeFilePath(ld_response_file);
-     }
-     Win32MakefileGenerator::writeObjectsPart(t);
- }
--- 
-2.17.1 (Apple Git-112)
-
diff --git a/contrib/src/qt/0005-qsimd-Fix-compilation-with-trunk-clang-for-mingw.patch b/contrib/src/qt/0005-qsimd-Fix-compilation-with-trunk-clang-for-mingw.patch
deleted file mode 100644
index c56ba89d5a..0000000000
--- a/contrib/src/qt/0005-qsimd-Fix-compilation-with-trunk-clang-for-mingw.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From e94d33db32d43c4c99318fc6a5213f629c1c0087 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
-Date: Fri, 18 Jan 2019 09:31:10 +0200
-Subject: [PATCH 5/5] qsimd: Fix compilation with trunk clang for mingw
-
-Current tip-of-tree clang (after Clang 8 was branched) added an
-intrinsic function __builtin_ia32_xgetbv, and added the following
-define that provides _xgetbv:
-    #define _xgetbv(A) __builtin_ia32_xgetbv((long long)(A))
-
-This fallback declaration of the _xgetbv function only is used
-in case the Q_OS_WIN branch of the #if/#elif below is used, if
-the #if (defined(Q_CC_GNU) && !defined(Q_CC_EMSCRIPTEN)) ||
-defined(Q_CC_GHS) wasn't taken. I left out the
-!defined(Q_CC_EMSCRIPTEN) part as I believe Q_OS_WIN and
-Q_CC_EMSCRIPTEN are mutually exclusive.
-
-Change-Id: I257fc4283ff9f0845df51ab764cf58acdf285c66
-Reviewed-by: Thiago Macieira <thiago.macieira at intel.com>
-Cherry-picked-from: 9818af7d436f7aa1bf5c635041cc5d08fec599b5
----
- src/corelib/tools/qsimd.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
-index 25340f2d02..4ae310b164 100644
---- a/src/corelib/tools/qsimd.cpp
-+++ b/src/corelib/tools/qsimd.cpp
-@@ -248,7 +248,7 @@ static void cpuidFeatures07_00(uint &ebx, uint &ecx)
- #endif
- }
- 
--#ifdef Q_OS_WIN
-+#if defined(Q_OS_WIN) && !(defined(Q_CC_GNU) || defined(Q_CC_GHS))
- // fallback overload in case this intrinsic does not exist: unsigned __int64 _xgetbv(unsigned int);
- inline quint64 _xgetbv(__int64) { return 0; }
- #endif
--- 
-2.17.2 (Apple Git-113)
-
diff --git a/contrib/src/qt/FixQtPcFiles.sh b/contrib/src/qt/FixQtPcFiles.sh
new file mode 100755
index 0000000000..054f7f1428
--- /dev/null
+++ b/contrib/src/qt/FixQtPcFiles.sh
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+# Use the Libs.private from the prl files that don't have debug symbols and use a proper lib order
+LIBS=$(sed -e '/QMAKE_PRL_LIBS/ { s/QMAKE_PRL_LIBS =//; s/\$\$\[QT_INSTALL_LIBS\]/${libdir}/g; p }; d'  $1 )
+sed -i \
+	-e "s#Libs.private:.*#Libs.private: $LIBS#" \
+	-e "/Libs:/ { s/d / / }" $2
diff --git a/contrib/src/qt/SHA512SUMS b/contrib/src/qt/SHA512SUMS
index 4cd02df10c..4ce6931c6a 100644
--- a/contrib/src/qt/SHA512SUMS
+++ b/contrib/src/qt/SHA512SUMS
@@ -1 +1 @@
-9f68e00d432db6999f932da6ba759e465ea7d65461ef8db13765f16bd812f2ddd05beede1df3c6546165bc4924a6bd14cc0ff083defc43e2dce37ea20c561462  qt-5.11.0.tar.xz
+6752ecc096f8baf8e14e56f0d1f139e8a0d75967ab61bf1734ad5f4f4609a7cc707ab080f5f85f2230bbbb1454a0669be60a14d57d9a93aef553ce6f85f71613  qt-5.12.2.tar.xz
diff --git a/contrib/src/qt/fix-glibc-2.28-build.patch b/contrib/src/qt/fix-glibc-2.28-build.patch
deleted file mode 100644
index 2c0653d7f9..0000000000
--- a/contrib/src/qt/fix-glibc-2.28-build.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-Description: Fix qmake build with glibc 2.28
- We haven't yet run the configure checks to see if statx and renameat2
- are present in glibc, so this fails when we redefine the structures and
- functions.
-Author: Thiago Macieira <thiago.macieira at intel.com>
-Origin: upstream
-Applied-Upstream: commit:25feee4
-Last-Update: 2018-08-25
---- a/src/corelib/global/qconfig-bootstrapped.h
-+++ b/src/corelib/global/qconfig-bootstrapped.h
-@@ -98,10 +98,18 @@
- #define QT_NO_QOBJECT
- #define QT_FEATURE_process -1
- #define QT_FEATURE_regularexpression -1
--#define QT_FEATURE_renameat2 -1
-+#ifdef __GLIBC_PREREQ
-+# define QT_FEATURE_renameat2 (__GLIBC_PREREQ(2, 28) ? 1 : -1)
-+#else
-+# define QT_FEATURE_renameat2 -1
-+#endif
- #define QT_FEATURE_sharedmemory -1
- #define QT_FEATURE_slog2 -1
--#define QT_FEATURE_statx -1
-+#ifdef __GLIBC_PREREQ
-+# define QT_FEATURE_statx (__GLIBC_PREREQ(2, 28) ? 1 : -1)
-+#else
-+# define QT_FEATURE_statx -1
-+#endif
- #define QT_FEATURE_syslog -1
- #define QT_NO_SYSTEMLOCALE
- #define QT_FEATURE_systemsemaphore -1
---- a/src/corelib/io/qfilesystemengine_unix.cpp
-+++ b/src/corelib/io/qfilesystemengine_unix.cpp
-@@ -91,7 +91,6 @@ extern "C" NSString *NSTemporaryDirector
- #  include <sys/syscall.h>
- #  include <sys/sendfile.h>
- #  include <linux/fs.h>
--#  include <linux/stat.h>
- 
- // in case linux/fs.h is too old and doesn't define it:
- #ifndef FICLONE
-@@ -112,6 +111,7 @@ static int renameat2(int oldfd, const ch
- #    endif
- 
- #    if !QT_CONFIG(statx) && defined(SYS_statx)
-+#      include <linux/stat.h>
- static int statx(int dirfd, const char *pathname, int flag, unsigned mask, struct statx *statxbuf)
- { return syscall(SYS_statx, dirfd, pathname, flag, mask, statxbuf); }
- #    elif !QT_CONFIG(statx) && !defined(SYS_statx)
diff --git a/contrib/src/qt/rules.mak b/contrib/src/qt/rules.mak
index 6f85502aef..57febf3020 100644
--- a/contrib/src/qt/rules.mak
+++ b/contrib/src/qt/rules.mak
@@ -1,7 +1,7 @@
 # Qt
 
-QT_VERSION_MAJOR := 5.11
-QT_VERSION := $(QT_VERSION_MAJOR).0
+QT_VERSION_MAJOR := 5.12
+QT_VERSION := $(QT_VERSION_MAJOR).2
 # Insert potential -betaX suffix here:
 QT_VERSION_FULL := $(QT_VERSION)
 QT_URL := https://download.qt.io/official_releases/qt/$(QT_VERSION_MAJOR)/$(QT_VERSION_FULL)/submodules/qtbase-everywhere-src-$(QT_VERSION_FULL).tar.xz
@@ -28,17 +28,16 @@ qt: qt-$(QT_VERSION_FULL).tar.xz .sum-qt
 ifdef HAVE_WIN32
 	$(APPLY) $(SRC)/qt/0001-Windows-QPA-prefer-lower-value-when-rounding-fractio.patch
 	$(APPLY) $(SRC)/qt/0002-Windows-QPA-Disable-systray-notification-sounds.patch
-	$(APPLY) $(SRC)/qt/0003-configure-Treat-win32-clang-g-the-same-as-win32-g.patch
-	$(APPLY) $(SRC)/qt/0004-qmake-Fix-building-with-lld-with-mingw-makefiles.patch
-	$(APPLY) $(SRC)/qt/0005-qsimd-Fix-compilation-with-trunk-clang-for-mingw.patch
+	$(APPLY) $(SRC)/qt/0004-Fix-PMurHash.c-mingw-clang-64-bit-compilation.patch
 ifndef HAVE_WIN64
 	$(APPLY) $(SRC)/qt/0001-disable-qt_random_cpu.patch
 endif
-	$(APPLY) $(SRC)/qt/fix-glibc-2.28-build.patch
+
 ifndef HAVE_CROSS_COMPILE
 	cd qt-$(QT_VERSION_FULL); for i in QtFontDatabaseSupport QtWindowsUIAutomationSupport QtEventDispatcherSupport QtCore; do \
 		sed -i -e 's,"../../../../../src,"../src,g' include/$$i/$(QT_VERSION)/$$i/private/*.h; done
 endif
+
 endif
 	$(MOVE)
 
@@ -47,7 +46,9 @@ QT_OPENGL := -no-opengl
 ifdef HAVE_MACOSX
 QT_SPEC := darwin-g++
 endif
+
 ifdef HAVE_WIN32
+
 ifdef HAVE_CLANG
 QT_SPEC := win32-clang-g++
 else
@@ -69,13 +70,15 @@ QT_CONFIG := -static -opensource -confirm-license -no-pkg-config \
 
 QT_CONFIG += -release
 
+ENV_VARS := $(HOSTVARS)
+
 .qt: qt
-	cd $< && ./configure $(QT_PLATFORM) $(QT_CONFIG) -prefix $(PREFIX)
+	cd $< && $(ENV_VARS) ./configure $(QT_PLATFORM) $(QT_CONFIG) -prefix $(PREFIX) -I $(PREFIX)/include
 	# Make && Install libraries
-	cd $< && $(MAKE)
+	cd $< && $(ENV_VARS) $(MAKE)
 	cd $< && $(MAKE) -C src sub-corelib-install_subtargets sub-gui-install_subtargets sub-widgets-install_subtargets sub-platformsupport-install_subtargets sub-zlib-install_subtargets sub-bootstrap-install_subtargets
 	# Install tools
-	cd $< && $(MAKE) -C src sub-moc-install_subtargets sub-rcc-install_subtargets sub-uic-install_subtargets
+	cd $< && $(MAKE) -C src sub-moc-install_subtargets sub-rcc-install_subtargets sub-uic-install_subtargets sub-qlalr-install_subtargets
 	# Install plugins
 	cd $< && $(MAKE) -C src/plugins sub-platforms-install_subtargets
 ifdef HAVE_WIN32
@@ -88,8 +91,8 @@ ifdef HAVE_WIN32
 	cp $(PREFIX)/include/QtGui/$(QT_VERSION)/QtGui/qpa/qplatformnativeinterface.h $(PREFIX)/include/QtGui/qpa
 	# Clean Qt mess
 	rm -rf $(PREFIX)/lib/libQt5Bootstrap* $</lib/libQt5Bootstrap*
-	# Fix .pc files to remove debug version (d)
-	cd $(PREFIX)/lib/pkgconfig; for i in Qt5Core.pc Qt5Gui.pc Qt5Widgets.pc; do sed -i.orig -e 's/d\.a/.a/g' -e 's/d $$/ /' $$i; done
+	# Fix .pc files
+	for i in Qt5Core Qt5Gui Qt5Widgets Qt5Test Qt5Network ; do $(SRC)/qt/FixQtPcFiles.sh $(PREFIX)/lib/$$i.prl $(PREFIX)/lib/pkgconfig/$$i.pc; done
 	# Fix Qt5Gui.pc file to include qwindows (QWindowsIntegrationPlugin) and platform support libraries
 	cd $(PREFIX)/lib/pkgconfig; sed -i.orig -e 's/ -lQt5Gui/ -lqwindows -luxtheme -ldwmapi -lQt5ThemeSupport -lQt5FontDatabaseSupport -lQt5EventDispatcherSupport -lQt5WindowsUIAutomationSupport -lqtfreetype -lQt5Gui/g' Qt5Gui.pc
 	# Fix Qt5Widget.pc file to include qwindowsvistastyle before Qt5Widget, as it depends on it
-- 
2.26.2



More information about the vlc-devel mailing list