introduce /src qmake property variants

this is for shadow builds during build time, where the respective files
are expected in the source dir.

Change-Id: I18dcfbdef99e1562a51dacac333642cae8105ebd
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Oswald Buddenhagen 2013-06-11 16:08:30 +02:00 committed by The Qt Project
parent 40880ed440
commit d795e9ff5f
4 changed files with 56 additions and 24 deletions

View File

@ -323,33 +323,46 @@ bool QMakeGlobals::initProperties()
QT_PCLOSE(proc); QT_PCLOSE(proc);
} }
#endif #endif
foreach (QByteArray line, data.split('\n')) foreach (QByteArray line, data.split('\n')) {
{ int off = line.indexOf(':');
int off = line.indexOf(':'); if (off < 0) // huh?
if (off < 0) // huh? continue;
continue; if (line.endsWith('\r'))
if (line.endsWith('\r')) line.chop(1);
line.chop(1); QString name = QString::fromLatin1(line.left(off));
QString name = QString::fromLatin1(line.left(off)); ProString value = ProString(QDir::fromNativeSeparators(
ProString value = ProString(QDir::fromNativeSeparators( QString::fromLocal8Bit(line.mid(off + 1))));
QString::fromLocal8Bit(line.mid(off + 1)))); properties.insert(ProKey(name), value);
properties.insert(ProKey(name), value); if (name.startsWith(QLatin1String("QT_"))) {
if (name.startsWith(QLatin1String("QT_")) && !name.contains(QLatin1Char('/'))) { bool plain = !name.contains(QLatin1Char('/'));
if (name.startsWith(QLatin1String("QT_INSTALL_"))) { if (!plain) {
if (!name.endsWith(QLatin1String("/get")))
continue;
name.chop(4);
}
if (name.startsWith(QLatin1String("QT_INSTALL_"))) {
if (plain) {
properties.insert(ProKey(name + QLatin1String("/raw")), value); properties.insert(ProKey(name + QLatin1String("/raw")), value);
properties.insert(ProKey(name + QLatin1String("/get")), value); properties.insert(ProKey(name + QLatin1String("/get")), value);
if (name == QLatin1String("QT_INSTALL_PREFIX") }
|| name == QLatin1String("QT_INSTALL_DATA") properties.insert(ProKey(name + QLatin1String("/src")), value);
|| name == QLatin1String("QT_INSTALL_BINS")) { if (name == QLatin1String("QT_INSTALL_PREFIX")
name.replace(3, 7, QLatin1String("HOST")); || name == QLatin1String("QT_INSTALL_DATA")
|| name == QLatin1String("QT_INSTALL_BINS")) {
name.replace(3, 7, QLatin1String("HOST"));
if (plain) {
properties.insert(ProKey(name), value); properties.insert(ProKey(name), value);
properties.insert(ProKey(name + QLatin1String("/get")), value); properties.insert(ProKey(name + QLatin1String("/get")), value);
} }
} else if (name.startsWith(QLatin1String("QT_HOST_"))) { properties.insert(ProKey(name + QLatin1String("/src")), value);
properties.insert(ProKey(name + QLatin1String("/get")), value);
} }
} else if (name.startsWith(QLatin1String("QT_HOST_"))) {
if (plain)
properties.insert(ProKey(name + QLatin1String("/get")), value);
properties.insert(ProKey(name + QLatin1String("/src")), value);
} }
} }
}
return true; return true;
} }
#else #else

View File

@ -83,6 +83,7 @@ QMakeProperty::QMakeProperty() : settings(0)
{ {
for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) { for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) {
QString name = QString::fromLatin1(propList[i].name); QString name = QString::fromLatin1(propList[i].name);
m_values[ProKey(name + "/src")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::EffectiveSourcePaths);
m_values[ProKey(name + "/get")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::EffectivePaths); m_values[ProKey(name + "/get")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::EffectivePaths);
QString val = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::FinalPaths); QString val = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::FinalPaths);
if (!propList[i].raw) { if (!propList[i].raw) {
@ -164,11 +165,14 @@ QMakeProperty::exec()
ProString val = value(ProKey(prop)); ProString val = value(ProKey(prop));
ProString pval = value(ProKey(prop + "/raw")); ProString pval = value(ProKey(prop + "/raw"));
ProString gval = value(ProKey(prop + "/get")); ProString gval = value(ProKey(prop + "/get"));
ProString sval = value(ProKey(prop + "/src"));
fprintf(stdout, "%s:%s\n", prop.toLatin1().constData(), val.toLatin1().constData()); fprintf(stdout, "%s:%s\n", prop.toLatin1().constData(), val.toLatin1().constData());
if (!pval.isEmpty() && pval != val) if (!pval.isEmpty() && pval != val)
fprintf(stdout, "%s/raw:%s\n", prop.toLatin1().constData(), pval.toLatin1().constData()); fprintf(stdout, "%s/raw:%s\n", prop.toLatin1().constData(), pval.toLatin1().constData());
if (!gval.isEmpty() && gval != (pval.isEmpty() ? val : pval)) if (!gval.isEmpty() && gval != (pval.isEmpty() ? val : pval))
fprintf(stdout, "%s/get:%s\n", prop.toLatin1().constData(), gval.toLatin1().constData()); fprintf(stdout, "%s/get:%s\n", prop.toLatin1().constData(), gval.toLatin1().constData());
if (!sval.isEmpty() && sval != gval)
fprintf(stdout, "%s/src:%s\n", prop.toLatin1().constData(), sval.toLatin1().constData());
} }
return true; return true;
} }

