contrib: qt: update to 5.12, compile it with ANGLE support
authorPierre Lamot <pierre@videolabs.io>
Thu, 10 Jan 2019 10:24:47 +0000 (11:24 +0100)
committerThomas Guillem <thomas@gllm.fr>
Wed, 10 Apr 2019 12:11:39 +0000 (14:11 +0200)
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@gllm.fr>
contrib/src/qt/0003-allow-cross-compilation-of-angle-with-wine.patch [new file with mode: 0644]
contrib/src/qt/0003-configure-Treat-win32-clang-g-the-same-as-win32-g.patch [deleted file]
contrib/src/qt/0004-Fix-PMurHash.c-mingw-clang-64-bit-compilation.patch [new file with mode: 0644]
contrib/src/qt/0004-qmake-Fix-building-with-lld-with-mingw-makefiles.patch [deleted file]
contrib/src/qt/0005-qsimd-Fix-compilation-with-trunk-clang-for-mingw.patch [deleted file]
contrib/src/qt/FixQtPcFiles.sh [new file with mode: 0755]
contrib/src/qt/SHA512SUMS
contrib/src/qt/fix-glibc-2.28-build.patch [deleted file]
contrib/src/qt/rules.mak

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 (file)
index 0000000..137dd6e
--- /dev/null
@@ -0,0 +1,76 @@
+From 5b0815cdbdc729da3135d3a9c41d7579883f739d Mon Sep 17 00:00:00 2001
+From: Pierre Lamot <pierre@videolabs.io>
+Date: Tue, 9 Apr 2019 16:39:23 +0200
+Subject: [PATCH] allow cross-compilation of angle with wine
+
+---
+ src/angle/src/common/common.pri |  2 +-
+ src/gui/configure.json          |  2 +-
+ src/gui/configure.pri           | 24 ++----------------------
+ 3 files changed, 4 insertions(+), 24 deletions(-)
+
+diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri
+index df29269..b6bde4d 100644
+--- a/src/angle/src/common/common.pri
++++ b/src/angle/src/common/common.pri
+@@ -22,7 +22,7 @@ lib_replace.replace = \$\$\$\$[QT_INSTALL_LIBS]
+ lib_replace.CONFIG = path
+ QMAKE_PRL_INSTALL_REPLACE += lib_replace
+-FXC = $$shell_quote($$shell_path($$QMAKE_FXC_LOCATION))
++FXC = $$shell_path($$QMAKE_FXC_LOCATION)
+ win32 {
+     VERSION = $$MODULE_VERSION
+diff --git a/src/gui/configure.json b/src/gui/configure.json
+index 44140bc..53f4984 100644
+--- a/src/gui/configure.json
++++ b/src/gui/configure.json
+@@ -1106,7 +1106,7 @@
+         "angle": {
+             "label": "ANGLE",
+             "autoDetect": "features.opengles2 || features.opengl-dynamic",
+-            "condition": "features.dxguid && tests.fxc && (features.direct3d9 || (config.winrt && features.direct3d11 && libs.d3dcompiler))",
++            "condition": "features.dxguid && tests.fxc && (features.direct3d9 || (features.direct3d11 && libs.d3dcompiler))",
+             "output": [
+                 "publicFeature",
+                 { "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" },
+diff --git a/src/gui/configure.pri b/src/gui/configure.pri
+index 1b95449..875e890 100644
+--- a/src/gui/configure.pri
++++ b/src/gui/configure.pri
+@@ -20,29 +20,9 @@ defineTest(qtConfLibrary_freetype) {
+ # DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
+ # the Windows SDK.
+ defineTest(qtConfTest_fxc) {
+-    !mingw {
+-        fxc = $$qtConfFindInPath("fxc.exe")
+-    } else {
+-        equals(QMAKE_HOST.arch, x86_64): \
+-            fns = x64/fxc.exe
+-        else: \
+-            fns = x86/fxc.exe
+-        dxdir = $$(DXSDK_DIR)
+-        !isEmpty(dxdir) {
+-            fxc = $$dxdir/Utilities/bin/$$fns
+-        } else {
+-            winkitbindir = $$(WindowsSdkVerBinPath)
+-            !isEmpty(winkitbindir) {
+-                fxc = $$winkitbindir/$$fns
+-            } else {
+-                winkitdir = $$(WindowsSdkDir)
+-                !isEmpty(winkitdir): \
+-                    fxc = $$winkitdir/bin/$$fns
+-            }
+-        }
+-    }
++      fxc = wine "$$(DXSDK_DIR)/fxc2.exe"
+-    !isEmpty(fxc):exists($$fxc) {
++    !isEmpty(fxc) {
+         $${1}.value = $$clean_path($$fxc)
+         export($${1}.value)
+         $${1}.cache += value
+-- 
+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 (file)
index f7a9a9e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-From 0d14106535d7d3c3a5a006ebe600142b187e98c8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@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@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 (file)
index 0000000..47f98a5
--- /dev/null
@@ -0,0 +1,25 @@
+From 7e0e146443663db23ea0164e0b72694b8f9a1b69 Mon Sep 17 00:00:00 2001
+From: LLVM MinGW <root@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 (file)
index 4fffae7..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-From 923173268e6ec96f683e31317ad6f55d71b89aac Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@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@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 (file)
index c56ba89..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-From e94d33db32d43c4c99318fc6a5213f629c1c0087 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@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@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 (executable)
index 0000000..054f7f1
--- /dev/null
@@ -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
index 4cd02df..4ce6931 100644 (file)
@@ -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 (file)
index 2c0653d..0000000
+++ /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@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)
index c7af1be..d219c49 100644 (file)
@@ -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
@@ -11,6 +11,9 @@ ifdef HAVE_MACOSX
 endif
 ifdef HAVE_WIN32
 PKGS += qt
+ifdef HAVE_CROSS_COMPILE
+DEPS_qt += wine-headers fxc2 $(DEPS_fxc2)
+endif
 endif
 
 ifeq ($(call need_pkg,"Qt5Core Qt5Gui Qt5Widgets"),)
@@ -28,31 +31,40 @@ 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
+
+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
+QT_OPENGL := -angle
+else
 QT_OPENGL := -opengl desktop
+endif
 
 ifdef HAVE_MACOSX
 QT_SPEC := darwin-g++
 endif
+
 ifdef HAVE_WIN32
+
 ifdef HAVE_CLANG
 QT_SPEC := win32-clang-g++
 else
 QT_SPEC := win32-g++
 endif
+
 ifdef HAVE_CROSS_COMPILE
 QT_PLATFORM := -xplatform $(QT_SPEC) -device-option CROSS_COMPILE=$(HOST)-
 else
@@ -60,10 +72,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 +82,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
@@ -94,12 +105,15 @@ 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 Qt5Test.pc Qt5Network.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 -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#' \
+               -e 's/-llibGLESv2/-llibGLESv2 -ld3d9 -ltranslator -lpreprocessor/g' Qt5Gui.pc
 endif
        # Install a qmake with correct paths set
        cd $<; $(MAKE) sub-qmake-qmake-aux-pro-install_subtargets install_mkspecs