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/qmake/generators/unix/unixmake.cpp

    r651 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])
     
    6666    }
    6767
     68
     69
     70
     71
    6872    if(!project->isEmpty("QMAKE_FAILED_REQUIREMENTS")) /* no point */
    6973        return;
     
    100104        if(project->isEmpty("MAKEFILE"))
    101105            project->values("MAKEFILE").append("Makefile");
    102         if(project->isEmpty("QMAKE_QMAKE"))
    103             project->values("QMAKE_QMAKE").append("qmake");
    104106        if(project->values("QMAKE_INTERNAL_QMAKE_DEPS").indexOf("qmake_all") == -1)
    105107            project->values("QMAKE_INTERNAL_QMAKE_DEPS").append("qmake_all");
     
    452454                        libdirs.append(f);
    453455                } else if(opt.startsWith("-l")) {
    454                     if (project->isActiveConfig("rvct_linker")) {
     456                    if (!project->isEmpty("QMAKE_RVCT_LINKSTYLE")) {
     457                        (*it) = opt.mid(2);
     458                    } else if (project->isActiveConfig("rvct_linker")) {
    455459                        (*it) = "lib" + opt.mid(2) + ".so";
    456460                    } else {
     
    492496                if(!extn.isNull())
    493497                    extens << extn;
     498
     499
     500
    494501                else
    495502                    extens << project->values("QMAKE_EXTENSION_SHLIB").first() << "a";
    496503                for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
    497504                    if(dir.isNull()) {
    498                         QString lib_stub;
    499505                        for(QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin(); dep_it != libdirs.end(); ++dep_it) {
    500                             if(exists((*dep_it).local() + Option::dir_sep + "lib" + stub +
    501                                       "." + (*extit))) {
    502                                 lib_stub = stub;
     506                            QString pathToLib = ((*dep_it).local() + Option::dir_sep
     507                                    + project->values("QMAKE_PREFIX_SHLIB").first()
     508                                    + stub + "." + (*extit));
     509                            if(exists(pathToLib)) {
     510                                if (!project->isEmpty("QMAKE_RVCT_LINKSTYLE"))
     511                                    (*it) = pathToLib;
     512                                else
     513                                    (*it) = "-l" + stub;
     514                                found = true;
    503515                                break;
    504516                            }
    505517                        }
    506                         if(!lib_stub.isNull()) {
    507                             (*it) = "-l" + lib_stub;
     518                    } else {
     519                        if(exists(project->values("QMAKE_PREFIX_SHLIB").first() + stub + "." + (*extit))) {
     520                            (*it) = project->values("QMAKE_PREFIX_SHLIB").first() + stub + "." + (*extit);
    508521                            found = true;
    509522                            break;
    510523                        }
    511                     } else {
    512                         if(exists("lib" + stub + "." + (*extit))) {
    513                             (*it) = "lib" + stub + "." + (*extit);
    514                             found = true;
    515                             break;
    516                         }
    517524                    }
    518525                }
    519526                if(!found && project->isActiveConfig("compile_libtool")) {
    520527                    for(int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
    521                         if(exists(libdirs[dep_i].local() + Option::dir_sep + "lib" + stub + Option::libtool_ext)) {
    522                             (*it) = libdirs[dep_i].real() + Option::dir_sep + "lib" + stub + Option::libtool_ext;
     528                        if(exists(libdirs[dep_i].local() + Option::dir_sep + + stub + Option::libtool_ext)) {
     529                            (*it) = libdirs[dep_i].real() + Option::dir_sep + + stub + Option::libtool_ext;
    523530                            found = true;
    524531                            break;
     
    545552    QList<QMakeLocalFileName> libdirs, frameworkdirs;
    546553    frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
    547     frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks"));
    548554    const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LFLAGS", "QMAKE_LIBS", QString() };
    549555    for(int i = 0; !lflags[i].isNull(); i++) {
     
    561567                        const QMakeLocalFileName &lfn = libdirs[dep_i];
    562568                        if(!project->isActiveConfig("compile_libtool")) { //give them the .libs..
    563                             QString la = lfn.local() + Option::dir_sep + "lib" + lib + Option::libtool_ext;
     569                            QString la = lfn.local() + Option::dir_sep + + lib + Option::libtool_ext;
    564570                            if(exists(la) && QFile::exists(lfn.local() + Option::dir_sep + ".libs")) {
    565571                                QString dot_libs = lfn.real() + Option::dir_sep + ".libs";
     
    569575                        }
    570576
    571                         QString prl = lfn.local() + Option::dir_sep + "lib" + lib;
     577                        QString prl = lfn.local() + Option::dir_sep + + lib;
    572578                        if(!project->isEmpty("QMAKE_" + lib.toUpper() + "_SUFFIX"))
    573579                            prl += project->first("QMAKE_" + lib.toUpper() + "_SUFFIX");
     
    617623        //merge them into a logical order
    618624        if(!project->isActiveConfig("no_smart_library_merge") && !project->isActiveConfig("no_lflags_merge")) {
    619             QStringList lflags;
     625            Q lflags;
    620626            for(int lit = 0; lit < l.size(); ++lit) {
     627
    621628                QString opt = l.at(lit).trimmed();
    622629                if(opt.startsWith("-")) {
     630
     631
     632
     633
     634
     635
     636
    623637                    if(opt.startsWith("-L") ||
    624638                       (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F"))) {
    625                         if(lit == 0 || l.lastIndexOf(opt, lit-1) == -1)
    626                             lflags.append(opt);
    627                     } else if(opt.startsWith("-l")) {
    628                         if(lit == l.size()-1 || l.indexOf(opt, lit+1) == -1)
    629                             lflags.append(opt);
     639                        if(!lflags[arch].contains(opt))
     640                            lflags[arch].append(opt);
     641                    } else if(opt.startsWith("-l") || opt == "-pthread") {
     642                        // Make sure we keep the dependency-order of libraries
     643                        if (lflags[arch].contains(opt))
     644                            lflags[arch].removeAll(opt);
     645                        lflags[arch].append(opt);
    630646                    } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) {
    631647                        if(opt.length() > 11)
    632648                            opt = opt.mid(11);
    633                         else
     649                        else
    634650                            opt = l.at(++lit);
     651
     652
     653
    635654                        bool found = false;
    636                         for(int x = lit+1; x < l.size(); ++x) {
    637                             QString xf = l.at(x);
     655                        for(int x = .size(); ++x) {
     656                            QString xf = l.at(x);
    638657                            if(xf.startsWith("-framework")) {
    639658                                QString framework;
     
    641660                                    framework = xf.mid(11);
    642661                                else
    643                                     framework = l.at(++x);
     662                                    framework = l.at(++x);
    644663                                if(framework == opt) {
    645664                                    found = true;
     
    649668                        }
    650669                        if(!found) {
    651                             lflags.append("-framework");
    652                             lflags.append(opt);
     670                            lflags.append("-framework");
     671                            lflags.append(opt);
    653672                        }
    654673                    } else {
    655                         lflags.append(opt);
     674                        lflags.append(opt);
    656675                    }
    657676                } else if(!opt.isNull()) {
    658                     if(lit == 0 || l.lastIndexOf(opt, lit-1) == -1)
    659                         lflags.append(opt);
    660                 }
    661             }
    662             l = lflags;
     677                    if(!lflags[arch].contains(opt))
     678                        lflags[arch].append(opt);
     679                }
     680            }
     681
     682            l =  lflags.take("default");
     683
     684            // Process architecture specific options (Xarch)
     685            QHash<QString, QStringList>::const_iterator archIterator = lflags.constBegin();
     686            while (archIterator != lflags.constEnd()) {
     687                const QStringList archOptions = archIterator.value();
     688                for (int i = 0; i < archOptions.size(); ++i) {
     689                    l.append(QLatin1String("-Xarch_") + archIterator.key());
     690                    l.append(archOptions.at(i));
     691                }
     692                ++archIterator;
     693            }
    663694        }
    664695    }
     
    780811        if(!links.isEmpty()) {
    781812            for(int i = 0; i < links.size(); ++i) {
    782                 if(Option::target_mode == Option::TARG_WIN_MODE ||
    783                    Option::target_mode == Option::TARG_OS2_MODE ||
    784                    Option::target_mode == Option::TARG_MAC9_MODE) {
    785                 } else if(Option::target_mode == Option::TARG_UNIX_MODE ||
    786                           Option::target_mode == Option::TARG_MACX_MODE) {
     813                if(Option::target_mode == Option::TARG_UNIX_MODE ||
     814                   Option::target_mode == Option::TARG_MACX_MODE) {
    787815                    QString link = Option::fixPathToTargetOS(destdir + links[i], false);
    788816                    int lslash = link.lastIndexOf(Option::dir_sep);
Note: See TracChangeset for help on using the changeset viewer.