From caedef35e2503a9a04dc35e0221e1d9d5e10093e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Date: Wed, 10 Feb 2010 15:35:57 +0100 Subject: [PATCH] fix conditionals on the qmakespec - match just the spec name without a possible path - resolve the default spec --- src/shared/proparser/profileevaluator.cpp | 23 +++++++++++++++++++++-- src/shared/proparser/profileevaluator.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 6a693cedcd3..a7d3bbad819 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -1307,6 +1307,25 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitProFile(ProFile *pro) evaluateFileInto(m_option->cachefile, &m_option->base_valuemap, &m_option->base_functions); } + m_option->qmakespec_name = IoUtils::fileName(m_option->qmakespec).toString(); + if (m_option->qmakespec_name == QLatin1String("default")) { +#ifdef Q_OS_UNIX + char buffer[1024]; + int l = ::readlink(m_option->qmakespec.toLatin1().constData(), buffer, 1024); + if (l != -1) + m_option->qmakespec_name = + IoUtils::fileName(QString::fromLatin1(buffer, l)).toString(); +#else + // We can't resolve symlinks as they do on Unix, so configure.exe puts + // the source of the qmake.conf at the end of the default/qmake.conf in + // the QMAKESPEC_ORG variable. + const QStringList &spec_org = + m_option->base_valuemap.value(QLatin1String("QMAKESPEC_ORIGINAL")); + if (!spec_org.isEmpty()) + m_option->qmakespec_name = + IoUtils::fileName(spec_org.first()).toString(); +#endif + } } evaluateFeatureFile(QLatin1String("default_pre.prf"), @@ -1819,7 +1838,7 @@ bool ProFileEvaluator::Private::isActiveConfig(const QString &config, bool regex if (regex && (config.contains(QLatin1Char('*')) || config.contains(QLatin1Char('?')))) { QRegExp re(config, Qt::CaseSensitive, QRegExp::Wildcard); - if (re.exactMatch(m_option->qmakespec)) + if (re.exactMatch(m_option->qmakespec_name)) return true; // CONFIG variable @@ -1829,7 +1848,7 @@ bool ProFileEvaluator::Private::isActiveConfig(const QString &config, bool regex } } else { // mkspecs - if (m_option->qmakespec == config) + if (m_option->qmakespec_name == config) return true; // CONFIG variable diff --git a/src/shared/proparser/profileevaluator.h b/src/shared/proparser/profileevaluator.h index eb3b2761c1e..8a42975b644 100644 --- a/src/shared/proparser/profileevaluator.h +++ b/src/shared/proparser/profileevaluator.h @@ -161,6 +161,7 @@ struct ProFileOption QHash<QString, QStringList> base_valuemap; // Cached results of qmake.conf, .qmake.cache & default_pre.prf ProFileEvaluator::FunctionDefs base_functions; QStringList feature_roots; + QString qmakespec_name; }; QT_END_NAMESPACE -- GitLab