consolidate generation of metafile install targets
Metafiles such as .prl and .pc files contain paths that have to be adjusted during installation. The same code is used for unix and windows so move it into the base class. Change-Id: I82db89ec83820a4fa0214ba15e7cd63438f6dc91 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
parent
f210a85934
commit
d089ecb711
@ -3285,4 +3285,25 @@ MakefileGenerator::writePkgConfigFile()
|
|||||||
t << endl;
|
t << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QString &src, const QString &dst)
|
||||||
|
{
|
||||||
|
QString ret;
|
||||||
|
if (project->isEmpty(replace_rule)
|
||||||
|
|| project->isActiveConfig("no_sed_meta_install")
|
||||||
|
|| project->isEmpty("QMAKE_STREAM_EDITOR")) {
|
||||||
|
ret += "-$(INSTALL_FILE) \"" + src + "\" \"" + dst + "\"";
|
||||||
|
} else {
|
||||||
|
ret += "-$(SED)";
|
||||||
|
const ProStringList &replace_rules = project->values(replace_rule);
|
||||||
|
for (int r = 0; r < replace_rules.size(); ++r) {
|
||||||
|
const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")),
|
||||||
|
replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
|
||||||
|
if (!match.isEmpty() /*&& match != replace*/)
|
||||||
|
ret += " -e \"s," + match + "," + replace + ",g\"";
|
||||||
|
}
|
||||||
|
ret += " \"" + src + "\" >\"" + dst + "\"";
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -248,6 +248,8 @@ protected:
|
|||||||
inline QStringList fileFixify(const QStringList& files, FileFixifyType fix, bool canon=true) const
|
inline QStringList fileFixify(const QStringList& files, FileFixifyType fix, bool canon=true) const
|
||||||
{ return fileFixify(files, QString(), QString(), fix, canon); }
|
{ return fileFixify(files, QString(), QString(), fix, canon); }
|
||||||
|
|
||||||
|
QString installMetaFile(const ProKey &replace_rule, const QString &src, const QString &dst);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MakefileGenerator();
|
MakefileGenerator();
|
||||||
virtual ~MakefileGenerator();
|
virtual ~MakefileGenerator();
|
||||||
|
@ -868,32 +868,15 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
|
|||||||
if(!uninst.isEmpty())
|
if(!uninst.isEmpty())
|
||||||
uninst.append("\n\t");
|
uninst.append("\n\t");
|
||||||
uninst.append("-$(DEL_FILE) \"" + dst_meta + "\"");
|
uninst.append("-$(DEL_FILE) \"" + dst_meta + "\"");
|
||||||
const ProKey replace_rule("QMAKE_" + type.toUpper() + "_INSTALL_REPLACE");
|
|
||||||
const QString dst_meta_dir = fileInfo(dst_meta).path();
|
const QString dst_meta_dir = fileInfo(dst_meta).path();
|
||||||
if(!dst_meta_dir.isEmpty()) {
|
if(!dst_meta_dir.isEmpty()) {
|
||||||
if(!ret.isEmpty())
|
if(!ret.isEmpty())
|
||||||
ret += "\n\t";
|
ret += "\n\t";
|
||||||
ret += mkdir_p_asstring(dst_meta_dir, true);
|
ret += mkdir_p_asstring(dst_meta_dir, true);
|
||||||
}
|
}
|
||||||
QString install_meta = "$(INSTALL_FILE) \"" + src_meta + "\" \"" + dst_meta + "\"";
|
|
||||||
if(project->isEmpty(replace_rule) || project->isActiveConfig("no_sed_meta_install")) {
|
|
||||||
if (!ret.isEmpty())
|
if (!ret.isEmpty())
|
||||||
ret += "\n\t";
|
ret += "\n\t";
|
||||||
ret += "-" + install_meta;
|
ret += installMetaFile(ProKey("QMAKE_" + type.toUpper() + "_INSTALL_REPLACE"), src_meta, dst_meta);
|
||||||
} else {
|
|
||||||
if(!ret.isEmpty())
|
|
||||||
ret += "\n\t";
|
|
||||||
ret += "-$(SED)";
|
|
||||||
const ProStringList &replace_rules = project->values(replace_rule);
|
|
||||||
for(int r = 0; r < replace_rules.size(); ++r) {
|
|
||||||
const ProString &match = project->first(ProKey(replace_rules.at(r) + ".match")),
|
|
||||||
&replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
|
|
||||||
if(!match.isEmpty() /*&& match != replace*/)
|
|
||||||
ret += " -e \"s," + match + "," + replace + ",g\"";
|
|
||||||
}
|
|
||||||
ret += " \"" + src_meta + "\" >\"" + dst_meta + "\"";
|
|
||||||
//ret += " || " + install_meta;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -851,22 +851,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
|
|||||||
}
|
}
|
||||||
if(!ret.isEmpty())
|
if(!ret.isEmpty())
|
||||||
ret += "\n\t";
|
ret += "\n\t";
|
||||||
const ProKey replace_rule("QMAKE_PKGCONFIG_INSTALL_REPLACE");
|
ret += installMetaFile(ProKey("QMAKE_PKGCONFIG_INSTALL_REPLACE"), pkgConfigFileName(true), dst_pc);
|
||||||
if (project->isEmpty(replace_rule)
|
|
||||||
|| project->isActiveConfig("no_sed_meta_install")
|
|
||||||
|| project->isEmpty("QMAKE_STREAM_EDITOR")) {
|
|
||||||
ret += "-$(INSTALL_FILE) \"" + pkgConfigFileName(true) + "\" \"" + dst_pc + "\"";
|
|
||||||
} else {
|
|
||||||
ret += "-$(SED)";
|
|
||||||
const ProStringList &replace_rules = project->values(replace_rule);
|
|
||||||
for (int r = 0; r < replace_rules.size(); ++r) {
|
|
||||||
const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")),
|
|
||||||
replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
|
|
||||||
if (!match.isEmpty() /*&& match != replace*/)
|
|
||||||
ret += " -e \"s," + match + "," + replace + ",g\"";
|
|
||||||
}
|
|
||||||
ret += " \"" + pkgConfigFileName(true) + "\" >\"" + dst_pc + "\"";
|
|
||||||
}
|
|
||||||
if(!uninst.isEmpty())
|
if(!uninst.isEmpty())
|
||||||
uninst.append("\n\t");
|
uninst.append("\n\t");
|
||||||
uninst.append("-$(DEL_FILE) \"" + dst_pc + "\"");
|
uninst.append("-$(DEL_FILE) \"" + dst_pc + "\"");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user