View File

@ -78,6 +78,7 @@ struct QLibrarySettings
QLibrarySettings(); QLibrarySettings();
QScopedPointer<QSettings> settings; QScopedPointer<QSettings> settings;
#ifdef QT_BOOTSTRAPPED #ifdef QT_BOOTSTRAPPED
bool haveEffectiveSourcePaths;
bool haveEffectivePaths; bool haveEffectivePaths;
bool havePaths; bool havePaths;
#endif #endif
@ -99,8 +100,10 @@ public:
static bool haveGroup(QLibraryInfo::PathGroup group) static bool haveGroup(QLibraryInfo::PathGroup group)
{ {
QLibrarySettings *ls = qt_library_settings(); QLibrarySettings *ls = qt_library_settings();
return ls ? (group == QLibraryInfo::EffectivePaths return ls ? (group == QLibraryInfo::EffectiveSourcePaths
? ls->haveEffectivePaths : ls->havePaths) : false; ? ls->haveEffectiveSourcePaths
: group == QLibraryInfo::EffectivePaths
? ls->haveEffectivePaths : ls->havePaths) : false;
} }
#endif #endif
static QSettings *configuration() static QSettings *configuration()
@ -122,7 +125,12 @@ QLibrarySettings::QLibrarySettings()
// This code needs to be in the regular library, as otherwise a qt.conf that // This code needs to be in the regular library, as otherwise a qt.conf that
// works for qmake would break things for dynamically built Qt tools. // works for qmake would break things for dynamically built Qt tools.
QStringList children = settings->childGroups(); QStringList children = settings->childGroups();
#ifdef QT_BOOTSTRAPPED
haveEffectiveSourcePaths = children.contains(QLatin1String("EffectiveSourcePaths"));
haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths"));
#else
haveEffectivePaths = children.contains(QLatin1String("EffectivePaths")); haveEffectivePaths = children.contains(QLatin1String("EffectivePaths"));
#endif
// 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_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
@ -130,6 +138,9 @@ QLibrarySettings::QLibrarySettings()
settings.reset(0); settings.reset(0);
#else #else
} else { } else {
#ifdef QT_BOOTSTRAPPED
haveEffectiveSourcePaths = false;
#endif
haveEffectivePaths = false; haveEffectivePaths = false;
havePaths = false; havePaths = false;
#endif #endif
@ -334,9 +345,12 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
// 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
// [EffectivePaths], otherwise fall back to builtins. // [EffectivePaths], otherwise fall back to builtins.
// EffectiveSourcePaths falls back to EffectivePaths.
if (!QLibraryInfoPrivate::haveGroup(group) if (!QLibraryInfoPrivate::haveGroup(group)
&& (group == FinalPaths && !(group == EffectiveSourcePaths
|| !(group = FinalPaths, QLibraryInfoPrivate::haveGroup(FinalPaths)))) && (group = EffectivePaths, QLibraryInfoPrivate::haveGroup(group)))
&& !(group == EffectivePaths
&& (group = FinalPaths, QLibraryInfoPrivate::haveGroup(group))))
#elif !defined(QT_NO_SETTINGS) #elif !defined(QT_NO_SETTINGS)
if (!QLibraryInfoPrivate::configuration()) if (!QLibraryInfoPrivate::configuration())
#endif #endif
@ -368,6 +382,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
QSettings *config = QLibraryInfoPrivate::configuration(); QSettings *config = QLibraryInfoPrivate::configuration();
config->beginGroup(QLatin1String( config->beginGroup(QLatin1String(
#ifdef QT_BOOTSTRAPPED #ifdef QT_BOOTSTRAPPED
group == EffectiveSourcePaths ? "EffectiveSourcePaths" :
group == EffectivePaths ? "EffectivePaths" : group == EffectivePaths ? "EffectivePaths" :
#endif #endif
"Paths")); "Paths"));

View File

@ -92,7 +92,7 @@ public:
}; };
static QString location(LibraryLocation); // ### Qt 6: consider renaming it to path() static QString location(LibraryLocation); // ### Qt 6: consider renaming it to path()
#ifdef QT_BOOTSTRAPPED #ifdef QT_BOOTSTRAPPED
enum PathGroup { FinalPaths, EffectivePaths }; enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths };
static QString rawLocation(LibraryLocation, PathGroup); static QString rawLocation(LibraryLocation, PathGroup);
#endif #endif