From 30d1522b7a0ae99384457638ba875605705b786d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 1 Jun 2012 11:08:52 +0200 Subject: resolve real qmakespec name right after loading it this is cleaner than resolving it on-demand, as it avoids statics (with potential side effects on dynamic spec switching). Change-Id: I2bc15a4c3108376e1b4a01351875fe0c445ee5d5 Reviewed-by: Mark Brand --- qmake/project.cpp | 45 ++++++++++----------------------------------- qmake/project.h | 2 +- 2 files changed, 11 insertions(+), 36 deletions(-) (limited to 'qmake') diff --git a/qmake/project.cpp b/qmake/project.cpp index 0024234bf4..a909c04a9a 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1474,6 +1474,15 @@ QMakeProject::read(uchar cmd) fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.toLatin1().constData()); return false; } +#ifdef Q_OS_UNIX + real_spec = QFileInfo(qmakespec).canonicalFilePath(); +#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. + QString orig_spec = first(QLatin1String("QMAKESPEC_ORIGINAL")); + real_spec = orig_spec.isEmpty() ? qmakespec : orig_spec; +#endif + short_spec = QFileInfo(real_spec).fileName(); doProjectInclude("spec_post", IncludeFlagFeature, vars); // The spec extends the feature search path, so invalidate the cache. invalidateFeatureRoots(); @@ -1594,36 +1603,6 @@ QMakeProject::read(uchar cmd) return true; } -void -QMakeProject::resolveSpec(QString *spec, const QString &qmakespec) -{ - if (spec->isEmpty()) { - *spec = QFileInfo(qmakespec).fileName(); - if (*spec == "default" || *spec == "default-host") { -#ifdef Q_OS_UNIX - char buffer[1024]; - int l = readlink(qmakespec.toLatin1().constData(), buffer, 1023); - if (l != -1) { - buffer[l] = '\0'; - *spec = QString::fromLatin1(buffer); -#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 = vars["QMAKESPEC_ORIGINAL"]; - if (spec_org.isEmpty()) { - // try again the next time around - *spec = QString(); - } else { - *spec = spec_org.at(0); -#endif - int lastSlash = spec->lastIndexOf(QLatin1Char('/')); - if (lastSlash != -1) - spec->remove(0, lastSlash + 1); - } - } - } -} - bool QMakeProject::isActiveConfig(const QString &x, bool regex, QHash *place) { @@ -1640,12 +1619,8 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QHash &place); - void resolveSpec(QString *spec, const QString &qmakespec); QStringList qmakeFeaturePaths(); public: -- cgit v1.2.3