contrib: qt: Add patches for building with llvm-mingw
authorMartin Storsjö <martin@martin.st>
Wed, 13 Dec 2017 14:15:04 +0000 (16:15 +0200)
committerMartin Storsjö <martin@martin.st>
Sun, 25 Feb 2018 20:18:41 +0000 (22:18 +0200)
All of them are backports (in Qt 5.11, everything needed for building
with llvm-mingw is upstreamed), with annotations about where they
come from.

To actually build with llvm-mingw, one has to use the mkspec
win32-clang-g++ instead of win32-g++.

contrib/src/qt/0004-qmake-don-t-limit-command-line-length-when-not-actua.patch [new file with mode: 0644]
contrib/src/qt/0005-harfbuzz-Fix-building-for-win64-with-clang.patch [new file with mode: 0644]
contrib/src/qt/0006-moc-Initialize-staticMetaObject-with-the-highest-use.patch [new file with mode: 0644]
contrib/src/qt/0007-Only-define-QT_FASTCALL-on-x86_32.patch [new file with mode: 0644]
contrib/src/qt/0008-Skip-arm-pixman-drawhelpers-on-windows-just-like-on-.patch [new file with mode: 0644]
contrib/src/qt/0009-mkspecs-Add-a-win32-clang-g-mkspec-for-clang-targeti.patch [new file with mode: 0644]
contrib/src/qt/rules.mak

