diff options
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 4 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 94 | ||||
-rw-r--r-- | qmake/meta.cpp | 8 | ||||
-rw-r--r-- | qmake/meta.h | 11 |
4 files changed, 51 insertions, 66 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index bfe9f08e77..219415ffdc 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -833,8 +833,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) encode the version number in the Project file which might be a bad things in days to come? --Sam */ - QString lib_file = (*lit) + Option::dir_sep + lib; - if(QMakeMetaInfo::libExists(lib_file)) { + QString lib_file = QMakeMetaInfo::findLib(Option::normalizePath((*lit) + Option::dir_sep + lib)); + if (!lib_file.isEmpty()) { QMakeMetaInfo libinfo(project); if(libinfo.readLib(lib_file)) { if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) { diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index b4190311ed..1aeac4390d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -872,64 +872,56 @@ MakefileGenerator::init() bool MakefileGenerator::processPrlFile(QString &file) { - bool ret = false, try_replace_file=false; - QString meta_file, orig_file = file; - if(QMakeMetaInfo::libExists(file)) { + bool try_replace_file = false; + QString f = fileFixify(file, FileFixifyBackwards); + QString meta_file = QMakeMetaInfo::findLib(f); + if (!meta_file.isEmpty()) { try_replace_file = true; - meta_file = file; } else { - QString tmp = file; + QString tmp = f; int ext = tmp.lastIndexOf('.'); if(ext != -1) tmp = tmp.left(ext); - meta_file = tmp; - } -// meta_file = fileFixify(meta_file); - QString real_meta_file = Option::normalizePath(meta_file); - if(!meta_file.isEmpty()) { - QString f = fileFixify(real_meta_file, FileFixifyBackwards); - if(QMakeMetaInfo::libExists(f)) { - QMakeMetaInfo libinfo(project); - debug_msg(1, "Processing PRL file: %s", real_meta_file.toLatin1().constData()); - if(!libinfo.readLib(f)) { - fprintf(stderr, "Error processing meta file: %s\n", real_meta_file.toLatin1().constData()); - } else if(project->isActiveConfig("no_read_prl_" + libinfo.type().toLower())) { - debug_msg(2, "Ignored meta file %s [%s]", real_meta_file.toLatin1().constData(), libinfo.type().toLatin1().constData()); - } else { - ret = true; - project->values("QMAKE_CURRENT_PRL_LIBS") = libinfo.values("QMAKE_PRL_LIBS"); - ProStringList &defs = project->values("DEFINES"); - const ProStringList &prl_defs = project->values("PRL_EXPORT_DEFINES"); - foreach (const ProString &def, libinfo.values("QMAKE_PRL_DEFINES")) - if (!defs.contains(def) && prl_defs.contains(def)) - defs.append(def); - if (try_replace_file) { - ProString tgt = libinfo.first("QMAKE_PRL_TARGET"); - if (!tgt.isEmpty()) { - int off = qMax(file.lastIndexOf('/'), file.lastIndexOf('\\')) + 1; - debug_msg(1, " Replacing library reference %s with %s", - file.mid(off).toLatin1().constData(), tgt.toQString().toLatin1().constData()); - file.replace(off, 1000, tgt.toQString()); - } - } - } - } - if(ret) { - QString mf = QMakeMetaInfo::findLib(meta_file); - if(project->values("QMAKE_PRL_INTERNAL_FILES").indexOf(mf) == -1) - project->values("QMAKE_PRL_INTERNAL_FILES").append(mf); - if(project->values("QMAKE_INTERNAL_INCLUDED_FILES").indexOf(mf) == -1) - project->values("QMAKE_INTERNAL_INCLUDED_FILES").append(mf); - } + meta_file = QMakeMetaInfo::findLib(tmp); } - if(try_replace_file && file.isEmpty()) { -#if 0 - warn_msg(WarnLogic, "Found prl [%s] file with no target [%s]!", meta_file.toLatin1().constData(), - orig_file.toLatin1().constData()); -#endif - file = orig_file; + if (meta_file.isEmpty()) + return false; + QMakeMetaInfo libinfo(project); + debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData()); + if (!libinfo.readLib(meta_file)) { + fprintf(stderr, "Error processing meta file %s\n", meta_file.toLatin1().constData()); + return false; } - return ret; + if (project->isActiveConfig("no_read_prl_" + libinfo.type().toLower())) { + debug_msg(2, "Ignored meta file %s [%s]", + meta_file.toLatin1().constData(), libinfo.type().toLatin1().constData()); + return false; + } + project->values("QMAKE_CURRENT_PRL_LIBS") = libinfo.values("QMAKE_PRL_LIBS"); + ProStringList &defs = project->values("DEFINES"); + const ProStringList &prl_defs = project->values("PRL_EXPORT_DEFINES"); + foreach (const ProString &def, libinfo.values("QMAKE_PRL_DEFINES")) + if (!defs.contains(def) && prl_defs.contains(def)) + defs.append(def); + if (try_replace_file) { + ProString tgt = libinfo.first("QMAKE_PRL_TARGET"); + if (tgt.isEmpty()) { + fprintf(stderr, "Error: %s does not define QMAKE_PRL_TARGET\n", + meta_file.toLatin1().constData()); + } else { + int off = qMax(file.lastIndexOf('/'), file.lastIndexOf('\\')) + 1; + debug_msg(1, " Replacing library reference %s with %s", + file.mid(off).toLatin1().constData(), + tgt.toQString().toLatin1().constData()); + file.replace(off, 1000, tgt.toQString()); + } + } + QString mf = fileFixify(meta_file); + if (!project->values("QMAKE_PRL_INTERNAL_FILES").contains(mf)) + project->values("QMAKE_PRL_INTERNAL_FILES").append(mf); + if (!project->values("QMAKE_INTERNAL_INCLUDED_FILES").contains(mf)) + project->values("QMAKE_INTERNAL_INCLUDED_FILES").append(mf); + return true; } void diff --git a/qmake/meta.cpp b/qmake/meta.cpp index 73414df73e..719b2c060f 100644 --- a/qmake/meta.cpp +++ b/qmake/meta.cpp @@ -48,10 +48,8 @@ QMakeMetaInfo::QMakeMetaInfo(QMakeProject *_conf) bool -QMakeMetaInfo::readLib(QString lib) +QMakeMetaInfo::readLib(const QString &meta_file) { - QString meta_file = findLib(lib); - if(cache_vars.contains(meta_file)) { vars = cache_vars[meta_file]; return true; @@ -84,10 +82,8 @@ QMakeMetaInfo::readLib(QString lib) QString -QMakeMetaInfo::findLib(QString lib) +QMakeMetaInfo::findLib(const QString &lib) { - lib = Option::normalizePath(lib); - QString ret; QString extns[] = { Option::prl_ext, /*Option::pkgcfg_ext, Option::libtool_ext,*/ QString() }; for(int extn = 0; !extns[extn].isNull(); extn++) { diff --git a/qmake/meta.h b/qmake/meta.h index a1a30fbfa8..7c91ffda44 100644 --- a/qmake/meta.h +++ b/qmake/meta.h @@ -55,11 +55,11 @@ class QMakeMetaInfo public: QMakeMetaInfo(QMakeProject *_conf); - bool readLib(QString lib); - static QString findLib(QString lib); - static bool libExists(QString lib); - QString type() const; + // These functions expect the path to be normalized + static QString findLib(const QString &lib); + bool readLib(const QString &meta_file); + QString type() const; bool isEmpty(const ProKey &v); ProStringList &values(const ProKey &v); ProString first(const ProKey &v); @@ -91,9 +91,6 @@ inline ProString QMakeMetaInfo::first(const ProKey &v) inline ProValueMap &QMakeMetaInfo::variables() { return vars; } -inline bool QMakeMetaInfo::libExists(QString lib) -{ return !findLib(lib).isNull(); } - QT_END_NAMESPACE #endif // META_H |