contrib: qt: Backport two patches, fixing the mingw pkg-config files

Previously, the pkg-config files contained a broken "-D_UNICODE>",
which caused build warnings on all Qt source files in VLC, like this:

    In file included from <built-in>:464:
    <command line>:16:17: warning: ISO C99 requires whitespace after the macro name [-Wc99-extensions]
       16 | #define _UNICODE> 1
          |                 ^

Backport a fix from upstream, getting rid of this. Also backport
another patch to add a missing include statement.
This commit is contained in:
Martin Storsjö 2024-04-09 14:12:51 +03:00
parent 3502c02a1d
commit 48f6723f41
3 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,38 @@
From 55a7e34d7b4eeafb3465d9869920dc88dbc3a6e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Tue, 9 Apr 2024 14:03:29 +0300
Subject: [PATCH 2/3] QStringTokenizer: Add a missing include
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This header uses std::forward_iterator_tag, which requires including
the <iterator> header.
This fixes building with libc++ with
_LIBCPP_REMOVE_TRANSITIVE_INCLUDES enabled.
Pick-to: 6.7 6.5 6.2
Change-Id: Id2ce97e158c87dab1efe30e54a93f0bc9351de5a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit aa896ca9f51252b6d01766e19a03e41bd49857f3)
---
src/corelib/text/qstringtokenizer.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/corelib/text/qstringtokenizer.h b/src/corelib/text/qstringtokenizer.h
index 2b679608f9..7a627b4508 100644
--- a/src/corelib/text/qstringtokenizer.h
+++ b/src/corelib/text/qstringtokenizer.h
@@ -5,6 +5,7 @@
#include <QtCore/qnamespace.h>
#include <QtCore/qcontainerfwd.h>
+#include <iterator>
QT_BEGIN_NAMESPACE
--
2.25.1

View File

@ -0,0 +1,57 @@
From ba1059325eedba710d933fa0be4af1e6a4056aac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Tue, 9 Apr 2024 15:38:02 +0300
Subject: [PATCH 3/3] CMake: Fix a misplaced > in pkg-config files
The Qt CMake routines for generating pkg-config files don't
handle all sorts of generator expressions, see
qt_internal_set_pkg_config_cpp_flags in QtPkgConfigHelpers.cmake
which hardcodes handling of some specific expressions. In this
case, they don't handle the semicolon within the generator
expression expansion.
For the UNICODE and _UNICODE defines, this means that the pkg-config
file ends up containing "-D_UNICODE>" with the trailing ">". (The
pkg-config generator tries to parse out the generator expressions,
but the semicolon gets handled as a higher level separator, leaving
the closing bracket ">" behind.)
This issue only shows up for mingw targets, because pkg-config files
aren't generated in MSVC style builds.
Escape the semicolon as $<SEMICOLON> to make it not break the
surrounding generator expression, as parsed by the pkg-config file
generator.
The generator expressions aren't fully correctly evaluated for the
pkg-config files though; the UNICODE and _UNICODE defines don't
end up in the resulting pkg-config file even though they're used
during compilation (both before and after this change).
Fixes: QTBUG-103019
Co-authored-by: Martin Reboredo <yakoyoku@gmail.com>
Pick-to: 6.7 6.5 6.2
Change-Id: Icdb380e3b42be2a47372a8ee2b61378a33c685f7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Li Xinwei <1326710505@qq.com>
(cherry picked from commit f35b9530b9acf954f8741d0ee2b4b68fc90a4afc)
---
cmake/QtFlagHandlingHelpers.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/QtFlagHandlingHelpers.cmake b/cmake/QtFlagHandlingHelpers.cmake
index 91e1de8644..cdbaaacad4 100644
--- a/cmake/QtFlagHandlingHelpers.cmake
+++ b/cmake/QtFlagHandlingHelpers.cmake
@@ -365,7 +365,7 @@ function(qt_internal_enable_unicode_defines)
set(no_unicode_condition
"$<NOT:$<BOOL:$<TARGET_PROPERTY:QT_NO_UNICODE_DEFINES>>>")
target_compile_definitions(Platform
- INTERFACE "$<${no_unicode_condition}:UNICODE;_UNICODE>")
+ INTERFACE "$<${no_unicode_condition}:UNICODE$<SEMICOLON>_UNICODE>")
endif()
endfunction()
--
2.25.1

View File

@ -52,6 +52,8 @@ qt: qtbase-everywhere-src-$(QTBASE_VERSION_FULL).tar.xz .sum-qt
$(APPLY) $(SRC)/qt/0008-Try-to-satisfy-Windows-7-compatibility.patch
$(APPLY) $(SRC)/qt/0001-disable-precompiled-headers-when-forcing-WINVER-inte.patch
$(APPLY) $(SRC)/qt/0001-QTypeInfo-Add-a-missing-include.patch
$(APPLY) $(SRC)/qt/0002-QStringTokenizer-Add-a-missing-include.patch
$(APPLY) $(SRC)/qt/0003-CMake-Fix-a-misplaced-in-pkg-config-files.patch
$(MOVE)
QTBASE_CONFIG := -release