Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/configure/environment.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    6161#endif
    6262
    63 #include <symbian/epocroot.h> // from tools/shared
    64 #include <windows/registry.h> // from tools/shared
     63#include <symbian/epocroot.h> // from tools/shared
     64#include <windows/registry.h> // from tools/shared
    6565
    6666QT_BEGIN_NAMESPACE
     
    7474    // The compilers here are sorted in a reversed-preferred order
    7575    {CC_BORLAND, "Borland C++",                                                    0, "bcc32.exe"},
    76     {CC_MINGW,   "MinGW (Minimalist GNU for Windows)",                             0, "mingw32-gcc.exe"},
     76    {CC_MINGW,   "MinGW (Minimalist GNU for Windows)",                             0, ".exe"},
    7777    {CC_INTEL,   "Intel(R) C++ Compiler for 32-bit applications",                  0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe
    7878    {CC_MSVC6,   "Microsoft (R) 32-bit C/C++ Optimizing Compiler (6.x)",           "Software\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++\\ProductDir", "cl.exe"}, // link.exe, lib.exe
     
    8181    {CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)",  "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe
    8282    {CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)",  "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe
     83
    8384    {CC_UNKNOWN, "Unknown", 0, 0},
    8485};
     
    106107    QString spec;
    107108    switch (detectCompiler()) {
     109
     110
     111
    108112    case CC_NET2008:
    109113        spec = "win32-msvc2008";
     
    160164    QStringList pathlist = paths.toLower().split(";");
    161165    for(int i = 0; compiler_info[i].compiler; ++i) {
    162         QString productPath = readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower();
     166        QString productPath = readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower();
    163167        if (productPath.length()) {
    164168            QStringList::iterator it;
     
    278282    }
    279283    // add the user environment
    280     for (QStringList::ConstIterator it = environment.begin(); it != environment.end(); it++ ) {
    281             QString tmp = *it;
     284    foreach (const QString &tmp, environment) {
    282285            uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
    283286            envlist.resize(envlist.size() + tmpSize);
     
    358361    QByteArray envlist = qt_create_environment(fullEnv);
    359362
    360     DWORD exitCode = -1;
     363    DWORD exitCode = ;
    361364    PROCESS_INFORMATION procInfo;
    362365    memset(&procInfo, 0, sizeof(procInfo));
     
    379382
    380383
    381     if (exitCode == -1) {
     384    if (exitCode == ) {
    382385        switch(GetLastError()) {
    383386        case E2BIG:
    384387            cerr << "execute: Argument list exceeds 1024 bytes" << endl;
    385             foreach(QString arg, arguments)
     388            foreacharg, arguments)
    386389                cerr << "   (" << arg.toLocal8Bit().constData() << ")" << endl;
    387390            break;
     
    397400        default:
    398401            cerr << "execute: Unknown error" << endl;
    399             foreach(QString arg, arguments)
     402            foreacharg, arguments)
    400403                cerr << "   (" << arg.toLocal8Bit().constData() << ")" << endl;
    401404            break;
     
    405408}
    406409
    407 bool Environment::cpdir(const QString &srcDir, const QString &destDir)
     410/*!
     411    Copies the \a srcDir contents into \a destDir.
     412
     413    If \a includeSrcDir is not empty, any files with 'h', 'prf', or 'conf' suffixes
     414    will not be copied over from \a srcDir. Instead a new file will be created
     415    in \a destDir with the same name and that file will include a file with the
     416    same name from the \a includeSrcDir using relative path and appropriate
     417    syntax for the file type.
     418
     419    Returns true if copying was successful.
     420*/
     421bool Environment::cpdir(const QString &srcDir,
     422                        const QString &destDir,
     423                        const QString &includeSrcDir)
    408424{
    409425    QString cleanSrcName = QDir::cleanPath(srcDir);
    410426    QString cleanDstName = QDir::cleanPath(destDir);
     427
     428
    411429#ifdef CONFIGURE_DEBUG_CP_DIR
    412430    qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName;
     
    419437    bool result = true;
    420438    QDir dir = QDir(cleanSrcName);
     439
    421440    QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
    422441    for (int i = 0; result && (i < allEntries.count()); ++i) {
     
    424443        bool intermediate = true;
    425444        if (entry.isDir()) {
     445
     446
     447
     448
    426449            intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()),
    427                             QString("%1/%2").arg(cleanDstName).arg(entry.fileName()));
     450                                 QString("%1/%2").arg(cleanDstName).arg(entry.fileName()),
     451                                 newIncSrcDir);
    428452        } else {
    429453            QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName());
     
    432456#endif
    433457            QFile::remove(destFile);
    434             intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
    435             SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
     458            QString suffix = entry.suffix();
     459            if (!includeSrcDir.isEmpty() && (suffix == "prf" || suffix == "conf" || suffix == "h")) {
     460                QString relativeIncludeFilePath = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName());
     461                relativeIncludeFilePath = destinationDir.relativeFilePath(relativeIncludeFilePath);
     462#ifdef CONFIGURE_DEBUG_CP_DIR
     463                qDebug() << "...instead generate relative include to" << relativeIncludeFilePath;
     464#endif
     465                QFile currentFile(destFile);
     466                if (currentFile.open(QFile::WriteOnly | QFile::Text)) {
     467                    QTextStream fileStream;
     468                    fileStream.setDevice(&currentFile);
     469
     470                    if (suffix == "prf" || suffix == "conf") {
     471                        if (entry.fileName() == "qmake.conf") {
     472                            // While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the
     473                            // primary use of this variable by qmake to identify the original mkspec, the
     474                            // variable is also used for few special cases where the absolute path is required.
     475                            // Conversely, the include of the original qmake.conf must be done using relative path,
     476                            // as some Qt binary deployments are done in a manner that doesn't allow for patching
     477                            // the paths at the installation time.
     478                            fileStream << "QMAKESPEC_ORIGINAL=" << cleanSrcName << endl << endl;
     479                        }
     480                        fileStream << "include(" << relativeIncludeFilePath << ")" << endl << endl;
     481                    } else if (suffix == "h") {
     482                        fileStream << "#include \"" << relativeIncludeFilePath << "\"" << endl << endl;
     483                    }
     484
     485                    fileStream.flush();
     486                    currentFile.close();
     487                }
     488            } else {
     489                intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
     490                SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
     491            }
    436492        }
    437493        if(!intermediate) {
     
    464520QString Environment::symbianEpocRoot()
    465521{
    466     // Call function defined in tools/shared/symbian/epocroot.h
    467     return ::epocRoot();
     522    // Call function defined in tools/shared/symbian/epocroot.h
     523    return ::epocRoot();
    468524}
    469525
Note: See TracChangeset for help on using the changeset viewer.