1
0
forked from pool/libqt5-qtbase
libqt5-qtbase/0002-Do-not-write-Libs-into-.pc-files-if-TEMPLATE-is-not-.patch

104 lines
4.4 KiB
Diff

From c64f8ca232cc1f2131282d9eb6279ef9b565be88 Mon Sep 17 00:00:00 2001
From: Joerg Bornemann <joerg.bornemann@qt.io>
Date: Mon, 3 Jun 2019 14:52:49 +0200
Subject: Do not write 'Libs:' into .pc files if TEMPLATE is not 'lib'
Especially for header modules we don't want a 'Libs:' entry in their
.pc file.
Task-number: QTBUG-75901
Change-Id: I39037d3132e39dd360532e1425f794ebec28e0bd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
---
qmake/generators/makefile.cpp | 74 ++++++++++++++++++++++---------------------
1 file changed, 38 insertions(+), 36 deletions(-)
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 6edaf1f70e..4a99a60892 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -3359,42 +3359,44 @@ MakefileGenerator::writePkgConfigFile()
if (!version.isEmpty())
t << "Version: " << version << endl;
- // libs
- t << "Libs: ";
- QString pkgConfiglibName;
- if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) {
- if (libDir != QLatin1String("/Library/Frameworks"))
- t << "-F${libdir} ";
- ProString bundle;
- if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
- bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
- else
- bundle = project->first("TARGET");
- int suffix = bundle.lastIndexOf(".framework");
- if (suffix != -1)
- bundle = bundle.left(suffix);
- t << "-framework ";
- pkgConfiglibName = bundle.toQString();
- } else {
- if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir))
- t << "-L${libdir} ";
- pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET");
- if (project->isActiveConfig("shared"))
- pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString();
- }
- t << shellQuote(pkgConfiglibName) << " \n";
-
- if (project->isActiveConfig("staticlib")) {
- ProStringList libs;
- libs << "LIBS"; // FIXME: this should not be conditional on staticlib
- libs << "LIBS_PRIVATE";
- libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib
- libs << "QMAKE_LIBS_PRIVATE";
- libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
- t << "Libs.private:";
- for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
- t << ' ' << fixLibFlags((*it).toKey()).join(' ');
- t << endl;
+ if (project->first("TEMPLATE") == "lib") {
+ // libs
+ t << "Libs: ";
+ QString pkgConfiglibName;
+ if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) {
+ if (libDir != QLatin1String("/Library/Frameworks"))
+ t << "-F${libdir} ";
+ ProString bundle;
+ if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
+ bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
+ else
+ bundle = project->first("TARGET");
+ int suffix = bundle.lastIndexOf(".framework");
+ if (suffix != -1)
+ bundle = bundle.left(suffix);
+ t << "-framework ";
+ pkgConfiglibName = bundle.toQString();
+ } else {
+ if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir))
+ t << "-L${libdir} ";
+ pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET");
+ if (project->isActiveConfig("shared"))
+ pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString();
+ }
+ t << shellQuote(pkgConfiglibName) << " \n";
+
+ if (project->isActiveConfig("staticlib")) {
+ ProStringList libs;
+ libs << "LIBS"; // FIXME: this should not be conditional on staticlib
+ libs << "LIBS_PRIVATE";
+ libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib
+ libs << "QMAKE_LIBS_PRIVATE";
+ libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
+ t << "Libs.private:";
+ for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it)
+ t << ' ' << fixLibFlags((*it).toKey()).join(' ');
+ t << endl;
+ }
}
// flags
--
cgit v1.2.1