summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@digia.com>2012-10-02 19:22:17 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-08 17:14:24 +0200
commitf71170aa35ad37fdee2def64c72c60806f92d00d (patch)
treed66673e0f6a6c0082a71a692d59842a34128d96a /src/corelib/global
parente0b5571b5348711bbcc19f58455aa69c41b5fe30 (diff)
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>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qlibraryinfo.cpp40
-rw-r--r--src/corelib/global/qlibraryinfo.h4
2 files changed, 26 insertions, 18 deletions
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<QSettings> 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