[vlc-devel] [RFC 07/82] contrib: update qt to 5.12, compile it with ANGLE support
Pierre Lamot
pierre at videolabs.io
Fri Feb 1 14:01:11 CET 2019
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.
---
...cross-compilation-of-angle-with-wine.patch | 55 +++++++++++++
...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 -------------------
contrib/src/qt/SHA512SUMS | 2 +-
contrib/src/qt/fix-glibc-2.28-build.patch | 49 ------------
contrib/src/qt/rules.mak | 48 +++++++----
7 files changed, 114 insertions(+), 175 deletions(-)
create mode 100644 contrib/src/qt/0003-allow-cross-compilation-of-angle-with-wine.patch
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/fix-glibc-2.28-build.patch
diff --git a/contrib/src/qt/0003-allow-cross-compilation-of-angle-with-wine.patch b/contrib/src/qt/0003-allow-cross-compilation-of-angle-with-wine.patch
new file mode 100644
index 0000000000..4ea209d17e
--- /dev/null
+++ b/contrib/src/qt/0003-allow-cross-compilation-of-angle-with-wine.patch
@@ -0,0 +1,55 @@
+From 1abb4d1ae6f125989fa5bcebf912b678f414fab9 Mon Sep 17 00:00:00 2001
+From: Pierre Lamot <pierre at videolabs.io>
+Date: Thu, 20 Dec 2018 17:42:12 +0100
+Subject: [PATCH] allow cross-compilation of angle with wine
+
+---
+ src/angle/src/common/common.pri | 17 ++---------------
+ src/gui/configure.json | 2 +-
+ 2 files changed, 3 insertions(+), 16 deletions(-)
+
+diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri
+index b64dbd3..a64b63b 100644
+--- a/src/angle/src/common/common.pri
++++ b/src/angle/src/common/common.pri
+@@ -22,21 +22,8 @@ lib_replace.replace = \$\$\$\$[QT_INSTALL_LIBS]
+ lib_replace.CONFIG = path
+ QMAKE_PRL_INSTALL_REPLACE += lib_replace
+
+-# DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK.
+-winrt|msvc {
+- FXC = fxc.exe
+-} else {
+- DX_DIR = $$(DXSDK_DIR)
+- isEmpty(DX_DIR) {
+- error("Cannot determine DirectX SDK location. Please set DXSDK_DIR environment variable.")
+- }
+-
+- equals(QMAKE_TARGET.arch, x86_64) {
+- FXC = \"$${DX_DIR}Utilities\\bin\\x64\\fxc.exe\"
+- } else {
+- FXC = \"$${DX_DIR}Utilities\\bin\\x86\\fxc.exe\"
+- }
+-}
++# Use FXC through wine
++FXC = wine \"$$(DXSDK_DIR)/fxc2.exe\"
+
+ win32 {
+ VERSION = $$MODULE_VERSION
+diff --git a/src/gui/configure.json b/src/gui/configure.json
+index 0332631..73fd75c 100644
+--- a/src/gui/configure.json
++++ b/src/gui/configure.json
+@@ -667,7 +667,7 @@
+ "type": "directX",
+ "files": [
+ "d3dcompiler.h",
+- "d3d11.lib",
+- "fxc.exe"
++ "libd3d11.a",
++ "fxc2.exe"
+ ]
+ },
+--
+2.19.1
+
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/SHA512SUMS b/contrib/src/qt/SHA512SUMS
index 4cd02df10c..c8c9882eeb 100644
--- a/contrib/src/qt/SHA512SUMS
+++ b/contrib/src/qt/SHA512SUMS
@@ -1 +1 @@
-9f68e00d432db6999f932da6ba759e465ea7d65461ef8db13765f16bd812f2ddd05beede1df3c6546165bc4924a6bd14cc0ff083defc43e2dce37ea20c561462 qt-5.11.0.tar.xz
+8e6c51b754840d17e694b5b4a0d732afe04ebe48d166bca429db01ce3ac9014bb0ed35fe99ad165973889d96919f6b6774429585bae9a7fdba6b07f4c1eb3570 qt-5.12.0.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 d579b5d47b..4c7d433fa0 100644
--- a/contrib/src/qt/rules.mak
+++ b/contrib/src/qt/rules.mak
@@ -1,6 +1,6 @@
# Qt
-QT_VERSION_MAJOR := 5.11
+QT_VERSION_MAJOR := 5.12
QT_VERSION := $(QT_VERSION_MAJOR).0
# Insert potential -betaX suffix here:
QT_VERSION_FULL := $(QT_VERSION)
@@ -11,6 +11,9 @@ ifdef HAVE_MACOSX
endif
ifdef HAVE_WIN32
PKGS += qt
+ifdef HAVE_CROSS_COMPILE
+DEPS_qt += fxc2 $(DEPS_fxc2)
+endif
endif
ifeq ($(call need_pkg,"Qt5Core Qt5Gui Qt5Widgets"),)
@@ -28,21 +31,35 @@ 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
-ifndef HAVE_WIN64
+ifdef HAVE_WIN64
+ $(APPLY) $(SRC)/qt/0004-Fix-PMurHash.c-mingw-clang-64-bit-compilation.patch
+else
$(APPLY) $(SRC)/qt/0001-disable-qt_random_cpu.patch
endif
- $(APPLY) $(SRC)/qt/fix-glibc-2.28-build.patch
-ifndef HAVE_CROSS_COMPILE
+
+ifdef HAVE_CROSS_COMPILE
+ $(APPLY) $(SRC)/qt/0003-allow-cross-compilation-of-angle-with-wine.patch
+else
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)
+
+ifdef HAVE_WIN32
+ifneq ($(findstring $(ARCH), arm aarch64),)
+# There is no opengl available on windows on these architectures.
+QT_OPENGL := -no-opengl
+else
+QT_OPENGL := -angle
+endif
+
+else
QT_OPENGL := -opengl desktop
+endif
ifdef HAVE_MACOSX
QT_SPEC := darwin-g++
@@ -60,10 +77,7 @@ ifneq ($(QT_SPEC),)
QT_PLATFORM := -platform $(QT_SPEC)
endif
endif
-ifneq ($(findstring $(ARCH), arm aarch64),)
-# There is no opengl available on windows on these architectures.
-QT_OPENGL := -no-opengl
-endif
+
endif
QT_CONFIG := -static -opensource -confirm-license -no-pkg-config \
@@ -73,13 +87,15 @@ QT_CONFIG := -static -opensource -confirm-license -no-pkg-config \
QT_CONFIG += -release
+ENV_VARS := $(HOSTVARS) DXSDK_DIR=$(PREFIX)/bin
+
.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 sub-network-install_subtargets sub-testlib-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
@@ -95,11 +111,13 @@ ifdef HAVE_WIN32
# 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 Qt5Test.pc Qt5Network.pc; do sed -i.orig -e 's/d\.a/.a/g' -e 's/d $$/ /' $$i; done
+ cd $(PREFIX)/lib/pkgconfig; for i in Qt5Core.pc Qt5Gui.pc Qt5Widgets.pc Qt5Test.pc Qt5Network.pc ; do sed -i.orig -e 's/d\.a/.a/g' -e 's/d $$/ /' -e "s/-llibEGLd -llibGLESv2d /-llibEGL -llibGLESv2 /g" $$i; done
# Fix Qt5Gui.pc file to include qwindows (QWindowsIntegrationPlugin) and platform support libraries
- cd $(PREFIX)/lib/pkgconfig; sed -i.orig -e 's/ -lQt5Gui/ -lqwindows -lqjpeg -luxtheme -ldwmapi -lQt5ThemeSupport -lQt5FontDatabaseSupport -lQt5EventDispatcherSupport -lQt5WindowsUIAutomationSupport -lqtfreetype -lQt5Gui/g' Qt5Gui.pc
+ cd $(PREFIX)/lib/pkgconfig; sed -i.orig -e 's/ -lQt5Gui/ -lqwindows -lqjpeg -luxtheme -ldwmapi -lwtsapi32 -lQt5ThemeSupport -lQt5FontDatabaseSupport -lQt5EventDispatcherSupport -lQt5WindowsUIAutomationSupport -lqtfreetype -lQt5Gui/g' Qt5Gui.pc
# Fix Qt5Widget.pc file to include qwindowsvistastyle before Qt5Widget, as it depends on it
cd $(PREFIX)/lib/pkgconfig; sed -i.orig -e 's/ -lQt5Widget/ -lqwindowsvistastyle -lQt5Widget/' Qt5Widgets.pc
+ # Use ANGLE OpenGL provided by Qt
+ cd $(PREFIX)/lib/pkgconfig; sed -i.orig -e '/^Cflags:/ s#$$# -I$${includedir}/QtANGLE#' Qt5Gui.pc
endif
# Install a qmake with correct paths set
cd $<; $(MAKE) sub-qmake-qmake-aux-pro-install_subtargets install_mkspecs
--
2.19.1
More information about the vlc-devel
mailing list