Tools: add QLibraryInfo to the bootstrapped library.

For future use by qdoc.

Change-Id: Id9079a6fa581ff16810df9a8f2bb94314ee11ca9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
This commit is contained in:
Pierre Rossi 2012-10-02 19:22:17 +02:00 committed by The Qt Project
parent e0b5571b53
commit f71170aa35
4 changed files with 37 additions and 23 deletions

View File

@ -645,7 +645,7 @@ qmakeAddCacheClear(qmakeCacheClearFunc func, void **data)
cache_items.append(new QMakeCacheClearItem(func, data)); cache_items.append(new QMakeCacheClearItem(func, data));
} }
QString qmake_libraryInfoFile() QString qt_libraryInfoFile()
{ {
if (!Option::globals->qmake_abslocation.isEmpty()) if (!Option::globals->qmake_abslocation.isEmpty())
return QDir(QFileInfo(Option::globals->qmake_abslocation).absolutePath()).filePath("qt.conf"); return QDir(QFileInfo(Option::globals->qmake_abslocation).absolutePath()).filePath("qt.conf");

View File

@ -47,8 +47,16 @@
#ifdef QT_BUILD_QMAKE #ifdef QT_BUILD_QMAKE
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
extern QString qmake_libraryInfoFile(); extern QString qt_libraryInfoFile();
QT_END_NAMESPACE 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 #else
# include "qcoreapplication.h" # include "qcoreapplication.h"
#endif #endif
@ -69,7 +77,7 @@ struct QLibrarySettings
{ {
QLibrarySettings(); QLibrarySettings();
QScopedPointer<QSettings> settings; QScopedPointer<QSettings> settings;
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
bool haveEffectivePaths; bool haveEffectivePaths;
bool havePaths; bool havePaths;
#endif #endif
@ -80,7 +88,7 @@ class QLibraryInfoPrivate
{ {
public: public:
static QSettings *findConfiguration(); static QSettings *findConfiguration();
#ifndef QT_BUILD_QMAKE #ifndef QT_BOOTSTRAPPED
static void cleanup() static void cleanup()
{ {
QLibrarySettings *ls = qt_library_settings(); QLibrarySettings *ls = qt_library_settings();
@ -105,7 +113,7 @@ public:
QLibrarySettings::QLibrarySettings() QLibrarySettings::QLibrarySettings()
: settings(QLibraryInfoPrivate::findConfiguration()) : settings(QLibraryInfoPrivate::findConfiguration())
{ {
#ifndef QT_BUILD_QMAKE #ifndef QT_BOOTSTRAPPED
qAddPostRoutine(QLibraryInfoPrivate::cleanup); qAddPostRoutine(QLibraryInfoPrivate::cleanup);
bool haveEffectivePaths; bool haveEffectivePaths;
bool havePaths; bool havePaths;
@ -117,7 +125,7 @@ QLibrarySettings::QLibrarySettings()
haveEffectivePaths = children.contains(QLatin1String("EffectivePaths")); haveEffectivePaths = children.contains(QLatin1String("EffectivePaths"));
// Backwards compat: an existing but empty file is claimed to contain the Paths section. // Backwards compat: an existing but empty file is claimed to contain the Paths section.
havePaths = !haveEffectivePaths || children.contains(QLatin1String("Paths")); havePaths = !haveEffectivePaths || children.contains(QLatin1String("Paths"));
#ifndef QT_BUILD_QMAKE #ifndef QT_BOOTSTRAPPED
if (!havePaths) if (!havePaths)
settings.reset(0); settings.reset(0);
#else #else
@ -131,9 +139,9 @@ QLibrarySettings::QLibrarySettings()
QSettings *QLibraryInfoPrivate::findConfiguration() QSettings *QLibraryInfoPrivate::findConfiguration()
{ {
QString qtconfig = QStringLiteral(":/qt/etc/qt.conf"); QString qtconfig = QStringLiteral(":/qt/etc/qt.conf");
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
if(!QFile::exists(qtconfig)) if(!QFile::exists(qtconfig))
qtconfig = qmake_libraryInfoFile(); qtconfig = qt_libraryInfoFile();
#else #else
if (!QFile::exists(qtconfig) && QCoreApplication::instance()) { if (!QFile::exists(qtconfig) && QCoreApplication::instance()) {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@ -181,7 +189,7 @@ QSettings *QLibraryInfoPrivate::findConfiguration()
\sa QSysInfo, {Using qt.conf} \sa QSysInfo, {Using qt.conf}
*/ */
#ifndef QT_BUILD_QMAKE #ifndef QT_BOOTSTRAPPED
/*! /*!
\internal \internal
@ -246,7 +254,7 @@ QLibraryInfo::isDebugBuild()
return false; return false;
} }
#endif // QT_BUILD_QMAKE #endif // QT_BOOTSTRAPPED
static const struct { static const struct {
char key[14], value[13]; char key[14], value[13];
@ -262,7 +270,7 @@ static const struct {
{ "Translations", "translations" }, { "Translations", "translations" },
{ "Examples", "examples" }, { "Examples", "examples" },
{ "Tests", "tests" }, { "Tests", "tests" },
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
{ "Sysroot", "" }, { "Sysroot", "" },
{ "HostPrefix", "" }, { "HostPrefix", "" },
{ "HostBinaries", "bin" }, { "HostBinaries", "bin" },
@ -277,7 +285,7 @@ static const struct {
QString QString
QLibraryInfo::location(LibraryLocation loc) QLibraryInfo::location(LibraryLocation loc)
{ {
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
QString ret = rawLocation(loc, FinalPaths); QString ret = rawLocation(loc, FinalPaths);
// Automatically prepend the sysroot to target paths // Automatically prepend the sysroot to target paths
@ -301,7 +309,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
# define group dummy # define group dummy
#endif #endif
QString ret; QString ret;
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
// Logic for choosing the right data source: if EffectivePaths are requested // 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 // 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 // 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()) { if(!key.isNull()) {
QSettings *config = QLibraryInfoPrivate::configuration(); QSettings *config = QLibraryInfoPrivate::configuration();
config->beginGroup(QLatin1String( config->beginGroup(QLatin1String(
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
group == EffectivePaths ? "EffectivePaths" : group == EffectivePaths ? "EffectivePaths" :
#endif #endif
"Paths")); "Paths"));
ret = config->value(key, defaultValue).toString(); ret = config->value(key, defaultValue).toString();
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
if (ret.isEmpty() && loc == HostPrefixPath) if (ret.isEmpty() && loc == HostPrefixPath)
ret = config->value(QLatin1String(qtConfEntries[PrefixPath].key), ret = config->value(QLatin1String(qtConfEntries[PrefixPath].key),
QLatin1String(qtConfEntries[PrefixPath].value)).toString(); QLatin1String(qtConfEntries[PrefixPath].value)).toString();
@ -371,12 +379,12 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
if (!ret.isEmpty() && QDir::isRelativePath(ret)) { if (!ret.isEmpty() && QDir::isRelativePath(ret)) {
QString baseDir; QString baseDir;
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
if (loc == HostPrefixPath || loc == PrefixPath || loc == SysrootPath) { if (loc == HostPrefixPath || loc == PrefixPath || loc == SysrootPath) {
// We make the prefix/sysroot path absolute to the executable's directory. // 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 == PrefixPath while a sysroot is set would make no sense here.
// loc == SysrootPath only makes sense if qmake lives inside the sysroot itself. // 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) { } else if (loc > SysrootPath && loc <= LastHostPath) {
// We make any other host path absolute to the host prefix directory. // We make any other host path absolute to the host prefix directory.
baseDir = rawLocation(HostPrefixPath, group); baseDir = rawLocation(HostPrefixPath, group);

View File

@ -75,7 +75,7 @@ public:
ExamplesPath, ExamplesPath,
TestsPath, TestsPath,
// Insert new values above this line // Insert new values above this line
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
// These are not subject to binary compatibility constraints // These are not subject to binary compatibility constraints
SysrootPath, SysrootPath,
HostPrefixPath, HostPrefixPath,
@ -86,7 +86,7 @@ public:
SettingsPath = 100 SettingsPath = 100
}; };
static QString location(LibraryLocation); // ### Qt 6: consider renaming it to path() static QString location(LibraryLocation); // ### Qt 6: consider renaming it to path()
#ifdef QT_BUILD_QMAKE #ifdef QT_BOOTSTRAPPED
enum PathGroup { FinalPaths, EffectivePaths }; enum PathGroup { FinalPaths, EffectivePaths };
static QString rawLocation(LibraryLocation, PathGroup); static QString rawLocation(LibraryLocation, PathGroup);
#endif #endif

View File

@ -22,12 +22,14 @@ DEFINES += \
QT_NO_THREAD \ QT_NO_THREAD \
QT_NO_UNICODETABLES \ QT_NO_UNICODETABLES \
QT_NO_USING_NAMESPACE \ QT_NO_USING_NAMESPACE \
QT_NO_DEPRECATED QT_NO_DEPRECATED \
QT_QMAKE_LOCATION=\\\"$$QMAKE_QMAKE\\\"
INCLUDEPATH += $$QT_BUILD_TREE/include \ INCLUDEPATH += $$QT_BUILD_TREE/include \
$$QT_BUILD_TREE/include/QtCore \ $$QT_BUILD_TREE/include/QtCore \
$$QT_BUILD_TREE/include/QtCore/$$QT_VERSION \ $$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 \ DEPENDPATH += $$INCLUDEPATH \
../../corelib/global \ ../../corelib/global \
@ -42,6 +44,7 @@ SOURCES += \
../../corelib/codecs/qtextcodec.cpp \ ../../corelib/codecs/qtextcodec.cpp \
../../corelib/codecs/qutfcodec.cpp \ ../../corelib/codecs/qutfcodec.cpp \
../../corelib/global/qglobal.cpp \ ../../corelib/global/qglobal.cpp \
../../corelib/global/qlibraryinfo.cpp \
../../corelib/global/qlogging.cpp \ ../../corelib/global/qlogging.cpp \
../../corelib/global/qmalloc.cpp \ ../../corelib/global/qmalloc.cpp \
../../corelib/global/qnumeric.cpp \ ../../corelib/global/qnumeric.cpp \
@ -58,6 +61,7 @@ SOURCES += \
../../corelib/io/qfsfileengine_iterator.cpp \ ../../corelib/io/qfsfileengine_iterator.cpp \
../../corelib/io/qiodevice.cpp \ ../../corelib/io/qiodevice.cpp \
../../corelib/io/qfiledevice.cpp \ ../../corelib/io/qfiledevice.cpp \
../../corelib/io/qsettings.cpp \
../../corelib/io/qtemporaryfile.cpp \ ../../corelib/io/qtemporaryfile.cpp \
../../corelib/io/qtextstream.cpp \ ../../corelib/io/qtextstream.cpp \
../../corelib/kernel/qcoreglobaldata.cpp \ ../../corelib/kernel/qcoreglobaldata.cpp \
@ -101,11 +105,13 @@ unix:SOURCES += ../../corelib/io/qfilesystemengine_unix.cpp \
win32:SOURCES += ../../corelib/io/qfilesystemengine_win.cpp \ win32:SOURCES += ../../corelib/io/qfilesystemengine_win.cpp \
../../corelib/io/qfilesystemiterator_win.cpp \ ../../corelib/io/qfilesystemiterator_win.cpp \
../../corelib/io/qfsfileengine_win.cpp \ ../../corelib/io/qfsfileengine_win.cpp \
../../corelib/io/qsettings_win.cpp \
../../corelib/plugin/qsystemlibrary.cpp \ ../../corelib/plugin/qsystemlibrary.cpp \
macx: { macx: {
SOURCES += ../../corelib/io/qfilesystemengine_mac.cpp SOURCES += ../../corelib/io/qfilesystemengine_mac.cpp \
SOURCES += ../../corelib/kernel/qcore_mac.cpp ../../corelib/io/qsettings_mac.cpp \
../../corelib/kernel/qcore_mac.cpp
LIBS += -framework CoreServices LIBS += -framework CoreServices
} }