Commit e4367681 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Fix make install to sysroot for Windows.

Change-Id: If040c5c3b399a37c01d77fab6c16820466b4dc34
Reviewed-on: http://codereview.qt.nokia.com/373

Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 94bd7513
......@@ -383,6 +383,34 @@ bool MaemoGlobal::isFileNewerThan(const QString &filePath,
return false;
}
void MaemoGlobal::addMaddeEnvironment(Utils::Environment &env, const QString &qmakePath)
{
Utils::Environment maddeEnv;
#ifdef Q_OS_WIN
const QString root = maddeRoot(qmakePath);
env.prependOrSetPath(root + QLatin1String("/bin"));
env.prependOrSet(QLatin1String("HOME"),
QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
#else
Q_UNUSED(qmakePath);
#endif
for (Utils::Environment::const_iterator it = maddeEnv.constBegin(); it != maddeEnv.constEnd(); ++it)
env.prependOrSet(it.key(), it.value());
}
void MaemoGlobal::transformMaddeCall(QString &command, QStringList &args, const QString &qmakePath)
{
#ifdef Q_OS_WIN
const QString root = maddeRoot(qmakePath);
args.prepend(command);
command = root + QLatin1String("/bin/sh.exe");
#else
Q_UNUSED(command);
Q_UNUSED(args);
Q_UNUSED(qmakePath);
#endif
}
bool MaemoGlobal::callMad(QProcess &proc, const QStringList &args,
const QString &qmakePath, bool useTarget)
{
......@@ -405,16 +433,10 @@ bool MaemoGlobal::callMaddeShellScript(QProcess &proc,
return false;
QString actualCommand = command;
QStringList actualArgs = targetArgs(qmakePath, useTarget) + args;
#ifdef Q_OS_WIN
Utils::Environment env(proc.systemEnvironment());
const QString root = maddeRoot(qmakePath);
env.prependOrSetPath(root + QLatin1String("/bin"));
env.prependOrSet(QLatin1String("HOME"),
QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
addMaddeEnvironment(env, qmakePath);
proc.setEnvironment(env.toStringList());
actualArgs.prepend(command);
actualCommand = root + QLatin1String("/bin/sh.exe");
#endif
transformMaddeCall(actualCommand, actualArgs, qmakePath);
proc.start(actualCommand, actualArgs);
return true;
}
......
......@@ -118,6 +118,8 @@ public:
static PortList freePorts(const QSharedPointer<const LinuxDeviceConfiguration> &devConf,
const QtSupport::BaseQtVersion *qtVersion);
static void addMaddeEnvironment(Utils::Environment &env, const QString &qmakePath);
static void transformMaddeCall(QString &command, QStringList &args, const QString &qmakePath);
static QString maddeRoot(const QString &qmakePath);
static QString targetRoot(const QString &qmakePath);
static QString targetName(const QString &qmakePath);
......
......@@ -374,13 +374,16 @@ bool MaemoMakeInstallToSysrootStep::init()
return false;
}
processParameters()->setCommand(MaemoGlobal::madCommand(qtVersion->qmakeCommand()));
const QStringList args = QStringList() << QLatin1String("-t")
Utils::Environment env = bc->environment();
MaemoGlobal::addMaddeEnvironment(env, qtVersion->qmakeCommand());
QString command = MaemoGlobal::madCommand(qtVersion->qmakeCommand());
QStringList args = QStringList() << QLatin1String("-t")
<< MaemoGlobal::targetName(qtVersion->qmakeCommand()) << QLatin1String("make")
<< QLatin1String("install")
<< (QLatin1String("INSTALL_ROOT=") + qtVersion->systemRoot());
<< QLatin1String("install") << (QLatin1String("INSTALL_ROOT=") + qtVersion->systemRoot());
MaemoGlobal::transformMaddeCall(command, args, qtVersion->qmakeCommand());
processParameters()->setCommand(command);
processParameters()->setArguments(args.join(QLatin1String(" ")));
processParameters()->setEnvironment(bc->environment());
processParameters()->setEnvironment(env);
processParameters()->setWorkingDirectory(bc->buildDirectory());
return true;
}
......
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