[vlc-devel] [PATCH 3.0 38/41] contrib: qt: fix building for Windows

Steve Lhomme robux4 at ycbcr.xyz
Tue Jul 7 15:11:37 CEST 2020


Backport a0d8fb4ac3cb7bafdb39f340055eacee4f957513 from Qt 5.15

Qt5 generates the .pc for debug and release targets even when only the release
target is selected. The debug target overwrote the release .pc files with the
wrong libraries built.

(cherry picked from commit afea992cb2c337b56c4667eb62fa440acec29145) (rebased)

rebased:
- this branch doesn't have ANGLE patches before

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
---
 ...pkgconfig-file-and-dependency-naming.patch | 51 +++++++++++++++++++
 contrib/src/qt/rules.mak                      |  1 +
 2 files changed, 52 insertions(+)
 create mode 100644 contrib/src/qt/fix-mingw-pkgconfig-file-and-dependency-naming.patch

diff --git a/contrib/src/qt/fix-mingw-pkgconfig-file-and-dependency-naming.patch b/contrib/src/qt/fix-mingw-pkgconfig-file-and-dependency-naming.patch
new file mode 100644
index 0000000000..4660f3ca76
--- /dev/null
+++ b/contrib/src/qt/fix-mingw-pkgconfig-file-and-dependency-naming.patch
@@ -0,0 +1,51 @@
+From a0d8fb4ac3cb7bafdb39f340055eacee4f957513 Mon Sep 17 00:00:00 2001
+From: Kai Pastor <dg0yt at darc.de>
+Date: Wed, 30 Jan 2019 07:36:51 +0100
+Subject: [PATCH] Fix mingw pkgconfig file and dependency naming
+
+This change adds the correct suffix to debug mode .pc filenames for
+MinGW and also to the Qt libraries listed in the `Requires` field.
+The filename adjustment fixes the accidental overwriting of release
+mode .pc files with the debug mode variant which required the wrong
+variant of the libraries when `debug_and_release` is active.
+
+Note that macOS also supports the `debug_and_release' configuration
+but may use the regular library names together with DYLD_IMAGE_SUFFIX.
+Creation of *_debug.pc files is turned off as they're identical to their
+non-debug counterparts.
+
+[ChangeLog][Platform Specific Changes][MinGW] Added a suffix to debug
+mode pkgconfig files.
+
+Task-number: QTBUG-4155
+Change-Id: I221c2dae51d7bd011836cb03945631a43180d7b5
+Reviewed-by: Kai Koehne <kai.koehne at qt.io>
+---
+ mkspecs/features/qt_module.prf | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
+index a52a4486bc5..213556904d2 100644
+--- a/mkspecs/features/qt_module.prf
++++ b/mkspecs/features/qt_module.prf
+@@ -264,7 +264,7 @@ load(qt_installs)
+ load(qt_targets)
+ 
+ # this builds on top of qt_common
+-!internal_module:if(unix|mingw) {
++!internal_module:if(unix|mingw):!if(darwin:debug_and_release:CONFIG(debug, debug|release)) {
+     CONFIG += create_pc
+     QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+     host_build: \
+@@ -281,9 +281,9 @@ load(qt_targets)
+             QMAKE_PKGCONFIG_CFLAGS += -I${includedir}/$$section(inc, /, 1, 1)
+     }
+     QMAKE_PKGCONFIG_NAME = $$replace(TARGET, ^Qt, "Qt$$QT_MAJOR_VERSION ")
+-    QMAKE_PKGCONFIG_FILE = $$replace(TARGET, ^Qt, Qt$$QT_MAJOR_VERSION)
++    QMAKE_PKGCONFIG_FILE = $$replace(TARGET, ^Qt, Qt$$QT_MAJOR_VERSION)$$qtPlatformTargetSuffix()
+     for(i, MODULE_DEPENDS): \
+-        QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$section(QT.$${i}.VERSION, ., 0, 0))
++        QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$section(QT.$${i}.VERSION, ., 0, 0))$$qtPlatformTargetSuffix()
+     isEmpty(QMAKE_PKGCONFIG_DESCRIPTION): \
+         QMAKE_PKGCONFIG_DESCRIPTION = $$replace(TARGET, ^Qt, "Qt ") module
+     pclib_replace.match = $$lib_replace.match
diff --git a/contrib/src/qt/rules.mak b/contrib/src/qt/rules.mak
index 53c90738c6..3d7ff70a88 100644
--- a/contrib/src/qt/rules.mak
+++ b/contrib/src/qt/rules.mak
@@ -30,6 +30,7 @@ ifdef HAVE_WIN32
 ifndef HAVE_WIN64
 	$(APPLY) $(SRC)/qt/0001-disable-qt_random_cpu.patch
 endif
+	$(APPLY) $(SRC)/qt/fix-mingw-pkgconfig-file-and-dependency-naming.patch
 
 ifndef HAVE_CROSS_COMPILE
 	cd $(UNPACK_DIR); for i in QtFontDatabaseSupport QtWindowsUIAutomationSupport QtEventDispatcherSupport QtCore; do \
-- 
2.26.2



More information about the vlc-devel mailing list