Changeset 119


Ignore:
Timestamp:
Aug 17, 2009, 8:58:38 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

qmake/GNUMAKE: Improved PRL file processing (could sometimes lose parts of the library that was split using splitDll* functions so that client applications would miss symbols from the lost parts when linking).

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/mkspecs/features/os2/default_pre.prf

    r104 r119  
    5454    !build_pass: return(true)
    5555
    56     # this is necessary to store LIBS as QMAKE_PRL_LIBS in the generated .prl
    57     CONFIG += explicitlib
    58 
    5956    # define _VERSION_OVERRIDE statements if needed
    6057    for(a, 1) {
     
    7976
    8077        CONFIG($$SPLIT_CONFIG):CONFIG($$scope) {
    81             # add the other parts to LIBS of this part
     78            # add the other parts to LIBS of this part
    8279            for(b, 1) {
    8380                !equals(b, $${a}) {
    8481                    equals(b, "."):b =
    8582                    eval(LIBS += -l$${TARGET}$${b})
     83
    8684                }
    8785            }
    8886            !isEmpty(LIBS):export(LIBS)
    89             QMAKE_LIBDIR += $(DESTDIR)
     87            !isEmpty(PRL_EXPORT_LIBS):export(PRL_EXPORT_LIBS)
     88           
     89            QMAKE_LIBDIR *= $(DESTDIR)
    9090            export(QMAKE_LIBDIR)
    9191
  • trunk/qmake/generators/makefile.cpp

    r52 r119  
    963963    else if(!project->isEmpty("VERSION"))
    964964        t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl;
    965     if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) {
    966         QStringList libs;
    967         if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
    968             libs = project->values("QMAKE_INTERNAL_PRL_LIBS");
    969         else
    970             libs << "QMAKE_LIBS"; //obvious one
     965    if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib") ||
     966       !project->isEmpty("PRL_EXPORT_LIBS")) {
    971967        t << "QMAKE_PRL_LIBS = ";
    972         for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
    973             t << project->values((*it)).join(" ") << " ";
     968        if (!project->isEmpty("PRL_EXPORT_LIBS")) {
     969            // PRL_EXPORT_LIBS overrides anything else
     970            t << project->values("PRL_EXPORT_LIBS").join(" ");
     971        } else {
     972            QStringList libs;
     973            if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
     974                libs = project->values("QMAKE_INTERNAL_PRL_LIBS");
     975            else
     976                libs << "QMAKE_LIBS"; //obvious one
     977            for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
     978                t << project->values((*it)).join(" ") << " ";
     979        }
    974980        t << endl;
    975981    }
  • trunk/qmake/generators/os2/gnumake.cpp

    r103 r119  
    110110    if (project->isActiveConfig("link_prl")) {
    111111        QMakeMetaInfo libinfo;
    112         if (libinfo.readLib(bd + Option::dir_sep + dllStem)) {
     112        QString libfile = QMakeMetaInfo::findLib(bd + Option::dir_sep + dllStem);
     113        if (project->values("QMAKE_PRL_INTERNAL_FILES").contains(libfile)) {
     114            // already processed, return emtpy string to discard this lib
     115            return QString("");
     116        }
     117        if (libinfo.readLib(libfile)) {
     118            project->values("QMAKE_PRL_INTERNAL_FILES") += libfile;
    113119            QString target = libinfo.first("QMAKE_PRL_TARGET");
     120
     121
     122
     123
    114124            if (target.isEmpty())
    115                 target = stem;
     125                target = tem;
    116126            if (!versionOverride.isEmpty())
    117127                target += versionOverride;
     
    120130
    121131            const QStringList &in = libinfo.values("QMAKE_PRL_LIBS");
    122             QStringList &out = project->values("QMAKE_INTERNAL_PRL_LIBS");
     132            QStringList &out = project->values("QMAKE_PRL_LIBS");
    123133            for (QStringList::ConstIterator it = in.begin(); it != in.end(); ++it) {
    124134                if (!out.contains(*it))
     
    165175    }
    166176
    167     for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
    168         if((*it).startsWith("-L")) {
    169             dirs.append(QMakeLocalFileName((*it).mid(2)));
    170         } else {
    171             QString stem = *it, out;
    172 
    173             if (stem.startsWith("-l"))
    174                 stem = stem.mid(2);
    175 
    176             QString suffix;
    177             if (!project->isEmpty("QMAKE_" + stem.toUpper() + "_SUFFIX"))
    178                 suffix = project->first("QMAKE_" + stem.toUpper() + "_SUFFIX");
    179             for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
    180                 QString best = findBestVersion((*dir_it).local(), stem,
    181                                                QString("%1.lib").arg(suffix));
    182                 if (!best.isEmpty()) {
    183                     out = best.prepend("-l");
    184                     break;
     177    QStringList::Iterator it = l.begin();
     178
     179    do {
     180        project->values("QMAKE_PRL_LIBS").clear();
     181        bool erase = false;
     182        for (; it != l.end(); erase ? (erase = false, it = l.erase(it)) : ++it) {
     183            if((*it).startsWith("-L")) {
     184                dirs.append(QMakeLocalFileName((*it).mid(2)));
     185            } else {
     186                QString stem = *it, out;
     187
     188                if (stem.startsWith("-l"))
     189                    stem = stem.mid(2);
     190
     191                QString suffix;
     192                if (!project->isEmpty("QMAKE_" + stem.toUpper() + "_SUFFIX"))
     193                    suffix = project->first("QMAKE_" + stem.toUpper() + "_SUFFIX");
     194                for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
     195                    QString best = findBestVersion((*dir_it).local(), stem,
     196                                                   QString("%1.lib").arg(suffix));
     197                    if (!best.isNull()) {
     198                        if (best.isEmpty()) {
     199                            // we are asked to discard this lib, do it
     200                            erase = true;
     201                            break;
     202                        }
     203                        out = best.prepend("-l");
     204                        break;
     205                    }
    185206                }
     207
     208
     209
    186210            }
    187             if (!out.isEmpty()) // We assume if it never finds it that its correct
    188                 if (!project->values("QMAKE_LIBS").contains(out))
    189                     (*it) = out;
    190         }
    191     }
    192 
    193     QStringList l2 = project->values("QMAKE_INTERNAL_PRL_LIBS");
    194     for (QStringList::ConstIterator it = l2.begin(); it != l2.end(); ++it) {
    195         if (!l.contains(*it))
    196             l.append((*it));
    197     }
     211        }
     212
     213        // add the libraries from PRL and process them normally
     214        QStringList l2 = project->values("QMAKE_PRL_LIBS");
     215        int oldSize = l.size();
     216        for (QStringList::ConstIterator it2 = l2.begin(); it2 != l2.end(); ++it2) {
     217            if (!l.contains(*it2))
     218                l.append(*it2);
     219        }
     220        it = l.begin() + oldSize;
     221
     222    } while(it != l.end());
    198223
    199224    return true;
Note: See TracChangeset for help on using the changeset viewer.