Commit 033837dc authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Remove MaemoToolChain::sysroot() method.

Functionality is already in MaemoQtVersion.
Also move some environment stuff there.

Change-Id: Ibbe91aed5611b1fa60afd3954767596af74b8c80
Reviewed-on: http://codereview.qt.nokia.com/387

Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 7939c270
......@@ -35,7 +35,7 @@
#include "maemodeployables.h"
#include "maemoglobal.h"
#include "maemopackagecreationstep.h"
#include "maemotoolchain.h"
#include "maemoqtversion.h"
#include "qt4maemodeployconfiguration.h"
#include <qt4projectmanager/qt4buildconfiguration.h>
......@@ -298,24 +298,23 @@ void MaemoCopyToSysrootStep::run(QFutureInterface<bool> &fi)
return;
}
const MaemoToolChain * const tc
= dynamic_cast<MaemoToolChain *>(bc->toolChain());
if (!tc) {
addOutput(tr("Can't copy to sysroot without toolchain."),
const MaemoQtVersion * const qtVersion = dynamic_cast<MaemoQtVersion *>(bc->qtVersion());
if (!qtVersion) {
addOutput(tr("Can't copy to sysroot without valid Qt version."),
ErrorMessageOutput);
fi.reportResult(false);
return;
}
emit addOutput(tr("Copying files to sysroot ..."), MessageOutput);
QDir sysrootDir(tc->sysroot());
QDir sysrootDir(qtVersion->systemRoot());
const QSharedPointer<MaemoDeployables> deployables
= qobject_cast<Qt4MaemoDeployConfiguration *>(deployConfiguration())->deployables();
const QChar sep = QLatin1Char('/');
for (int i = 0; i < deployables->deployableCount(); ++i) {
const MaemoDeployable &deployable = deployables->deployableAt(i);
const QFileInfo localFileInfo(deployable.localFilePath);
const QString targetFilePath = tc->sysroot() + sep
const QString targetFilePath = qtVersion->systemRoot() + sep
+ deployable.remoteDir + sep + localFileInfo.fileName();
sysrootDir.mkpath(deployable.remoteDir.mid(1));
QString errorMsg;
......
......@@ -170,5 +170,23 @@ QString MaemoQtVersion::osType() const
return m_osType;
}
void MaemoQtVersion::addToEnvironment(Utils::Environment &env) const
{
const QString maddeRoot = MaemoGlobal::maddeRoot(qmakeCommand());
// Needed to make pkg-config stuff work.
env.prependOrSet(QLatin1String("SYSROOT_DIR"), QDir::toNativeSeparators(systemRoot()));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/madbin")
.arg(maddeRoot)));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/madlib")
.arg(maddeRoot)));
env.prependOrSet(QLatin1String("PERL5LIB"),
QDir::toNativeSeparators(QString("%1/madlib/perl5").arg(maddeRoot)));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin").arg(maddeRoot)));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin")
.arg(MaemoGlobal::targetRoot(qmakeCommand()))));
}
} // namespace Internal
} // namespace RemoteLinux
......@@ -52,6 +52,7 @@ public:
virtual QString systemRoot() const;
virtual QList<ProjectExplorer::Abi> qtAbis() const;
void addToEnvironment(Utils::Environment &env) const;
virtual bool supportsTargetId(const QString &id) const;
virtual QSet<QString> supportedTargetIds() const;
......
......@@ -100,24 +100,6 @@ bool MaemoToolChain::canClone() const
void MaemoToolChain::addToEnvironment(Utils::Environment &env) const
{
QtSupport::BaseQtVersion *v = QtSupport::QtVersionManager::instance()->version(m_qtVersionId);
if (!v)
return;
const QString maddeRoot = MaemoGlobal::maddeRoot(v->qmakeCommand());
// put this into environment to make pkg-config stuff work
env.prependOrSet(QLatin1String("SYSROOT_DIR"), QDir::toNativeSeparators(sysroot()));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/madbin")
.arg(maddeRoot)));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/madlib")
.arg(maddeRoot)));
env.prependOrSet(QLatin1String("PERL5LIB"),
QDir::toNativeSeparators(QString("%1/madlib/perl5").arg(maddeRoot)));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin").arg(maddeRoot)));
env.prependOrSetPath(QDir::toNativeSeparators(QString("%1/bin")
.arg(MaemoGlobal::targetRoot(v->qmakeCommand()))));
const QString manglePathsKey = QLatin1String("GCCWRAPPER_PATHMANGLE");
if (!env.hasKey(manglePathsKey)) {
const QStringList pathsToMangle = QStringList() << QLatin1String("/lib")
......@@ -128,27 +110,6 @@ void MaemoToolChain::addToEnvironment(Utils::Environment &env) const
}
}
QString MaemoToolChain::sysroot() const
{
QtSupport::BaseQtVersion *v = QtSupport::QtVersionManager::instance()->version(m_qtVersionId);
if (!v)
return QString();
if (m_sysroot.isEmpty()) {
QFile file(QDir::cleanPath(MaemoGlobal::targetRoot(v->qmakeCommand())) + QLatin1String("/information"));
if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream stream(&file);
while (!stream.atEnd()) {
const QString &line = stream.readLine().trimmed();
const QStringList &list = line.split(QLatin1Char(' '));
if (list.count() > 1 && list.at(0) == QLatin1String("sysroot"))
m_sysroot = MaemoGlobal::maddeRoot(v->qmakeCommand()) + QLatin1String("/sysroots/") + list.at(1);
}
}
}
return m_sysroot;
}
bool MaemoToolChain::operator ==(const ProjectExplorer::ToolChain &tc) const
{
if (!ToolChain::operator ==(tc))
......
......@@ -57,13 +57,11 @@ public:
bool canClone() const;
void addToEnvironment(Utils::Environment &env) const;
QString sysroot() const;
bool operator ==(const ProjectExplorer::ToolChain &) const;
ProjectExplorer::ToolChainConfigWidget *configurationWidget();
QVariantMap toMap() const;
bool fromMap(const QVariantMap &data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment