[vlc-commits] contrib: qt: Backport patches from Qt 5.12 for building with clang/lld on windows

Martin Storsjö git at videolan.org
Mon Nov 5 10:07:46 CET 2018


vlc | branch: master | Martin Storsjö <martin at martin.st> | Fri Oct 12 23:07:15 2018 +0300| [7fe6d1ff3632490f988ab3d3d55c0f67a4a13ba8] | committer: Martin Storsjö

contrib: qt: Backport patches from Qt 5.12 for building with clang/lld on windows

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7fe6d1ff3632490f988ab3d3d55c0f67a4a13ba8
---

 ...e-Treat-win32-clang-g-the-same-as-win32-g.patch | 30 ++++++++
 ...ix-building-with-lld-with-mingw-makefiles.patch | 80 ++++++++++++++++++++++
 contrib/src/qt/rules.mak                           |  2 +
 3 files changed, 112 insertions(+)

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
new file mode 100644
index 0000000000..f7a9a9e510
--- /dev/null
+++ b/contrib/src/qt/0003-configure-Treat-win32-clang-g-the-same-as-win32-g.patch
@@ -0,0 +1,30 @@
+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-qmake-Fix-building-with-lld-with-mingw-makefiles.patch b/contrib/src/qt/0004-qmake-Fix-building-with-lld-with-mingw-makefiles.patch
new file mode 100644
index 0000000000..4fffae74d2
--- /dev/null
+++ b/contrib/src/qt/0004-qmake-Fix-building-with-lld-with-mingw-makefiles.patch
@@ -0,0 +1,80 @@
+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/rules.mak b/contrib/src/qt/rules.mak
index e5ad13c62f..2f3e33022e 100644
--- a/contrib/src/qt/rules.mak
+++ b/contrib/src/qt/rules.mak
@@ -28,6 +28,8 @@ 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
 ifndef HAVE_WIN64
 	$(APPLY) $(SRC)/qt/0001-disable-qt_random_cpu.patch
 endif



More information about the vlc-commits mailing list