don't copy files to default specs any more
now that the default specs really only forward to the real specs, it is not necessary to copy any auxiliary files. Change-Id: I169a61a045063b796062fe6af3a2afbe3f1c9da0 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
parent
dafc4a884c
commit
bc05c9aee8
@ -3046,7 +3046,7 @@ QString Configure::addDefine(QString def)
|
|||||||
#if !defined(EVAL)
|
#if !defined(EVAL)
|
||||||
bool Configure::copySpec(const char *name, const char *pfx, const QString &spec)
|
bool Configure::copySpec(const char *name, const char *pfx, const QString &spec)
|
||||||
{
|
{
|
||||||
// Copy configured mkspec to default directory, but remove the old one first, if there is any
|
// "Link" configured mkspec to default directory, but remove the old one first, if there is any
|
||||||
QString defSpec = buildPath + "/mkspecs/" + name;
|
QString defSpec = buildPath + "/mkspecs/" + name;
|
||||||
QFileInfo defSpecInfo(defSpec);
|
QFileInfo defSpecInfo(defSpec);
|
||||||
if (defSpecInfo.exists()) {
|
if (defSpecInfo.exists()) {
|
||||||
@ -3057,10 +3057,18 @@ bool Configure::copySpec(const char *name, const char *pfx, const QString &spec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString pltSpec = sourcePath + "/mkspecs/" + spec;
|
QDir::current().mkpath(defSpec);
|
||||||
QString includeSpec = buildPath + "/mkspecs/" + spec;
|
QFile qfile(defSpec + "/qmake.conf");
|
||||||
if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) {
|
if (qfile.open(QFile::WriteOnly | QFile::Text)) {
|
||||||
cout << "Couldn't update default " << pfx << "mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
|
QTextStream fileStream;
|
||||||
|
fileStream.setDevice(&qfile);
|
||||||
|
QString srcSpec = buildPath + "/mkspecs/" + spec; // We copied it to the build dir
|
||||||
|
fileStream << "QMAKESPEC_ORIGINAL = " << formatPath(srcSpec) << endl;
|
||||||
|
fileStream << "include(" << formatPath(QDir(defSpec).relativeFilePath(srcSpec + "/qmake.conf")) << ")" << endl;
|
||||||
|
qfile.close();
|
||||||
|
}
|
||||||
|
if (qfile.error() != QFile::NoError) {
|
||||||
|
cout << "Couldn't update default " << pfx << "mkspec: " << qPrintable(qfile.errorString()) << endl;
|
||||||
dictionary["DONE"] = "error";
|
dictionary["DONE"] = "error";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -454,21 +454,12 @@ QString Environment::execute(const QString &command, int *returnCode)
|
|||||||
/*!
|
/*!
|
||||||
Copies the \a srcDir contents into \a destDir.
|
Copies the \a srcDir contents into \a destDir.
|
||||||
|
|
||||||
If \a includeSrcDir is not empty, any files with 'h', 'prf', or 'conf' suffixes
|
|
||||||
will not be copied over from \a srcDir. Instead a new file will be created
|
|
||||||
in \a destDir with the same name and that file will include a file with the
|
|
||||||
same name from the \a includeSrcDir using relative path and appropriate
|
|
||||||
syntax for the file type.
|
|
||||||
|
|
||||||
Returns true if copying was successful.
|
Returns true if copying was successful.
|
||||||
*/
|
*/
|
||||||
bool Environment::cpdir(const QString &srcDir,
|
bool Environment::cpdir(const QString &srcDir, const QString &destDir)
|
||||||
const QString &destDir,
|
|
||||||
const QString &includeSrcDir)
|
|
||||||
{
|
{
|
||||||
QString cleanSrcName = QDir::cleanPath(srcDir);
|
QString cleanSrcName = QDir::cleanPath(srcDir);
|
||||||
QString cleanDstName = QDir::cleanPath(destDir);
|
QString cleanDstName = QDir::cleanPath(destDir);
|
||||||
QString cleanIncludeName = QDir::cleanPath(includeSrcDir);
|
|
||||||
|
|
||||||
#ifdef CONFIGURE_DEBUG_CP_DIR
|
#ifdef CONFIGURE_DEBUG_CP_DIR
|
||||||
qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName;
|
qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName;
|
||||||
@ -480,59 +471,21 @@ bool Environment::cpdir(const QString &srcDir,
|
|||||||
|
|
||||||
bool result = true;
|
bool result = true;
|
||||||
QDir dir = QDir(cleanSrcName);
|
QDir dir = QDir(cleanSrcName);
|
||||||
QDir destinationDir = QDir(cleanDstName);
|
|
||||||
QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
|
QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||||
for (int i = 0; result && (i < allEntries.count()); ++i) {
|
for (int i = 0; result && (i < allEntries.count()); ++i) {
|
||||||
QFileInfo entry = allEntries.at(i);
|
QFileInfo entry = allEntries.at(i);
|
||||||
bool intermediate = true;
|
bool intermediate = true;
|
||||||
if (entry.isDir()) {
|
if (entry.isDir()) {
|
||||||
QString newIncSrcDir;
|
|
||||||
if (!includeSrcDir.isEmpty())
|
|
||||||
newIncSrcDir = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName());
|
|
||||||
|
|
||||||
intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()),
|
intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()),
|
||||||
QString("%1/%2").arg(cleanDstName).arg(entry.fileName()),
|
QString("%1/%2").arg(cleanDstName).arg(entry.fileName()));
|
||||||
newIncSrcDir);
|
|
||||||
} else {
|
} else {
|
||||||
QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName());
|
QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName());
|
||||||
#ifdef CONFIGURE_DEBUG_CP_DIR
|
#ifdef CONFIGURE_DEBUG_CP_DIR
|
||||||
qDebug() << "About to cp (file)" << entry.absoluteFilePath() << "->" << destFile;
|
qDebug() << "About to cp (file)" << entry.absoluteFilePath() << "->" << destFile;
|
||||||
#endif
|
#endif
|
||||||
QFile::remove(destFile);
|
QFile::remove(destFile);
|
||||||
QString suffix = entry.suffix();
|
intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
|
||||||
if (!includeSrcDir.isEmpty() && (suffix == "prf" || suffix == "conf" || suffix == "h")) {
|
SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
|
||||||
QString relativeIncludeFilePath = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName());
|
|
||||||
relativeIncludeFilePath = destinationDir.relativeFilePath(relativeIncludeFilePath);
|
|
||||||
#ifdef CONFIGURE_DEBUG_CP_DIR
|
|
||||||
qDebug() << "...instead generate relative include to" << relativeIncludeFilePath;
|
|
||||||
#endif
|
|
||||||
QFile currentFile(destFile);
|
|
||||||
if (currentFile.open(QFile::WriteOnly | QFile::Text)) {
|
|
||||||
QTextStream fileStream;
|
|
||||||
fileStream.setDevice(¤tFile);
|
|
||||||
|
|
||||||
if (suffix == "prf" || suffix == "conf") {
|
|
||||||
if (entry.fileName() == "qmake.conf") {
|
|
||||||
// While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the
|
|
||||||
// primary use of this variable by qmake to identify the original mkspec, the
|
|
||||||
// variable is also used for few special cases where the absolute path is required.
|
|
||||||
// Conversely, the include of the original qmake.conf must be done using relative path,
|
|
||||||
// as some Qt binary deployments are done in a manner that doesn't allow for patching
|
|
||||||
// the paths at the installation time.
|
|
||||||
fileStream << "QMAKESPEC_ORIGINAL=" << cleanSrcName << endl << endl;
|
|
||||||
}
|
|
||||||
fileStream << "include(" << relativeIncludeFilePath << ")" << endl << endl;
|
|
||||||
} else if (suffix == "h") {
|
|
||||||
fileStream << "#include \"" << relativeIncludeFilePath << "\"" << endl << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
fileStream.flush();
|
|
||||||
currentFile.close();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
|
|
||||||
SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(!intermediate) {
|
if(!intermediate) {
|
||||||
qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir();
|
qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir();
|
||||||
|
@ -67,9 +67,7 @@ public:
|
|||||||
|
|
||||||
static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv);
|
static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv);
|
||||||
static QString execute(const QString &command, int *returnCode = 0);
|
static QString execute(const QString &command, int *returnCode = 0);
|
||||||
static bool cpdir(const QString &srcDir,
|
static bool cpdir(const QString &srcDir, const QString &destDir);
|
||||||
const QString &destDir,
|
|
||||||
const QString &includeSrcDir = QString());
|
|
||||||
static bool rmdir(const QString &name);
|
static bool rmdir(const QString &name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user