QString operator+(const ProString &one, const ProString &two) { if (two.m_length) { if (!one.m_length) { return two.toQString(); } else { QString neu(one.m_length + two.m_length, Qt::Uninitialized); ushort *ptr = (ushort *)neu.constData(); memcpy(ptr, one.m_string.constData() + one.m_offset, one.m_length * 2); memcpy(ptr + one.m_length, two.m_string.constData() + two.m_offset, two.m_length * 2); return neu; } } return one.toQString(); }
void Win32MakefileGenerator::processPrlFiles() { const QString libArg = project->first("QMAKE_L_FLAG").toQString(); QList<QMakeLocalFileName> libdirs; static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 }; for (int i = 0; lflags[i]; i++) { ProStringList &l = project->values(lflags[i]); for (int lit = 0; lit < l.size(); ++lit) { QString opt = l.at(lit).trimmed().toQString(); if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) opt = opt.mid(1, opt.length()-2); if (opt.startsWith(libArg)) { QMakeLocalFileName l(opt.mid(libArg.length())); if (!libdirs.contains(l)) libdirs.append(l); } else if (!opt.startsWith("/")) { if (!processPrlFile(opt) && (QDir::isRelativePath(opt) || opt.startsWith("-l"))) { QString tmp; if (opt.startsWith("-l")) tmp = opt.mid(2); else tmp = opt; for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) { QString prl = (*it).local() + Option::dir_sep + tmp; if (processPrlFile(prl)) break; } } } ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS"); for (int prl = 0; prl < prl_libs.size(); ++prl) { ProString arg = prl_libs.at(prl); if (arg.startsWith(libArg)) arg = arg.left(libArg.length()) + escapeFilePath(arg.mid(libArg.length()).toQString()); else if (!arg.startsWith('/')) arg = escapeFilePath(arg.toQString()); l.insert(lit + prl + 1, arg); } prl_libs.clear(); } // Merge them into a logical order if (!project->isActiveConfig("no_smart_library_merge") && !project->isActiveConfig("no_lflags_merge")) { ProStringList lflags; for (int lit = 0; lit < l.size(); ++lit) { ProString opt = l.at(lit).trimmed(); if (opt.startsWith(libArg)) { if (!lflags.contains(opt)) lflags.append(opt); } else { // Make sure we keep the dependency-order of libraries lflags.removeAll(opt); lflags.append(opt); } } l = lflags; } } }
bool BuildsMetaMakefileGenerator::init() { if(init_flag) return false; init_flag = true; const ProStringList &builds = project->values("BUILDS"); bool use_single_build = builds.isEmpty(); if(builds.count() > 1 && Option::output.fileName() == "-") { use_single_build = true; warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS."); } else if(0 && !use_single_build && project->first("TEMPLATE") == "subdirs") { use_single_build = true; warn_msg(WarnLogic, "Cannot specify multiple builds with TEMPLATE subdirs."); } if(!use_single_build) { for(int i = 0; i < builds.count(); i++) { ProString build = builds[i]; MakefileGenerator *makefile = processBuild(build); if(!makefile) return false; if(!makefile->supportsMetaBuild()) { warn_msg(WarnLogic, "QMAKESPEC does not support multiple BUILDS."); clearBuilds(); use_single_build = true; break; } else { Build *b = new Build; b->name = name; if(builds.count() != 1) b->build = build.toQString(); b->makefile = makefile; makefiles += b; } } } if(use_single_build) { Build *build = new Build; build->name = name; build->makefile = createMakefileGenerator(project, false); if (build->makefile){ makefiles += build; }else { delete build; return false; } } return true; }
bool QMakeMetaInfo::readLibtoolFile(const QString &f) { /* I can just run the .la through the .pro parser since they are compatible.. */ QMakeProject proj; QString nf = Option::normalizePath(f); if (!proj.read(nf, QMakeEvaluator::LoadProOnly)) return false; QString dirf = nf.section(QLatin1Char('/'), 0, -2); if(dirf == nf) dirf = ""; else if(!dirf.isEmpty() && !dirf.endsWith(Option::output_dir)) dirf += QLatin1Char('/'); const ProValueMap &v = proj.variables(); for (ProValueMap::ConstIterator it = v.begin(); it != v.end(); ++it) { ProStringList lst = it.value(); if(lst.count() == 1 && (lst.first().startsWith("'") || lst.first().startsWith("\"")) && lst.first().endsWith(QString(lst.first().at(0)))) lst = ProStringList(lst.first().mid(1, lst.first().length() - 2)); if(!vars.contains("QMAKE_PRL_TARGET") && (it.key() == "dlname" || it.key() == "library_names" || it.key() == "old_library")) { ProString dir = v["libdir"].first(); if ((dir.startsWith('\'') || dir.startsWith('"')) && dir.endsWith(dir.at(0))) dir = dir.mid(1, dir.length() - 2); dir = dir.trimmed(); if(!dir.isEmpty() && !dir.endsWith(QLatin1Char('/'))) dir += QLatin1Char('/'); if(lst.count() == 1) lst = ProStringList(lst.first().toQString().split(" ")); for (ProStringList::Iterator lst_it = lst.begin(); lst_it != lst.end(); ++lst_it) { bool found = false; QString dirs[] = { "", dir.toQString(), dirf, dirf + ".libs/", "(term)" }; for(int i = 0; !found && dirs[i] != "(term)"; i++) { if(QFile::exists(dirs[i] + (*lst_it))) { QString targ = dirs[i] + (*lst_it); if(QDir::isRelativePath(targ)) targ.prepend(qmake_getpwd() + QLatin1Char('/')); vars["QMAKE_PRL_TARGET"] << targ; found = true; } } if(found) break; } } else if(it.key() == "dependency_libs") { if(lst.count() == 1) { ProString dep = lst.first(); if ((dep.startsWith('\'') || dep.startsWith('"')) && dep.endsWith(dep.at(0))) dep = dep.mid(1, dep.length() - 2); lst = ProStringList(dep.trimmed().toQString().split(" ")); } for (ProStringList::Iterator lit = lst.begin(); lit != lst.end(); ++lit) { if((*lit).startsWith("-R")) { if(!conf->isEmpty("QMAKE_LFLAGS_RPATH")) (*lit) = conf->first("QMAKE_LFLAGS_RPATH") + (*lit).mid(2); } } vars["QMAKE_PRL_LIBS"] += lst; } } return true; }