summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-12-20 12:34:20 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-12-22 11:48:05 +0000
commita71b53d6004edb59ad1801f3281ef631fb38c7c4 (patch)
tree24f5bfeeb012985c3be1e98b1a0278b6b6d9929f /src
parent674430cea0edafc374552b4743e2da7d29143453 (diff)
fix sysrootification of install paths
initially, the idea was that QLibraryInfo would receive a pre-sysrootified ExtPrefix from the builtin qt.conf. matching this against the sysroot would then tell us whether to sysrootify the Prefix from a "regular" qt.conf as well. however, this would have lead to some major ugliness and inconsistency between the code paths, so i changed my mind. unfortunately, i failed to adjust the remaining code, leading to 169a40d51 entirely breaking sysrootification ... the proper (and nicely consistent) solution is to introduce a SysrootifyPrefix key to qt.conf. this is user-accessible as well, so as a bonus it is now possible to adjust the setting at qmake installation time. incidentally, this omission was the last thing that prevented using the same qmake host build for any imaginable configuration of the same qt version ... i think. Change-Id: Ic0eebf21f93651f6374628c0ad8b206d696a4a7e Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qlibraryinfo.cpp30
-rw-r--r--src/corelib/global/qlibraryinfo.h1
2 files changed, 15 insertions, 16 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 87ee75fa45..3ff37a5818 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -113,13 +113,6 @@ public:
? ls->haveDevicePaths
: ls->havePaths) : false;
}
- static bool sysrootify()
- {
- // This is actually bogus, as it does not consider post-configure settings.
- QLibrarySettings *ls = qt_library_settings();
- return ls ? (!ls->builtinValues[QLibraryInfo::SysrootPath].isEmpty()
- && ls->builtinValues[QLibraryInfo::ExtPrefixPath].isEmpty()) : false;
- }
static QString builtinValue(int loc)
{
QLibrarySettings *ls = qt_library_settings();
@@ -483,6 +476,7 @@ static const struct {
{ "Tests", "tests" },
#ifdef QT_BUILD_QMAKE
{ "Sysroot", "" },
+ { "SysrootifyPrefix", "" },
{ "HostBinaries", "bin" },
{ "HostLibraries", "lib" },
{ "HostData", "." },
@@ -522,13 +516,17 @@ QLibraryInfo::location(LibraryLocation loc)
QString ret = rawLocation(loc, FinalPaths);
// Automatically prepend the sysroot to target paths
- if ((loc < SysrootPath || loc > LastHostPath) && QLibraryInfoPrivate::sysrootify()) {
+ if (loc < SysrootPath || loc > LastHostPath) {
QString sysroot = rawLocation(SysrootPath, FinalPaths);
- if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':')
- && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\')))
- ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets
- else
- ret.prepend(sysroot);
+ if (!sysroot.isEmpty()
+ && QVariant::fromValue(rawLocation(SysrootifyPrefixPath, FinalPaths)).toBool()) {
+ if (ret.length() > 2 && ret.at(1) == QLatin1Char(':')
+ && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\'))) {
+ ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets
+ } else {
+ ret.prepend(sysroot);
+ }
+ }
}
return ret;
@@ -591,7 +589,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
if (loc == HostPrefixPath)
ret = config->value(QLatin1String(qtConfEntries[PrefixPath].key),
QLatin1String(qtConfEntries[PrefixPath].value)).toString();
- else if (loc == TargetSpecPath || loc == HostSpecPath)
+ else if (loc == TargetSpecPath || loc == HostSpecPath || loc == SysrootifyPrefixPath)
fromConf = false;
// The last case here is SysrootPath, which can be legitimately empty.
// All other keys have non-empty fallbacks to start with.
@@ -645,8 +643,8 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
}
#ifdef QT_BUILD_QMAKE
- // The specs need to be returned verbatim.
- if (loc == TargetSpecPath || loc == HostSpecPath)
+ // These values aren't actually paths and thus need to be returned verbatim.
+ if (loc == TargetSpecPath || loc == HostSpecPath || loc == SysrootifyPrefixPath)
return ret;
#endif
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 9d794ce1da..812ab9a263 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -91,6 +91,7 @@ public:
#ifdef QT_BUILD_QMAKE
// These are not subject to binary compatibility constraints
SysrootPath,
+ SysrootifyPrefixPath,
HostBinariesPath,
HostLibrariesPath,
HostDataPath,