make QMakeMetaInfo a little less inefficient with libtool .la files

don't read the spec from scratch for every library just to get
QMAKE_LFLAGS_RPATH. we can perfectly use our current project for that
purpose.

Change-Id: I4e408b3fd5de81652181df032aa53cd8f2f8f806
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-08-22 14:10:35 +02:00 committed by Qt by Nokia
parent 09df6bec73
commit 791cb02463
6 changed files with 10 additions and 13 deletions

View File

@ -815,7 +815,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
*/
QString lib_file = (*lit) + Option::dir_sep + lib;
if(QMakeMetaInfo::libExists(lib_file)) {
QMakeMetaInfo libinfo;
QMakeMetaInfo libinfo(project);
if(libinfo.readLib(lib_file)) {
if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");

View File

@ -888,7 +888,7 @@ MakefileGenerator::processPrlFile(QString &file)
if(!meta_file.isEmpty()) {
QString f = fileFixify(real_meta_file, qmake_getpwd(), Option::output_dir);
if(QMakeMetaInfo::libExists(f)) {
QMakeMetaInfo libinfo;
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());

View File

@ -353,7 +353,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
const QStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES");
QStringList::ConstIterator it;
for(it = l.begin(); it != l.end(); ++it) {
QMakeMetaInfo libinfo;
QMakeMetaInfo libinfo(project);
if(libinfo.readLib((*it)) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) {
QString dir;
int slsh = (*it).lastIndexOf(Option::dir_sep);

View File

@ -64,7 +64,7 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem
if(!exists(bd))
return -1;
QMakeMetaInfo libinfo;
QMakeMetaInfo libinfo(project);
bool libInfoRead = libinfo.readLib(bd + Option::dir_sep + stem);
// If the library, for which we're trying to find the highest version

View File

@ -48,7 +48,8 @@ QT_BEGIN_NAMESPACE
QHash<QString, QHash<QString, QStringList> > QMakeMetaInfo::cache_vars;
QMakeMetaInfo::QMakeMetaInfo()
QMakeMetaInfo::QMakeMetaInfo(QMakeProject *_conf)
: conf(_conf)
{
}
@ -180,19 +181,12 @@ QMakeMetaInfo::readLibtoolFile(const QString &f)
dep = dep.mid(1, dep.length() - 2);
lst = dep.trimmed().split(" ");
}
QMakeProject *conf = NULL;
for(QStringList::Iterator lit = lst.begin(); lit != lst.end(); ++lit) {
if((*lit).startsWith("-R")) {
if(!conf) {
conf = new QMakeProject;
conf->read(QMakeProject::ReadAll ^ QMakeProject::ReadProFile);
}
if(!conf->isEmpty("QMAKE_LFLAGS_RPATH"))
(*lit) = conf->first("QMAKE_LFLAGS_RPATH") + (*lit).mid(2);
}
}
if(conf)
delete conf;
vars["QMAKE_PRL_LIBS"] += lst;
}
}

View File

@ -48,16 +48,19 @@
QT_BEGIN_NAMESPACE
class QMakeProject;
class QMakeMetaInfo
{
bool readLibtoolFile(const QString &f);
bool readPkgCfgFile(const QString &f);
QMakeProject *conf;
QHash<QString, QStringList> vars;
QString meta_type;
static QHash<QString, QHash<QString, QStringList> > cache_vars;
void clear();
public:
QMakeMetaInfo();
QMakeMetaInfo(QMakeProject *_conf);
bool readLib(QString lib);
static QString findLib(QString lib);