diff --git a/contrib/src/qt/0004-qmake-don-t-limit-command-line-length-when-not-actua.patch b/contrib/src/qt/0004-qmake-don-t-limit-command-line-length-when-not-actua.patch
new file mode 100644 (file)
index 0000000..5654d74
--- /dev/null
@@ -0,0 +1,75 @@
+From 767c2a2e339babcff9383d539f59479586444dd5 Mon Sep 17 00:00:00 2001
+From: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
+Date: Mon, 7 Aug 2017 12:17:06 +0200
+Subject: [PATCH 4/9] qmake: don't limit command line length when not actually
+ on windows
+
+QMAKE_LINK_OBJECT_MAX is actually a property of the host, not the
+target.
+
+this works around binutil's inability to use thin LTO objects in
+conjunction with an MRI script
+(https://sourceware.org/bugzilla/show_bug.cgi?id=21702).
+
+Task-number: QTBUG-61335
+Change-Id: I90a1334b9c905c433b35546e8f3f3b5089d2c65b
+Reviewed-by: Jake Petroules <jake.petroules@qt.io>
+Backport-Of: 8bebded9ab02b8eec67c44bfddf802d6bf9cda3c (v5.9.2)
+
+qmake: Handle QMAKE_LINK_OBJECT_MAX being unset for static libraries
+
+This was missed in 8bebded9.
+
+Task-number: QTBUG-63637
+Change-Id: I6be472430a9aa8f533def4fd6c14c8dbfe8b6f70
+Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
+Backport-Of: 8cef809b16aac9d4c4163ff2e2e831adf70133c2 (v5.10.1)
+---
+ mkspecs/win32-g++/qmake.conf          | 6 ++++--
+ qmake/generators/win32/mingw_make.cpp | 6 ++++--
+ 2 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
+index 2576a58e83..68d773499c 100644
+--- a/mkspecs/win32-g++/qmake.conf
++++ b/mkspecs/win32-g++/qmake.conf
+@@ -87,8 +87,10 @@ QMAKE_LFLAGS_CXX11      =
+ QMAKE_LFLAGS_CXX14      =
+ QMAKE_LFLAGS_CXX1Z      =
+ QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections
+-QMAKE_LINK_OBJECT_MAX   = 10
+-QMAKE_LINK_OBJECT_SCRIPT = object_script
++equals(QMAKE_HOST.os, Windows) {
++    QMAKE_LINK_OBJECT_MAX = 10
++    QMAKE_LINK_OBJECT_SCRIPT = object_script
++}
+ QMAKE_PREFIX_SHLIB      =
+ QMAKE_EXTENSION_SHLIB   = dll
+ QMAKE_PREFIX_STATICLIB  = lib
+diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
+index 96fd24cd31..c1609027f3 100644
+--- a/qmake/generators/win32/mingw_make.cpp
++++ b/qmake/generators/win32/mingw_make.cpp
+@@ -284,7 +284,8 @@ void MingwMakefileGenerator::writeLibsPart(QTextStream &t)
+ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
+ {
+-    if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) {
++    const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX");
++    if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
+         objectsLinkLine = "$(OBJECTS)";
+     } else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
+         QString ar_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
+@@ -323,7 +324,8 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
+     if(!project->isEmpty("QMAKE_PRE_LINK"))
+         t << "\n\t" <<var("QMAKE_PRE_LINK");
+     if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
+-        if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) {
++        const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX");
++        if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) {
+             t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
+         } else {
+             t << "\n\t" << objectsLinkLine << " " ;
+-- 
+2.14.3 (Apple Git-98)
+
diff --git a/contrib/src/qt/0005-harfbuzz-Fix-building-for-win64-with-clang.patch b/contrib/src/qt/0005-harfbuzz-Fix-building-for-win64-with-clang.patch
new file mode 100644 (file)
index 0000000..feade28
--- /dev/null
@@ -0,0 +1,35 @@
+From 43c31ab3146e144eb1938211803476a8fb3e44f2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
+Date: Sat, 11 Nov 2017 16:59:11 +0200
+Subject: [PATCH 5/9] harfbuzz: Fix building for win64 with clang
+
+Clang errors out on casting from a pointer to a smaller integer
+type.
+
+This is an adapted backport of a newer upstream harfbuzz
+commit, 03b7a221f701a9b003890878e730ad175c3fdd86.
+
+Change-Id: I0de62d90008021aed6acf4e946ce1d346f9aac8c
+Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
+Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
+Backport-Of: f663c83f9d08f21bf6d96405456bd5864422b173 (v5.10.1)
+---
+ src/3rdparty/harfbuzz-ng/src/hb-private.hh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/harfbuzz-ng/src/hb-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-private.hh
+index 53e0510a92..5170a8f393 100644
+--- a/src/3rdparty/harfbuzz-ng/src/hb-private.hh
++++ b/src/3rdparty/harfbuzz-ng/src/hb-private.hh
+@@ -671,7 +671,7 @@ _hb_debug_msg_va (const char *what,
+   fprintf (stderr, "%-10s", what ? what : "");
+   if (obj)
+-    fprintf (stderr, "(%0*lx) ", (unsigned int) (2 * sizeof (void *)), (unsigned long) obj);
++    fprintf (stderr, "(%*p) ", (unsigned int) (2 * sizeof (void *)), obj);
+   else
+     fprintf (stderr, " %*s  ", (unsigned int) (2 * sizeof (void *)), "");
+-- 
+2.14.3 (Apple Git-98)
+
diff --git a/contrib/src/qt/0006-moc-Initialize-staticMetaObject-with-the-highest-use.patch b/contrib/src/qt/0006-moc-Initialize-staticMetaObject-with-the-highest-use.patch
new file mode 100644 (file)
index 0000000..bb94b14
--- /dev/null
@@ -0,0 +1,103 @@
+From 4cc1f128c4b9894b94ffdd5d0a32257ead7a9cf5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
+Date: Fri, 24 Nov 2017 10:10:23 +0200
+Subject: [PATCH 6/9] moc: Initialize staticMetaObject with the highest
+ user-settable priority
+
+The referenced static meta object for the superclass might be in a
+different DLL. In this case, the whole QMetaObject can't be initialized
+all via preinitialized data in the data section of the binary, but must
+run code at runtime to fill in the value of the dllimported pointer.
+
+In these cases, both GCC and MSVC initialize as much as possible statically,
+while only filling in the dllimported values (QMetaObject::d::superdata)
+at runtime. Clang, on the other side, initializes the whole struct
+at runtime if some part of it needs runtime initialization, leaving
+the struct completely uninitialized before constructors are run.
+
+In C++, there are no guarantees for in what order constructors in
+different translation units are executed. This in particular means
+that there are no guarantees as to whether qRegisterWidgetsVariant()
+in qwidgetsvariants.cpp runs before or after the runtime initialization
+of QWidget::staticMetaObject.
+
+With GCC and MSVC, this doesn't seem to have mattered since only the
+superdata pointer of the staticMetaObject was uninitialized - everything
+else was initialized, and the superdata pointer doesn't seem to be
+accessed during qRegisterWidgetsVariant.
+
+With clang, the whole staticMetaObject is uninitialized, unless the
+staticMetaObject has been initialized before (and the initialization
+order is undefined).
+
+By setting a manual priority (which is a GCC extension that also
+clang supports) for the staticMetaObjects, we can be sure that
+these are initialized before the actual explicit constructor
+invocations (without any explicit initialization priority) that
+can access the staticMetaObjects.
+
+Change-Id: I64a82f12d690528567509791bae088b6304e189b
+Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
+Backport-Of: 74118a4784569046d5fdf5e08c99f8b1b43e9710 (v5.10.1)
+
+moc: Only use the init_priority attribute when targeting windows
+
+While both GCC and the GCC compatible clang support this attribute in
+general, GCC doesn't support it when targeting macOS, ending up with
+errors like these:
+error: 'init_priority' attribute is not supported on this platform
+
+This error isn't a property of the platform itself though, since
+clang supports the attribute just fine on macOS.
+
+The attribute is only used to work around an issue with dllimport
+on windows, so limit its use to that platform, to avoid issues
+with it potentially being unsupported on platforms other than
+macOS as well.
+
+This fixes compiling with GCC for macOS.
+
+Change-Id: I0235e6365635d73233951566c10ad869b26a0fc6
+Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
+Backport-Of: b97765efd452921f75c1d04820c4b5e9e9d49100 (5.11 branch)
+---
+ src/corelib/global/qglobal.h | 6 ++++++
+ src/tools/moc/generator.cpp  | 4 ++--
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
+index 4528005177..3a3f8d40da 100644
+--- a/src/corelib/global/qglobal.h
++++ b/src/corelib/global/qglobal.h
+@@ -499,6 +499,12 @@ typedef qptrdiff qintptr;
+ #  define Q_ALWAYS_INLINE inline
+ #endif
++#if defined(Q_CC_GNU) && defined(Q_OS_WIN)
++#  define QT_INIT_METAOBJECT __attribute__((init_priority(101)))
++#else
++#  define QT_INIT_METAOBJECT
++#endif
++
+ //defines the type for the WNDPROC on windows
+ //the alignment needs to be forced for sse2 to not crash with mingw
+ #if defined(Q_OS_WIN)
+diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
+index 99629f0427..8cbeb4ce78 100644
+--- a/src/tools/moc/generator.cpp
++++ b/src/tools/moc/generator.cpp
+@@ -525,9 +525,9 @@ void Generator::generateCode()
+ // Finally create and initialize the static meta object
+ //
+     if (isQt)
+-        fprintf(out, "const QMetaObject QObject::staticQtMetaObject = {\n");
++        fprintf(out, "QT_INIT_METAOBJECT const QMetaObject QObject::staticQtMetaObject = {\n");
+     else
+-        fprintf(out, "const QMetaObject %s::staticMetaObject = {\n", cdef->qualified.constData());
++        fprintf(out, "QT_INIT_METAOBJECT const QMetaObject %s::staticMetaObject = {\n", cdef->qualified.constData());
+     if (isQObject)
+         fprintf(out, "    { Q_NULLPTR, ");
+-- 
+2.14.3 (Apple Git-98)
+
diff --git a/contrib/src/qt/0007-Only-define-QT_FASTCALL-on-x86_32.patch b/contrib/src/qt/0007-Only-define-QT_FASTCALL-on-x86_32.patch
new file mode 100644 (file)
index 0000000..a300b35
--- /dev/null
@@ -0,0 +1,36 @@
+From abaeb37bc3c7d18b0a74e0c932c9767f074d01d7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
+Date: Sat, 11 Nov 2017 16:59:31 +0200
+Subject: [PATCH 7/9] Only define QT_FASTCALL on x86_32
+
+The __fastcall calling convention is silently ignored on other
+architectures. The GNU attribute regparm is allowed but doesn't
+make sense on x86_64. On other architectures, the attribute isn't
+supported at all.
+
+This fixes building with clang for MinGW/ARM and ARM64.
+
+Change-Id: Ice1c6eadd0e90b2e5e34736542ee49a25dc67fe6
+Reviewed-by: Lars Knoll <lars.knoll@qt.io>
+Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
+Backport-Of: bfc96c9c0e103c4fcfda25b9a6eaa80f4f19fba1 (v5.10.1)
+---
+ src/corelib/global/qglobal.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
+index 3523a38ebd..fe59804796 100644
+--- a/src/corelib/global/qglobal.h
++++ b/src/corelib/global/qglobal.h
+@@ -463,7 +463,7 @@ typedef qptrdiff qintptr;
+ #  define QT_ASCII_CAST_WARN
+ #endif
+-#if defined(__i386__) || defined(_WIN32) || defined(_WIN32_WCE)
++#ifdef Q_PROCESSOR_X86_32
+ #  if defined(Q_CC_GNU)
+ #    define QT_FASTCALL __attribute__((regparm(3)))
+ #  elif defined(Q_CC_MSVC)
+-- 
+2.14.3 (Apple Git-98)
+
diff --git a/contrib/src/qt/0008-Skip-arm-pixman-drawhelpers-on-windows-just-like-on-.patch b/contrib/src/qt/0008-Skip-arm-pixman-drawhelpers-on-windows-just-like-on-.patch
new file mode 100644 (file)
index 0000000..67f1b6a
--- /dev/null
@@ -0,0 +1,39 @@
+From b8ce2e4e77afb42bdb440440e55fe6dbbb5c5851 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
+Date: Sat, 6 Jan 2018 00:37:48 +0200
+Subject: [PATCH 8/9] Skip arm pixman drawhelpers on windows just like on ios
+
+Windows on arm (which uses clang, or msvc, but no gcc is available for
+that setup) can't assemble these sources.
+
+(On linux, builds with clang force deferring it to the external
+assembler, but for windows on arm, no gas compatible external
+assembler is available).
+
+Change-Id: I139572257884cfdc57d3c32061a8c2e28c6e24de
+Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
+Backport-Of: 8072c36eebd0648770e0f17fae408f33cb371c02 (v5.10.1)
+
+On revisions after 90f79db90a8db5b872040346bd58a27140b6a7a3 (v5.7.0),
+one also needs to backport f7524d73e33d00c76e55d996cdd4ea841ac6b7fa
+(part of v5.10.1).
+---
+ src/gui/painting/painting.pri | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
+index 1e516e4581..3fc3f1e3ef 100644
+--- a/src/gui/painting/painting.pri
++++ b/src/gui/painting/painting.pri
+@@ -104,7 +104,7 @@ AVX2_SOURCES += painting/qdrawhelper_avx2.cpp
+ NEON_SOURCES += painting/qdrawhelper_neon.cpp
+ NEON_HEADERS += painting/qdrawhelper_neon_p.h
+ NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S
+-!ios:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS
++!ios:!win32:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS
+ MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp
+ MIPS_DSP_HEADERS += painting/qdrawhelper_mips_dsp_p.h painting/qt_mips_asm_dsp_p.h
+-- 
+2.14.3 (Apple Git-98)
+
diff --git a/contrib/src/qt/0009-mkspecs-Add-a-win32-clang-g-mkspec-for-clang-targeti.patch b/contrib/src/qt/0009-mkspecs-Add-a-win32-clang-g-mkspec-for-clang-targeti.patch
new file mode 100644 (file)
index 0000000..6ffcec7
--- /dev/null
@@ -0,0 +1,234 @@
+From a616c80783949d1164a4f6e79f4db2291aad834c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
+Date: Wed, 24 Jan 2018 10:41:58 +0200
+Subject: [PATCH 9/9] mkspecs: Add a win32-clang-g++ mkspec, for clang
+ targeting mingw, like g++
+
+Change-Id: I427e46e6c34c2beeb2a815f1af512e4e8bd213c2
+Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
+Backport-Of: 96e3985963a20a84bb8ff7032d77531641512d1d (5.11 branch)
+
+This is an adapted backport, keeping win32-clang-g++ similar to
+win32-g++, with the following differences:
+
+-QMAKE_COMPILER          = gcc
++QMAKE_COMPILER          = gcc clang llvm   # clang pretends to be gcc
+
+-QMAKE_CC                = $${CROSS_COMPILE}gcc
++QMAKE_CC                = $${CROSS_COMPILE}clang
+
+-QMAKE_CFLAGS            = -pipe -fno-keep-inline-dllexport
++QMAKE_CFLAGS            = -pipe
+
+-QMAKE_CFLAGS_WARN_ON    = -Wall -Wextra
++QMAKE_CFLAGS_WARN_ON    = -Wall -Wextra -Wno-ignored-attributes
+
+-QMAKE_CXX               = $${CROSS_COMPILE}g++
++QMAKE_CXX               = $${CROSS_COMPILE}clang++
+
+-QMAKE_LINK              = $${CROSS_COMPILE}g++
+-QMAKE_LINK_C            = $${CROSS_COMPILE}gcc
++QMAKE_LINK              = $${CROSS_COMPILE}clang++
++QMAKE_LINK_C            = $${CROSS_COMPILE}clang
+
+On branches before Qt 5.9, configure also needs a change like this,
+to support a mingw mkspec with a different name than the existing:
+-        case `basename "$XPLATFORM"` in win32-g++*)
++        case `basename "$XPLATFORM"` in win32-*g++*)
+
+This isn't necessary any longer after
+ab0cc3055d3d1f0faa98f96a7e8ae58b6ef6461a, which became part of v5.9.0.
+---
+ configure                               |   2 +-
+ mkspecs/win32-clang-g++/qmake.conf      | 118 ++++++++++++++++++++++++++++++++
+ mkspecs/win32-clang-g++/qplatformdefs.h |  40 +++++++++++
+ 3 files changed, 159 insertions(+), 1 deletion(-)
+ create mode 100644 mkspecs/win32-clang-g++/qmake.conf
+ create mode 100644 mkspecs/win32-clang-g++/qplatformdefs.h
+
+diff --git a/configure b/configure
+index 6ebeab30fe..fa0aae8300 100755
+--- a/configure
++++ b/configure
+@@ -1429,7 +1429,7 @@ while [ "$#" -gt 0 ]; do
+         ;;
+     xplatform)
+         XPLATFORM="$VAL"
+-        case `basename "$XPLATFORM"` in win32-g++*)
++        case `basename "$XPLATFORM"` in win32-*g++*)
+             XPLATFORM_MINGW=yes
+             CFG_RPATH=no
+             CFG_REDUCE_EXPORTS=no
+diff --git a/mkspecs/win32-clang-g++/qmake.conf b/mkspecs/win32-clang-g++/qmake.conf
+new file mode 100644
+index 0000000000..7673fd0549
+--- /dev/null
++++ b/mkspecs/win32-clang-g++/qmake.conf
+@@ -0,0 +1,118 @@
++#
++# qmake configuration for win32-clang-g++
++#
++# Written for MinGW-w64 / clang 6.0 or higher
++#
++# Cross compile example for x86_64-w64-mingw32-clang++:
++#   configure -xplatform win32-clang-g++ -device-option CROSS_COMPILE=x86_64-w64-mingw32-
++#
++
++load(device_config)
++include(../common/angle.conf)
++
++MAKEFILE_GENERATOR      = MINGW
++QMAKE_PLATFORM          = win32 mingw
++CONFIG                 += debug_and_release debug_and_release_target precompile_header
++DEFINES                += UNICODE
++QMAKE_COMPILER_DEFINES += __GNUC__ WIN32
++
++QMAKE_EXT_OBJ           = .o
++QMAKE_EXT_RES           = _res.o
++
++QMAKE_COMPILER          = gcc clang llvm   # clang pretends to be gcc
++
++QMAKE_CC                = $${CROSS_COMPILE}clang
++QMAKE_LEX               = flex
++QMAKE_LEXFLAGS          =
++QMAKE_YACC              = bison -y
++QMAKE_YACCFLAGS         = -d
++QMAKE_CFLAGS            = -pipe
++QMAKE_CFLAGS_DEPS       = -M
++QMAKE_CFLAGS_WARN_ON    = -Wall -Wextra -Wno-ignored-attributes
++QMAKE_CFLAGS_WARN_OFF   = -w
++QMAKE_CFLAGS_RELEASE    = -O2
++QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -O2 -g
++QMAKE_CFLAGS_DEBUG      = -g
++QMAKE_CFLAGS_YACC       = -Wno-unused -Wno-parentheses
++QMAKE_CFLAGS_SPLIT_SECTIONS = -ffunction-sections
++QMAKE_CFLAGS_SSE2       = -msse2 -mstackrealign
++QMAKE_CFLAGS_SSE3       = -msse3
++QMAKE_CFLAGS_SSSE3      = -mssse3
++QMAKE_CFLAGS_SSE4_1     = -msse4.1
++QMAKE_CFLAGS_SSE4_2     = -msse4.2
++QMAKE_CFLAGS_AVX        = -mavx
++QMAKE_CFLAGS_AVX2       = -mavx2
++QMAKE_CFLAGS_NEON       = -mfpu=neon
++
++QMAKE_CXX               = $${CROSS_COMPILE}clang++
++QMAKE_CXXFLAGS          = $$QMAKE_CFLAGS
++QMAKE_CXXFLAGS_DEPS     = $$QMAKE_CFLAGS_DEPS
++QMAKE_CXXFLAGS_WARN_ON  = $$QMAKE_CFLAGS_WARN_ON
++QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
++QMAKE_CXXFLAGS_RELEASE  = $$QMAKE_CFLAGS_RELEASE
++QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
++QMAKE_CXXFLAGS_DEBUG    = $$QMAKE_CFLAGS_DEBUG
++QMAKE_CXXFLAGS_YACC     = $$QMAKE_CFLAGS_YACC
++QMAKE_CXXFLAGS_THREAD   = $$QMAKE_CFLAGS_THREAD
++QMAKE_CXXFLAGS_RTTI_ON  = -frtti
++QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti
++QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
++QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions
++QMAKE_CXXFLAGS_CXX11    = -std=c++0x
++QMAKE_CXXFLAGS_CXX14    = -std=c++1y
++QMAKE_CXXFLAGS_CXX1Z    = -std=c++1z
++QMAKE_CXXFLAGS_GNUCXX11 = -std=gnu++0x
++QMAKE_CXXFLAGS_GNUCXX14 = -std=gnu++1y
++QMAKE_CXXFLAGS_GNUCXX1Z = -std=gnu++1z
++QMAKE_CXXFLAGS_SPLIT_SECTIONS = $$QMAKE_CFLAGS_SPLIT_SECTIONS
++
++QMAKE_INCDIR            =
++
++QMAKE_RUN_CC            = $(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src
++QMAKE_RUN_CC_IMP        = $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
++QMAKE_RUN_CXX           = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src
++QMAKE_RUN_CXX_IMP       = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
++
++QMAKE_LINK              = $${CROSS_COMPILE}clang++
++QMAKE_LINK_C            = $${CROSS_COMPILE}clang
++QMAKE_LFLAGS            =
++QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads
++QMAKE_LFLAGS_EXCEPTIONS_OFF =
++QMAKE_LFLAGS_RELEASE    = -Wl,-s
++QMAKE_LFLAGS_DEBUG      =
++QMAKE_LFLAGS_CONSOLE    = -Wl,-subsystem,console
++QMAKE_LFLAGS_WINDOWS    = -Wl,-subsystem,windows
++QMAKE_LFLAGS_DLL        = -shared
++QMAKE_LFLAGS_CXX11      =
++QMAKE_LFLAGS_CXX14      =
++QMAKE_LFLAGS_CXX1Z      =
++QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections
++equals(QMAKE_HOST.os, Windows) {
++    QMAKE_LINK_OBJECT_MAX = 10
++    QMAKE_LINK_OBJECT_SCRIPT = object_script
++}
++QMAKE_PREFIX_SHLIB      =
++QMAKE_EXTENSION_SHLIB   = dll
++QMAKE_PREFIX_STATICLIB  = lib
++QMAKE_EXTENSION_STATICLIB = a
++QMAKE_LIB_EXTENSIONS    = a dll.a
++
++QMAKE_LIBS              =
++QMAKE_LIBS_CORE         = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
++QMAKE_LIBS_GUI          = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32
++QMAKE_LIBS_NETWORK      = -lws2_32
++QMAKE_LIBS_OPENGL       = -lglu32 -lopengl32 -lgdi32 -luser32
++QMAKE_LIBS_OPENGL_ES2   = -l$${LIBEGL_NAME} -l$${LIBGLESV2_NAME} -lgdi32 -luser32
++QMAKE_LIBS_OPENGL_ES2_DEBUG = -l$${LIBEGL_NAME}d -l$${LIBGLESV2_NAME}d -lgdi32 -luser32
++QMAKE_LIBS_COMPAT       = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32
++QMAKE_LIBS_QT_ENTRY     = -lmingw32 -lqtmain
++
++QMAKE_IDL               = midl
++QMAKE_LIB               = $${CROSS_COMPILE}ar -rc
++QMAKE_RC                = $${CROSS_COMPILE}windres
++
++QMAKE_STRIP             = $${CROSS_COMPILE}strip
++QMAKE_STRIPFLAGS_LIB   += --strip-unneeded
++QMAKE_OBJCOPY           = $${CROSS_COMPILE}objcopy
++QMAKE_NM                = $${CROSS_COMPILE}nm -P
++load(qt_config)
+diff --git a/mkspecs/win32-clang-g++/qplatformdefs.h b/mkspecs/win32-clang-g++/qplatformdefs.h
+new file mode 100644
+index 0000000000..906e724c19
+--- /dev/null
++++ b/mkspecs/win32-clang-g++/qplatformdefs.h
+@@ -0,0 +1,40 @@
++/****************************************************************************
++**
++** Copyright (C) 2018 The Qt Company Ltd.
++** Contact: https://www.qt.io/licensing/
++**
++** This file is part of the qmake spec of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:LGPL$
++** Commercial License Usage
++** Licensees holding valid commercial Qt licenses may use this file in
++** accordance with the commercial license agreement provided with the
++** Software or, alternatively, in accordance with the terms contained in
++** a written agreement between you and The Qt Company. For licensing terms
++** and conditions see https://www.qt.io/terms-conditions. For further
++** information use the contact form at https://www.qt.io/contact-us.
++**
++** GNU Lesser General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU Lesser
++** General Public License version 3 as published by the Free Software
++** Foundation and appearing in the file LICENSE.LGPL3 included in the
++** packaging of this file. Please review the following information to
++** ensure the GNU Lesser General Public License version 3 requirements
++** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
++**
++** GNU General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU
++** General Public License version 2.0 or (at your option) the GNU General
++** Public license version 3 or any later version approved by the KDE Free
++** Qt Foundation. The licenses are as published by the Free Software
++** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
++** included in the packaging of this file. Please review the following
++** information to ensure the GNU General Public License requirements will
++** be met: https://www.gnu.org/licenses/gpl-2.0.html and
++** https://www.gnu.org/licenses/gpl-3.0.html.
++**
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++
++#include "../win32-g++/qplatformdefs.h"
+-- 
+2.14.3 (Apple Git-98)
+
index f9bba53..13b1545 100644 (file)
@@ -25,6 +25,12 @@ qt: qt-$(QT_VERSION).tar.xz .sum-qt
        $(APPLY) $(SRC)/qt/0001-Windows-QPA-Reimplement-calculation-of-window-frames_56.patch
        $(APPLY) $(SRC)/qt/0002-Windows-QPA-Use-new-EnableNonClientDpiScaling-for-Wi_56.patch
        $(APPLY) $(SRC)/qt/0003-QPA-prefer-lower-value-when-rounding-fractional-scaling.patch
+       $(APPLY) $(SRC)/qt/0004-qmake-don-t-limit-command-line-length-when-not-actua.patch
+       $(APPLY) $(SRC)/qt/0005-harfbuzz-Fix-building-for-win64-with-clang.patch
+       $(APPLY) $(SRC)/qt/0006-moc-Initialize-staticMetaObject-with-the-highest-use.patch
+       $(APPLY) $(SRC)/qt/0007-Only-define-QT_FASTCALL-on-x86_32.patch
+       $(APPLY) $(SRC)/qt/0008-Skip-arm-pixman-drawhelpers-on-windows-just-like-on-.patch
+       $(APPLY) $(SRC)/qt/0009-mkspecs-Add-a-win32-clang-g-mkspec-for-clang-targeti.patch
        $(APPLY) $(SRC)/qt/systray-no-sound.patch
        $(MOVE)