From f71170aa35ad37fdee2def64c72c60806f92d00d Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 2 Oct 2012 19:22:17 +0200 Subject: Tools: add QLibraryInfo to the bootstrapped library. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For future use by qdoc. Change-Id: Id9079a6fa581ff16810df9a8f2bb94314ee11ca9 Reviewed-by: Tor Arne Vestbø --- qmake/option.cpp | 2 +- src/corelib/global/qlibraryinfo.cpp | 40 ++++++++++++++++++++++--------------- src/corelib/global/qlibraryinfo.h | 4 ++-- src/tools/bootstrap/bootstrap.pro | 14 +++++++++---- 4 files changed, 37 insertions(+), 23 deletions(-) diff --git a/qmake/option.cpp b/qmake/option.cpp index 561df8eebd..91c154ab6c 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -645,7 +645,7 @@ qmakeAddCacheClear(qmakeCacheClearFunc func, void **data) cache_items.append(new QMakeCacheClearItem(func, data)); } -QString qmake_libraryInfoFile() +QString qt_libraryInfoFile() { if (!Option::globals->qmake_abslocation.isEmpty()) return QDir(QFileInfo(Option::globals->qmake_abslocation).absolutePath()).filePath("qt.conf"); diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index e333b426ac..3f01425570 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -47,8 +47,16 @@ #ifdef QT_BUILD_QMAKE QT_BEGIN_NAMESPACE -extern QString qmake_libraryInfoFile(); +extern QString qt_libraryInfoFile(); QT_END_NAMESPACE +#elif defined(QT_BOOTSTRAPPED) +QString qt_libraryInfoFile() +{ + QString qmakeAbsoluteLocation = QLatin1String(QT_QMAKE_LOCATION); + if (!qmakeAbsoluteLocation.isEmpty()) + return QDir(QFileInfo(qmakeAbsoluteLocation).absolutePath()).filePath(QLatin1String("qt.conf")); + return QString(); +} #else # include "qcoreapplication.h" #endif @@ -69,7 +77,7 @@ struct QLibrarySettings { QLibrarySettings(); QScopedPointer settings; -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED bool haveEffectivePaths; bool havePaths; #endif @@ -80,7 +88,7 @@ class QLibraryInfoPrivate { public: static QSettings *findConfiguration(); -#ifndef QT_BUILD_QMAKE +#ifndef QT_BOOTSTRAPPED static void cleanup() { QLibrarySettings *ls = qt_library_settings(); @@ -105,7 +113,7 @@ public: QLibrarySettings::QLibrarySettings() : settings(QLibraryInfoPrivate::findConfiguration()) { -#ifndef QT_BUILD_QMAKE +#ifndef QT_BOOTSTRAPPED qAddPostRoutine(QLibraryInfoPrivate::cleanup); bool haveEffectivePaths; bool havePaths; @@ -117,7 +125,7 @@ QLibrarySettings::QLibrarySettings() haveEffectivePaths = children.contains(QLatin1String("EffectivePaths")); // Backwards compat: an existing but empty file is claimed to contain the Paths section. havePaths = !haveEffectivePaths || children.contains(QLatin1String("Paths")); -#ifndef QT_BUILD_QMAKE +#ifndef QT_BOOTSTRAPPED if (!havePaths) settings.reset(0); #else @@ -131,9 +139,9 @@ QLibrarySettings::QLibrarySettings() QSettings *QLibraryInfoPrivate::findConfiguration() { QString qtconfig = QStringLiteral(":/qt/etc/qt.conf"); -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED if(!QFile::exists(qtconfig)) - qtconfig = qmake_libraryInfoFile(); + qtconfig = qt_libraryInfoFile(); #else if (!QFile::exists(qtconfig) && QCoreApplication::instance()) { #ifdef Q_OS_MAC @@ -181,7 +189,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration() \sa QSysInfo, {Using qt.conf} */ -#ifndef QT_BUILD_QMAKE +#ifndef QT_BOOTSTRAPPED /*! \internal @@ -246,7 +254,7 @@ QLibraryInfo::isDebugBuild() return false; } -#endif // QT_BUILD_QMAKE +#endif // QT_BOOTSTRAPPED static const struct { char key[14], value[13]; @@ -262,7 +270,7 @@ static const struct { { "Translations", "translations" }, { "Examples", "examples" }, { "Tests", "tests" }, -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED { "Sysroot", "" }, { "HostPrefix", "" }, { "HostBinaries", "bin" }, @@ -277,7 +285,7 @@ static const struct { QString QLibraryInfo::location(LibraryLocation loc) { -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED QString ret = rawLocation(loc, FinalPaths); // Automatically prepend the sysroot to target paths @@ -301,7 +309,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) # define group dummy #endif QString ret; -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED // Logic for choosing the right data source: if EffectivePaths are requested // and qt.conf with that section is present, use it, otherwise fall back to // FinalPaths. For FinalPaths, use qt.conf if present and contains not only @@ -339,14 +347,14 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) if(!key.isNull()) { QSettings *config = QLibraryInfoPrivate::configuration(); config->beginGroup(QLatin1String( -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED group == EffectivePaths ? "EffectivePaths" : #endif "Paths")); ret = config->value(key, defaultValue).toString(); -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED if (ret.isEmpty() && loc == HostPrefixPath) ret = config->value(QLatin1String(qtConfEntries[PrefixPath].key), QLatin1String(qtConfEntries[PrefixPath].value)).toString(); @@ -371,12 +379,12 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) if (!ret.isEmpty() && QDir::isRelativePath(ret)) { QString baseDir; -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED if (loc == HostPrefixPath || loc == PrefixPath || loc == SysrootPath) { // We make the prefix/sysroot path absolute to the executable's directory. // loc == PrefixPath while a sysroot is set would make no sense here. // loc == SysrootPath only makes sense if qmake lives inside the sysroot itself. - baseDir = QFileInfo(qmake_libraryInfoFile()).absolutePath(); + baseDir = QFileInfo(qt_libraryInfoFile()).absolutePath(); } else if (loc > SysrootPath && loc <= LastHostPath) { // We make any other host path absolute to the host prefix directory. baseDir = rawLocation(HostPrefixPath, group); diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 62395662ac..1d9b809207 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -75,7 +75,7 @@ public: ExamplesPath, TestsPath, // Insert new values above this line -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED // These are not subject to binary compatibility constraints SysrootPath, HostPrefixPath, @@ -86,7 +86,7 @@ public: SettingsPath = 100 }; static QString location(LibraryLocation); // ### Qt 6: consider renaming it to path() -#ifdef QT_BUILD_QMAKE +#ifdef QT_BOOTSTRAPPED enum PathGroup { FinalPaths, EffectivePaths }; static QString rawLocation(LibraryLocation, PathGroup); #endif diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 0aa9436d03..b5005991ec 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -22,12 +22,14 @@ DEFINES += \ QT_NO_THREAD \ QT_NO_UNICODETABLES \ QT_NO_USING_NAMESPACE \ - QT_NO_DEPRECATED + QT_NO_DEPRECATED \ + QT_QMAKE_LOCATION=\\\"$$QMAKE_QMAKE\\\" INCLUDEPATH += $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ $$QT_BUILD_TREE/include/QtCore/$$QT_VERSION \ - $$QT_BUILD_TREE/include/QtCore/$$QT_VERSION/QtCore + $$QT_BUILD_TREE/include/QtCore/$$QT_VERSION/QtCore \ + $$QT_BUILD_TREE/src/corelib/global DEPENDPATH += $$INCLUDEPATH \ ../../corelib/global \ @@ -42,6 +44,7 @@ SOURCES += \ ../../corelib/codecs/qtextcodec.cpp \ ../../corelib/codecs/qutfcodec.cpp \ ../../corelib/global/qglobal.cpp \ + ../../corelib/global/qlibraryinfo.cpp \ ../../corelib/global/qlogging.cpp \ ../../corelib/global/qmalloc.cpp \ ../../corelib/global/qnumeric.cpp \ @@ -58,6 +61,7 @@ SOURCES += \ ../../corelib/io/qfsfileengine_iterator.cpp \ ../../corelib/io/qiodevice.cpp \ ../../corelib/io/qfiledevice.cpp \ + ../../corelib/io/qsettings.cpp \ ../../corelib/io/qtemporaryfile.cpp \ ../../corelib/io/qtextstream.cpp \ ../../corelib/kernel/qcoreglobaldata.cpp \ @@ -101,11 +105,13 @@ unix:SOURCES += ../../corelib/io/qfilesystemengine_unix.cpp \ win32:SOURCES += ../../corelib/io/qfilesystemengine_win.cpp \ ../../corelib/io/qfilesystemiterator_win.cpp \ ../../corelib/io/qfsfileengine_win.cpp \ + ../../corelib/io/qsettings_win.cpp \ ../../corelib/plugin/qsystemlibrary.cpp \ macx: { - SOURCES += ../../corelib/io/qfilesystemengine_mac.cpp - SOURCES += ../../corelib/kernel/qcore_mac.cpp + SOURCES += ../../corelib/io/qfilesystemengine_mac.cpp \ + ../../corelib/io/qsettings_mac.cpp \ + ../../corelib/kernel/qcore_mac.cpp LIBS += -framework CoreServices } -- cgit v1.2.3