Maemo: Fix make install to sysroot for Windows.

Change-Id: If040c5c3b399a37c01d77fab6c16820466b4dc34
Reviewed-on: http://codereview.qt.nokia.com/373
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Christian Kandeler
2011-06-08 11:07:00 +02:00
parent 94bd751325
commit e436768127
3 changed files with 40 additions and 13 deletions

View File

@@ -383,6 +383,34 @@ bool MaemoGlobal::isFileNewerThan(const QString &filePath,
return false; 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, bool MaemoGlobal::callMad(QProcess &proc, const QStringList &args,
const QString &qmakePath, bool useTarget) const QString &qmakePath, bool useTarget)
{ {
@@ -405,16 +433,10 @@ bool MaemoGlobal::callMaddeShellScript(QProcess &proc,
return false; return false;
QString actualCommand = command; QString actualCommand = command;
QStringList actualArgs = targetArgs(qmakePath, useTarget) + args; QStringList actualArgs = targetArgs(qmakePath, useTarget) + args;
#ifdef Q_OS_WIN
Utils::Environment env(proc.systemEnvironment()); Utils::Environment env(proc.systemEnvironment());
const QString root = maddeRoot(qmakePath); addMaddeEnvironment(env, qmakePath);
env.prependOrSetPath(root + QLatin1String("/bin"));
env.prependOrSet(QLatin1String("HOME"),
QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
proc.setEnvironment(env.toStringList()); proc.setEnvironment(env.toStringList());
actualArgs.prepend(command); transformMaddeCall(actualCommand, actualArgs, qmakePath);
actualCommand = root + QLatin1String("/bin/sh.exe");
#endif
proc.start(actualCommand, actualArgs); proc.start(actualCommand, actualArgs);
return true; return true;
} }

View File

@@ -118,6 +118,8 @@ public:
static PortList freePorts(const QSharedPointer<const LinuxDeviceConfiguration> &devConf, static PortList freePorts(const QSharedPointer<const LinuxDeviceConfiguration> &devConf,
const QtSupport::BaseQtVersion *qtVersion); 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 maddeRoot(const QString &qmakePath);
static QString targetRoot(const QString &qmakePath); static QString targetRoot(const QString &qmakePath);
static QString targetName(const QString &qmakePath); static QString targetName(const QString &qmakePath);

View File

@@ -374,13 +374,16 @@ bool MaemoMakeInstallToSysrootStep::init()
return false; return false;
} }
processParameters()->setCommand(MaemoGlobal::madCommand(qtVersion->qmakeCommand())); Utils::Environment env = bc->environment();
const QStringList args = QStringList() << QLatin1String("-t") MaemoGlobal::addMaddeEnvironment(env, qtVersion->qmakeCommand());
QString command = MaemoGlobal::madCommand(qtVersion->qmakeCommand());
QStringList args = QStringList() << QLatin1String("-t")
<< MaemoGlobal::targetName(qtVersion->qmakeCommand()) << QLatin1String("make") << MaemoGlobal::targetName(qtVersion->qmakeCommand()) << QLatin1String("make")
<< QLatin1String("install") << QLatin1String("install") << (QLatin1String("INSTALL_ROOT=") + qtVersion->systemRoot());
<< (QLatin1String("INSTALL_ROOT=") + qtVersion->systemRoot()); MaemoGlobal::transformMaddeCall(command, args, qtVersion->qmakeCommand());
processParameters()->setCommand(command);
processParameters()->setArguments(args.join(QLatin1String(" "))); processParameters()->setArguments(args.join(QLatin1String(" ")));
processParameters()->setEnvironment(bc->environment()); processParameters()->setEnvironment(env);
processParameters()->setWorkingDirectory(bc->buildDirectory()); processParameters()->setWorkingDirectory(bc->buildDirectory());
return true; return true;
} }