Work around MinGW-make's magic prefixing of paths.
When building QNX on MS-Windows, make magically adds the Msys root as prefix to variables whose values look like paths; this applies to both environment variables and variables given values on the command-line. When we don't actually want to install under the Msys root, this is unwelcome "help". So (for MinGW's make) support a magic prefix of our own, @msyshack@, that'll make a path value for INSTALL_ROOT not look like a path to make; we can then strip it off when we come to use it. Change-Id: I951ad3c8fe3e5cfb49e6e361d7fff779f3a9d716 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
This commit is contained in:
parent
2bb473c19a
commit
f33c6f37a8
@ -1212,7 +1212,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild)
|
||||
}
|
||||
|
||||
bool do_default = true;
|
||||
const QString root = "$(INSTALL_ROOT)";
|
||||
const QString root = installRoot();
|
||||
QString dst;
|
||||
if (installConfigValues.indexOf("no_path") == -1 &&
|
||||
installConfigValues.indexOf("dummy_install") == -1) {
|
||||
|
@ -192,6 +192,7 @@ protected:
|
||||
|
||||
//for installs
|
||||
virtual QString defaultInstall(const QString &);
|
||||
virtual QString installRoot() const;
|
||||
|
||||
//for prl
|
||||
QString prlFileName(bool fixify=true);
|
||||
@ -277,6 +278,9 @@ inline bool MakefileGenerator::noIO() const
|
||||
inline QString MakefileGenerator::defaultInstall(const QString &)
|
||||
{ return QString(""); }
|
||||
|
||||
inline QString MakefileGenerator::installRoot() const
|
||||
{ return QStringLiteral("$(INSTALL_ROOT)"); }
|
||||
|
||||
inline bool MakefileGenerator::findLibraries(bool, bool)
|
||||
{ return true; }
|
||||
|
||||
|
@ -514,6 +514,20 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN // MinGW x-compiling for QNX
|
||||
QString UnixMakefileGenerator::installRoot() const
|
||||
{
|
||||
/*
|
||||
We include a magic prefix on the path to bypass mingw-make's "helpful"
|
||||
intervention in the environment, recognising variables that look like
|
||||
paths and adding the msys system root as prefix, which we don't want.
|
||||
Once this hack has smuggled INSTALL_ROOT into make's variable space, we
|
||||
can trivially strip the magic prefix back off to get the path we meant.
|
||||
*/
|
||||
return QStringLiteral("$(INSTALL_ROOT:@msyshack@%=%)");
|
||||
}
|
||||
#endif
|
||||
|
||||
QString
|
||||
UnixMakefileGenerator::defaultInstall(const QString &t)
|
||||
{
|
||||
@ -522,7 +536,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
|
||||
|
||||
enum { NoBundle, SolidBundle, SlicedBundle } bundle = NoBundle;
|
||||
bool isAux = (project->first("TEMPLATE") == "aux");
|
||||
const QString root = "$(INSTALL_ROOT)";
|
||||
const QString root = installRoot();
|
||||
ProStringList &uninst = project->values(ProKey(t + ".uninstall"));
|
||||
QString ret, destdir = project->first("DESTDIR").toQString();
|
||||
if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep)
|
||||
|
@ -52,6 +52,9 @@ public:
|
||||
protected:
|
||||
virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); }
|
||||
virtual bool doDepends() const { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); }
|
||||
#ifdef Q_OS_WIN // MinGW x-compiling for QNX
|
||||
virtual QString installRoot() const;
|
||||
#endif
|
||||
virtual QString defaultInstall(const QString &);
|
||||
virtual ProString fixLibFlag(const ProString &lib);
|
||||
|
||||
|
@ -112,6 +112,18 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
|
||||
return false;
|
||||
}
|
||||
|
||||
QString MingwMakefileGenerator::installRoot() const
|
||||
{
|
||||
/*
|
||||
We include a magic prefix on the path to bypass mingw-make's "helpful"
|
||||
intervention in the environment, recognising variables that look like
|
||||
paths and adding the msys system root as prefix, which we don't want.
|
||||
Once this hack has smuggled INSTALL_ROOT into make's variable space, we
|
||||
can trivially strip the magic prefix back off to get the path we meant.
|
||||
*/
|
||||
return QStringLiteral("$(INSTALL_ROOT:@msyshack@%=%)");
|
||||
}
|
||||
|
||||
void createLdObjectScriptFile(const QString &fileName, const ProStringList &objList)
|
||||
{
|
||||
QString filePath = Option::output_dir + QDir::separator() + fileName;
|
||||
|
@ -50,6 +50,7 @@ protected:
|
||||
virtual QString getManifestFileForRcFile() const;
|
||||
bool writeMakefile(QTextStream &);
|
||||
void init();
|
||||
virtual QString installRoot() const;
|
||||
private:
|
||||
void writeMingwParts(QTextStream &);
|
||||
void writeIncPart(QTextStream &t);
|
||||
|
@ -268,7 +268,7 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t)
|
||||
|
||||
QString ret = Win32MakefileGenerator::defaultInstall(t);
|
||||
|
||||
const QString root = "$(INSTALL_ROOT)";
|
||||
const QString root = installRoot();
|
||||
ProStringList &uninst = project->values(ProKey(t + ".uninstall"));
|
||||
QString targetdir = fileFixify(project->first(ProKey(t + ".path")).toQString(), FileFixifyAbsolute);
|
||||
if(targetdir.right(1) != Option::dir_sep)
|
||||
|
@ -689,7 +689,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
|
||||
project->first("TEMPLATE") == "subdirs" || project->first("TEMPLATE") == "aux")
|
||||
return QString();
|
||||
|
||||
const QString root = "$(INSTALL_ROOT)";
|
||||
const QString root = installRoot();
|
||||
ProStringList &uninst = project->values(ProKey(t + ".uninstall"));
|
||||
QString ret;
|
||||
QString targetdir = fileFixify(project->first(ProKey(t + ".path")).toQString(), FileFixifyAbsolute);
|
||||
|
Loading…
Reference in New Issue
Block a user