From d8b2998daeab9bfb7bfb5182960ec09b94885b17 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 9 May 2012 12:47:02 +0200 Subject: Revert "move finding the makespec to Option" Needed for an upcoming revert. This reverts commit 74a6669fa7c0d6e2cb7d34d56332d620d2a07755. Conflicts: qmake/option.cpp qmake/project.cpp qmake/property.cpp Change-Id: I56088506d27bf1f095f9261c75224f4bee17ec60 Reviewed-by: Joerg Bornemann --- qmake/option.cpp | 46 ---------------------------------------------- qmake/option.h | 2 -- qmake/project.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ qmake/property.cpp | 4 +++- 4 files changed, 46 insertions(+), 49 deletions(-) (limited to 'qmake') diff --git a/qmake/option.cpp b/qmake/option.cpp index b2a1e6982f..3ddde2a11a 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -583,49 +583,6 @@ void Option::applyHostMode() } } -QStringList Option::mkspecPaths() -{ - QStringList ret; - const QString concat = QLatin1String("/mkspecs"); - - QByteArray qmakepath = qgetenv("QMAKEPATH"); - if (!qmakepath.isEmpty()) { - const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath)); - for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it) - ret << ((*it) + concat); - } - if (!Option::mkfile::project_build_root.isEmpty()) - ret << Option::mkfile::project_build_root + concat; - if (!Option::mkfile::project_root.isEmpty()) - ret << Option::mkfile::project_root + concat; - ret << QLibraryInfo::location(QLibraryInfo::HostDataPath) + concat; - ret.removeDuplicates(); - return ret; -} - -bool Option::resolveSpec(QString *spec) -{ - QString qmakespec = fixEnvVariables(*spec); - if (qmakespec.isEmpty()) - qmakespec = "default"; - if (QDir::isRelativePath(qmakespec)) { - QStringList mkspec_roots = mkspecPaths(); - debug_msg(2, "Looking for mkspec %s in (%s)", qmakespec.toLatin1().constData(), - mkspec_roots.join("::").toLatin1().constData()); - for (QStringList::ConstIterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { - QString mkspec = (*it) + QLatin1Char('/') + qmakespec; - if (QFile::exists(mkspec)) { - *spec = mkspec; - return true; - } - } - fprintf(stderr, "Could not find mkspecs for your QMAKESPEC(%s) after trying:\n\t%s\n", - qmakespec.toLatin1().constData(), mkspec_roots.join("\n\t").toLatin1().constData()); - return false; - } - return true; -} - bool Option::prepareProject(const QString &pfile) { mkfile::project_build_root.clear(); @@ -679,9 +636,6 @@ bool Option::prepareProject(const QString &pfile) mkfile::project_root.clear(); } - if (!resolveSpec(&Option::mkfile::qmakespec)) - return false; - return true; } diff --git a/qmake/option.h b/qmake/option.h index 23384877fd..ce680b0d6a 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -109,7 +109,6 @@ struct Option //both of these must be called.. static int init(int argc=0, char **argv=0); //parse cmdline static void applyHostMode(); - static QStringList mkspecPaths(); static bool prepareProject(const QString &pfile); static bool postProcessProject(QMakeProject *); @@ -214,7 +213,6 @@ struct Option private: static int parseCommandLine(int, char **, int=0); - static bool resolveSpec(QString *spec); }; inline QString fixEnvVariables(const QString &x) { return Option::fixString(x, Option::FixEnvVars); } diff --git a/qmake/project.cpp b/qmake/project.cpp index 3df80bc00d..612acda2f4 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -602,6 +602,26 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0) return feature_roots; } +QStringList qmake_mkspec_paths() +{ + QStringList ret; + const QString concat = QLatin1String("/mkspecs"); + QByteArray qmakepath = qgetenv("QMAKEPATH"); + if (!qmakepath.isEmpty()) { + const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath)); + for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it) + ret << ((*it) + concat); + } + if (!Option::mkfile::project_build_root.isEmpty()) + ret << Option::mkfile::project_build_root + concat; + if (!Option::mkfile::project_root.isEmpty()) + ret << Option::mkfile::project_root + concat; + ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat; + ret.removeDuplicates(); + + return ret; +} + QMakeProject::~QMakeProject() { if(own_prop) @@ -1285,6 +1305,29 @@ QMakeProject::read(uchar cmd) } { // parse mkspec QString qmakespec = Option::mkfile::qmakespec; + if (qmakespec.isEmpty()) + qmakespec = "default"; + if (QDir::isRelativePath(qmakespec)) { + QStringList mkspec_roots = qmake_mkspec_paths(); + debug_msg(2, "Looking for mkspec %s in (%s)", qmakespec.toLatin1().constData(), + mkspec_roots.join("::").toLatin1().constData()); + bool found_mkspec = false; + for (QStringList::ConstIterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { + QString mkspec = (*it) + QLatin1Char('/') + qmakespec; + if (QFile::exists(mkspec)) { + found_mkspec = true; + Option::mkfile::qmakespec = qmakespec = mkspec; + break; + } + } + if (!found_mkspec) { + fprintf(stderr, "Could not find mkspecs for your QMAKESPEC(%s) after trying:\n\t%s\n", + qmakespec.toLatin1().constData(), mkspec_roots.join("\n\t").toLatin1().constData()); + return false; + } + } + + // parse qmake configuration while(qmakespec.endsWith(QLatin1Char('/'))) qmakespec.truncate(qmakespec.length()-1); QString spec = qmakespec + QLatin1String("/qmake.conf"); diff --git a/qmake/property.cpp b/qmake/property.cpp index 1952b5069b..076c45fc3c 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +QStringList qmake_mkspec_paths(); //project.cpp + static const struct { const char *name; QLibraryInfo::LibraryLocation loc; @@ -115,7 +117,7 @@ QMakeProperty::value(QString v, bool just_check) if (!val.isNull()) return val; else if(v == "QMAKE_MKSPECS") - return Option::mkspecPaths().join(Option::dirlist_sep); + return qmake_mkspec_paths().join(Option::dirlist_sep); else if(v == "QMAKE_VERSION") return qmake_version(); #ifdef QT_VERSION_STR -- cgit v1.2.3