summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-09-17 08:32:43 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-09-17 08:32:43 +0200
commitd49d076431d7579ecb33147187fe07eb148112ba (patch)
tree668370fb9a2eec50000e371125136921ef4518ab /qmake
parentb01e69684b9b36492cc43472edeb72058be9f706 (diff)
parent35cdcddd605d8823b7b57129e8d7279133a3ca89 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp115
-rw-r--r--qmake/generators/mac/pbuilder_pbx.h2
-rw-r--r--qmake/generators/unix/unixmake2.cpp6
-rw-r--r--qmake/option.cpp5
4 files changed, 82 insertions, 46 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 28cf02344d..24e69444c9 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -509,6 +509,56 @@ static QList<QVariantMap> provisioningTeams()
return flatTeams;
}
+bool ProjectBuilderMakefileGenerator::replaceLibrarySuffix(const QString &lib_file,
+ const ProString &opt,
+ QString &name, QString &library)
+{
+ /* This isn't real nice, but it is real useful. This looks in a prl
+ for what the library will ultimately be called so we can stick it
+ in the ProjectFile. If the prl format ever changes (not likely) then
+ this will not really work. However, more concerning is that it will
+ encode the version number in the Project file which might be a bad
+ things in days to come? --Sam
+ */
+ if (lib_file.isEmpty())
+ return false;
+
+ QMakeMetaInfo libinfo;
+ if (!libinfo.readLib(lib_file) || libinfo.isEmpty("QMAKE_PRL_TARGET"))
+ return false;
+
+ const QString libDir = fileInfo(lib_file).absolutePath();
+ library = libDir + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");
+
+ debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)",
+ opt.toLatin1().constData(), lib_file.toLatin1().constData(), library.toLatin1().constData());
+
+ if (project->isActiveConfig("xcode_dynamic_library_suffix")) {
+ QString suffixSetting = project->first("QMAKE_XCODE_LIBRARY_SUFFIX_SETTING").toQString();
+ if (!suffixSetting.isEmpty()) {
+ QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
+ suffixSetting = "$(" + suffixSetting + ")";
+ if (!librarySuffix.isEmpty()) {
+ int pos = library.lastIndexOf(librarySuffix + '.');
+ if (pos == -1) {
+ warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.",
+ qPrintable(librarySuffix), qPrintable(library));
+ } else {
+ library.replace(pos, librarySuffix.length(), suffixSetting);
+ if (name.endsWith(librarySuffix))
+ name.chop(librarySuffix.length());
+ }
+ } else {
+ int pos = library.lastIndexOf(name);
+ if (pos != -1)
+ library.insert(pos + name.length(), suffixSetting);
+ }
+ }
+ }
+
+ return true;
+}
+
bool
ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
{
@@ -820,6 +870,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
}
if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES
+ const ProStringList defaultLibDirs = project->values("QMAKE_DEFAULT_LIBDIRS");
ProStringList &libdirs = project->values("QMAKE_PBX_LIBPATHS"),
&frameworkdirs = project->values("QMAKE_FRAMEWORKPATH");
static const char * const libs[] = { "LIBS", "LIBS_PRIVATE",
@@ -827,6 +878,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
for (int i = 0; libs[i]; i++) {
tmp = project->values(libs[i]);
for(int x = 0; x < tmp.count();) {
+ bool libSuffixReplaced = false;
bool remove = false;
QString library, name;
ProString opt = tmp[x];
@@ -839,49 +891,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
QString lib("lib" + name);
for (ProStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) {
if(project->isActiveConfig("link_prl")) {
- /* This isn't real nice, but it is real useful. This looks in a prl
- for what the library will ultimately be called so we can stick it
- in the ProjectFile. If the prl format ever changes (not likely) then
- this will not really work. However, more concerning is that it will
- encode the version number in the Project file which might be a bad
- things in days to come? --Sam
- */
- QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath(
- (*lit) + Option::dir_sep + lib + Option::prl_ext));
- if (!lib_file.isEmpty()) {
- QMakeMetaInfo libinfo;
- if(libinfo.readLib(lib_file)) {
- if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
- library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");
- debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)",
- opt.toLatin1().constData(), lib_file.toLatin1().constData(), library.toLatin1().constData());
- remove = true;
-
- if (project->isActiveConfig("xcode_dynamic_library_suffix")) {
- QString suffixSetting = project->first("QMAKE_XCODE_LIBRARY_SUFFIX_SETTING").toQString();
- if (!suffixSetting.isEmpty()) {
- QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
- suffixSetting = "$(" + suffixSetting + ")";
- if (!librarySuffix.isEmpty()) {
- int pos = library.lastIndexOf(librarySuffix + '.');
- if (pos == -1) {
- warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.",
- qPrintable(librarySuffix), qPrintable(library));
- } else {
- library.replace(pos, librarySuffix.length(), suffixSetting);
- if (name.endsWith(librarySuffix))
- name.chop(librarySuffix.length());
- }
- } else {
- int pos = library.lastIndexOf(name);
- if (pos != -1)
- library.insert(pos + name.length(), suffixSetting);
- }
- }
- }
- }
- }
- }
+ const QString prlFilePath = QMakeMetaInfo::checkLib(
+ Option::normalizePath((*lit) + Option::dir_sep + lib
+ + Option::prl_ext));
+ if (replaceLibrarySuffix(prlFilePath, opt, name, library))
+ remove = true;
+ libSuffixReplaced = true;
}
if(!remove) {
QString extns[] = { ".dylib", ".so", ".a", QString() };
@@ -931,6 +946,16 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
}
}
if(!library.isEmpty()) {
+ if (!libSuffixReplaced) {
+ const QFileInfo fi = fileInfo(library);
+ const QString prlFilePath = QMakeMetaInfo::checkLib(
+ Option::normalizePath(fi.absolutePath() + '/' + fi.completeBaseName()
+ + Option::prl_ext));
+ if (!prlFilePath.isEmpty()) {
+ name = fi.completeBaseName().mid(3);
+ replaceLibrarySuffix(prlFilePath, opt, name, library);
+ }
+ }
const int slsh = library.lastIndexOf(Option::dir_sep);
if(name.isEmpty()) {
if(slsh != -1)
@@ -938,8 +963,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
}
if(slsh != -1) {
const QString path = QFileInfo(library.left(slsh)).absoluteFilePath();
- if(!path.isEmpty() && !libdirs.contains(path))
+ if (!path.isEmpty() && !libdirs.contains(path)
+ && !defaultLibDirs.contains(path)) {
libdirs += path;
+ }
}
library = fileFixify(library, FileFixifyFromOutdir | FileFixifyAbsolute);
QString key = keyFor(library);
diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h
index ac0d63606d..1b90a3bbeb 100644
--- a/qmake/generators/mac/pbuilder_pbx.h
+++ b/qmake/generators/mac/pbuilder_pbx.h
@@ -41,6 +41,8 @@ class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator
bool writeSubDirs(QTextStream &);
bool writeMakeParts(QTextStream &);
bool writeMakefile(QTextStream &) override;
+ bool replaceLibrarySuffix(const QString &lib_file, const ProString &opt, QString &name,
+ QString &library);
QString pbxbuild();
QHash<QString, QString> keys;
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 8b4f2bf58f..ccb601d4b8 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1199,8 +1199,10 @@ void UnixMakefileGenerator::init2()
project->values("QMAKE_FRAMEWORK_VERSION").append(project->first("VER_MAJ"));
if (project->first("TEMPLATE") == "aux") {
- project->values("PRL_TARGET") =
- project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB"));
+ project->values("PRL_TARGET") = {
+ project->first("QMAKE_PREFIX_STATICLIB") +
+ project->first("TARGET")
+ };
} else if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
if(!project->isEmpty("QMAKE_BUNDLE")) {
ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION");
diff --git a/qmake/option.cpp b/qmake/option.cpp
index d8143468e6..9ec2fe6411 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -658,4 +658,9 @@ QString qmake_libraryInfoFile()
return QString();
}
+QString qmake_abslocation()
+{
+ return Option::globals->qmake_abslocation;
+}
+
QT_END_NAMESPACE