diff options
author | axis <qt-info@nokia.com> | 2011-01-31 11:37:19 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2011-01-31 11:37:19 (GMT) |
commit | 5cd39cd8a70be4c22164fe060ad64a1d9108bf41 (patch) | |
tree | 4b072c7d4e4d717fe8f0977dd2108837ac71f7c3 /qmake | |
parent | c40ae86025856225e74289249ecc509bf61dc9ba (diff) | |
parent | 9c132451acc7fbed1611fd3676cceb26e815f50d (diff) | |
download | Qt-5cd39cd8a70be4c22164fe060ad64a1d9108bf41.zip Qt-5cd39cd8a70be4c22164fe060ad64a1d9108bf41.tar.gz Qt-5cd39cd8a70be4c22164fe060ad64a1d9108bf41.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt into earth-master
Diffstat (limited to 'qmake')
53 files changed, 331 insertions, 300 deletions
diff --git a/qmake/cachekeys.h b/qmake/cachekeys.h index c5c1631..2957d61 100644 --- a/qmake/cachekeys.h +++ b/qmake/cachekeys.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index c659adb..0ec946e 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h index 4d3a7d2..c11425a 100644 --- a/qmake/generators/mac/pbuilder_pbx.h +++ b/qmake/generators/mac/pbuilder_pbx.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 9579ae4..595768f 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -3123,4 +3123,182 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const return false; } +QString +MakefileGenerator::pkgConfigFileName(bool fixify) +{ + QString ret = var("TARGET"); + int slsh = ret.lastIndexOf(Option::dir_sep); + if(slsh != -1) + ret = ret.right(ret.length() - slsh - 1); + if(ret.startsWith("lib")) + ret = ret.mid(3); + int dot = ret.indexOf('.'); + if(dot != -1) + ret = ret.left(dot); + ret += Option::pkgcfg_ext; + QString subdir = project->first("QMAKE_PKGCONFIG_DESTDIR"); + if(!subdir.isEmpty()) { + // initOutPaths() appends dir_sep, but just to be safe.. + if (!subdir.endsWith(Option::dir_sep)) + ret.prepend(Option::dir_sep); + ret.prepend(subdir); + } + if(fixify) { + if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR")) + ret.prepend(project->first("DESTDIR")); + ret = Option::fixPathToLocalOS(fileFixify(ret, qmake_getpwd(), Option::output_dir)); + } + return ret; +} + +QString +MakefileGenerator::pkgConfigPrefix() const +{ + if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX")) + return project->first("QMAKE_PKGCONFIG_PREFIX"); + return QLibraryInfo::location(QLibraryInfo::PrefixPath); +} + +QString +MakefileGenerator::pkgConfigFixPath(QString path) const +{ + QString prefix = pkgConfigPrefix(); + if(path.startsWith(prefix)) + path = path.replace(prefix, "${prefix}"); + return path; +} + +void +MakefileGenerator::writePkgConfigFile() +{ + QString fname = pkgConfigFileName(), lname = fname; + mkdir(fileInfo(fname).path()); + int slsh = lname.lastIndexOf(Option::dir_sep); + if(slsh != -1) + lname = lname.right(lname.length() - slsh - 1); + QFile ft(fname); + if(!ft.open(QIODevice::WriteOnly)) + return; + project->values("ALL_DEPS").append(fileFixify(fname)); + QTextStream t(&ft); + + QString prefix = pkgConfigPrefix(); + QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR"); + if(libDir.isEmpty()) + libDir = prefix + Option::dir_sep + "lib" + Option::dir_sep; + QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR"); + if(includeDir.isEmpty()) + includeDir = prefix + "/include"; + + t << "prefix=" << prefix << endl; + t << "exec_prefix=${prefix}\n" + << "libdir=" << pkgConfigFixPath(libDir) << "\n" + << "includedir=" << pkgConfigFixPath(includeDir) << endl; + // non-standard entry. Provides useful info normally only + // contained in the internal .qmake.cache file + t << varGlue("CONFIG", "qt_config=", " ", "") << endl; + + //extra PKGCONFIG variables + const QStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES"); + for(int i = 0; i < pkgconfig_vars.size(); ++i) { + QString var = project->first(pkgconfig_vars.at(i) + ".name"), + val = project->values(pkgconfig_vars.at(i) + ".value").join(" "); + if(var.isEmpty()) + continue; + if(val.isEmpty()) { + const QStringList &var_vars = project->values(pkgconfig_vars.at(i) + ".variable"); + for(int v = 0; v < var_vars.size(); ++v) { + const QStringList &vars = project->values(var_vars.at(v)); + for(int var = 0; var < vars.size(); ++var) { + if(!val.isEmpty()) + val += " "; + val += pkgConfigFixPath(vars.at(var)); + } + } + } + t << var << "=" << val << endl; + } + + t << endl; + + QString name = project->first("QMAKE_PKGCONFIG_NAME"); + if(name.isEmpty()) { + name = project->first("QMAKE_ORIG_TARGET").toLower(); + name.replace(0, 1, name[0].toUpper()); + } + t << "Name: " << name << endl; + QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(" "); + if(desc.isEmpty()) { + if(name.isEmpty()) { + desc = project->first("QMAKE_ORIG_TARGET").toLower(); + desc.replace(0, 1, desc[0].toUpper()); + } else { + desc = name; + } + if(project->first("TEMPLATE") == "lib") { + if(project->isActiveConfig("plugin")) + desc += " Plugin"; + else + desc += " Library"; + } else if(project->first("TEMPLATE") == "app") { + desc += " Application"; + } + } + t << "Description: " << desc << endl; + t << "Version: " << project->first("VERSION") << endl; + + // libs + t << "Libs: "; + QString pkgConfiglibDir; + QString pkgConfiglibName; + if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) { + pkgConfiglibDir = "-F${libdir}"; + QString bundle; + if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME")) + bundle = unescapeFilePath(project->first("QMAKE_FRAMEWORK_BUNDLE_NAME")); + else + bundle = unescapeFilePath(project->first("TARGET")); + int suffix = bundle.lastIndexOf(".framework"); + if (suffix != -1) + bundle = bundle.left(suffix); + pkgConfiglibName = "-framework " + bundle + " "; + } else { + pkgConfiglibDir = "-L${libdir}"; + pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length()); + } + t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl; + + QStringList libs; + if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) { + libs = project->values("QMAKE_INTERNAL_PRL_LIBS"); + } else { + libs << "QMAKE_LIBS"; //obvious one + } + libs << "QMAKE_LIBS_PRIVATE"; + libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread? + t << "Libs.private: "; + for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) { + t << project->values((*it)).join(" ") << " "; + } + t << endl; + + // flags + // ### too many + t << "Cflags: " + // << var("QMAKE_CXXFLAGS") << " " + << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") + << project->values("PRL_EXPORT_CXXFLAGS").join(" ") + << project->values("QMAKE_PKGCONFIG_CFLAGS").join(" ") + // << varGlue("DEFINES","-D"," -D"," ") + << " -I${includedir}" << endl; + + // requires + const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(" "); + if (!requires.isEmpty()) { + t << "Requires: " << requires << endl; + } + + t << endl; +} + QT_END_NAMESPACE diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 4c3be3d..e0ef52d 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -105,6 +105,11 @@ protected: virtual bool writeStubMakefile(QTextStream &t); virtual bool writeMakefile(QTextStream &t); + QString pkgConfigPrefix() const; + QString pkgConfigFileName(bool fixify=true); + QString pkgConfigFixPath(QString) const; + void writePkgConfigFile(); // for pkg-config + //generating subtarget makefiles struct SubTarget { diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 21e1273..56dc991 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/makefiledeps.h b/qmake/generators/makefiledeps.h index 15a96a2..c3f8770 100644 --- a/qmake/generators/makefiledeps.h +++ b/qmake/generators/makefiledeps.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index be957d6..ae48ddd 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h index e559c8e..c8592d3 100644 --- a/qmake/generators/metamakefile.h +++ b/qmake/generators/metamakefile.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index d225635..da634a1 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/projectgenerator.h b/qmake/generators/projectgenerator.h index cb9bc5a..7b4d56c 100644 --- a/qmake/generators/projectgenerator.h +++ b/qmake/generators/projectgenerator.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 2349c11..f9fae9d 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h index bc17b04..539f4c4 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.h +++ b/qmake/generators/symbian/initprojectdeploy_symbian.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/symbian/symbian_makefile.h b/qmake/generators/symbian/symbian_makefile.h index 9339223..c49845a 100644 --- a/qmake/generators/symbian/symbian_makefile.h +++ b/qmake/generators/symbian/symbian_makefile.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 4943a74..acd55e4 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -628,6 +628,7 @@ void SymbianCommonGenerator::writeRssFile(QString &numberOfIcons, QString &iconF t << "// * user." << endl; t << "// ============================================================================" << endl; t << endl; + t << "CHARACTER_SET UTF8" << endl; t << "#include <appinfo.rh>" << endl; t << "#include \"" << fixedTarget << ".loc\"" << endl; t << endl; diff --git a/qmake/generators/symbian/symbiancommon.h b/qmake/generators/symbian/symbiancommon.h index 1db5890..0b5f53d 100644 --- a/qmake/generators/symbian/symbiancommon.h +++ b/qmake/generators/symbian/symbiancommon.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 7a5a336..e6c9666 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index aba11de..a38fbe5 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 94cb22e..5729e26 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h index 214e0c5..3ac27b0 100644 --- a/qmake/generators/symbian/symmake_abld.h +++ b/qmake/generators/symbian/symmake_abld.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index c6dec6d..9eccd46 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -72,6 +72,35 @@ static QString sbsRvctPrefix; extern char **environ; #endif +static void fixFlmCmd(QString *cmdLine, const QMap<QString, QString> &commandsToReplace) +{ + // If commandItem starts with any $$QMAKE_* commands, do a replace for SBS equivalent. + // Command replacement is done only for the start of the command or right after + // concatenation operators (&& and ||), as otherwise unwanted replacements might occur. + static QString cmdFind(QLatin1String("(^|&&\\s*|\\|\\|\\s*)%1")); + static QString cmdReplace(QLatin1String("\\1%1")); + + // $$escape_expand(\\n\\t) doesn't work for bld.inf files, but is often used as command + // separator, so replace it with "&&" command concatenator. + cmdLine->replace("\n\t", "&&"); + + // Iterate command replacements in reverse alphabetical order of keys so + // that keys which are starts of other longer keys are iterated after longer keys. + QMapIterator<QString, QString> cmdIter(commandsToReplace); + cmdIter.toBack(); + while (cmdIter.hasPrevious()) { + cmdIter.previous(); + if (cmdLine->contains(cmdIter.key())) + cmdLine->replace(QRegExp(cmdFind.arg(cmdIter.key())), cmdReplace.arg(cmdIter.value())); + } + + // Sbsv2 toolchain strips all backslashes (even double ones) from option parameters, so just + // assume all backslashes are directory separators and replace them with slashes. + // Problem: If some command actually needs backslashes for something else than dir separator, + // we are out of luck. + cmdLine->replace("\\", "/"); +} + // Copies Qt FLMs to correct location under epocroot. // This is not done by configure as it is possible to change epocroot after configure. void SymbianSbsv2MakefileGenerator::exportFlm() @@ -386,7 +415,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo } t << endl; t << "clean-debug: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean"; + t << "\t$(SBS) reallyclean --toolcheck=off"; foreach(QString clause, debugClauses) { t << clause; } @@ -406,7 +435,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo } t << endl; t << "clean-release: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean"; + t << "\t$(SBS) reallyclean --toolcheck=off"; foreach(QString clause, releaseClauses) { t << clause; } @@ -516,8 +545,10 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo generateDistcleanTargets(t); + // Do not check for tools when doing generic clean, as most tools are not actually needed for + // cleaning. Mainly this is relevant for environments that do not have winscw compiler. t << "clean: " << BLD_INF_FILENAME << endl; - t << "\t-$(SBS) reallyclean"; + t << "\t-$(SBS) reallyclean --toolcheck=off"; foreach(QString clause, allClauses) { t << clause; } @@ -561,12 +592,6 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t commandsToReplace.insert(project->values("QMAKE_DEL_TREE").join(" "), project->values("QMAKE_SBSV2_DEL_TREE").join(" ")); - // If commandItem starts with any $$QMAKE_* commands, do a replace for SBS equivalent - // Command replacement is done only for the start of the command or right after - // concatenation operators (&& and ||), as otherwise unwanted replacements might occur. - static QString cmdFind("(^|&&\\s*|\\|\\|\\s*)%1"); - static QString cmdReplace("\\1%1"); - // Write extra compilers and targets to initialize QMAKE_ET_* variables // Cache results to avoid duplicate calls when creating wrapper makefile QTextStream extraCompilerStream(&extraCompilersCache); @@ -621,26 +646,13 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << "OPTION PREDEP_TARGET " << absoluteTarget << endl; t << "OPTION DEPS " << absoluteDeps << endl; - // Iterate command replacements in reverse alphabetical order of keys so - // that keys which are starts of other longer keys are iterated after longer keys. - QMapIterator<QString, QString> cmdIter(commandsToReplace); - cmdIter.toBack(); - while (cmdIter.hasPrevious()) { - cmdIter.previous(); - if (commandItem.contains(cmdIter.key())) { - commandItem.replace(QRegExp(cmdFind.arg(cmdIter.key())), - cmdReplace.arg(cmdIter.value())); - } - } - if (commandItem.indexOf("$(INCPATH)") != -1) commandItem.replace("$(INCPATH)", incPath.join(" ")); if (commandItem.indexOf("$(DEFINES)") != -1) commandItem.replace("$(DEFINES)", defines.join(" ")); - // Sbsv2 strips all backslashes (even doubles ones) from option parameters, so just replace them with slashes - // Problem: If some command actually needs backslashes for something else than dir separator, we are out of luck... - commandItem.replace("\\", "/"); + fixFlmCmd(&commandItem, commandsToReplace); + t << "OPTION COMMAND " << commandItem << endl; t << "END" << endl; } @@ -670,9 +682,11 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t // Write post link rules if (!project->isEmpty("QMAKE_POST_LINK")) { + QString postLinkCmd = var("QMAKE_POST_LINK"); + fixFlmCmd(&postLinkCmd, commandsToReplace); t << "START EXTENSION qt/qmake_post_link" << endl; - t << "OPTION POST_LINK_CMD " << var("QMAKE_POST_LINK") << endl; - t << "OPTION LINK_TARGET " << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".").append(getTargetExtension())) << endl; + t << "OPTION POST_LINK_CMD " << postLinkCmd << endl; + t << "OPTION LINK_TARGET " << fixedTarget << QLatin1String(".") << getTargetExtension() << endl; t << "END" << endl; t << endl; } diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h index 557e3dd..bec1034 100644 --- a/qmake/generators/symbian/symmake_sbsv2.h +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 43543a1..29d85f7 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h index 0ea3350..acbe8c4 100644 --- a/qmake/generators/unix/unixmake.h +++ b/qmake/generators/unix/unixmake.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -51,10 +51,6 @@ class UnixMakefileGenerator : public MakefileGenerator bool init_flag, include_deps; QString libtoolFileName(bool fixify=true); void writeLibtoolFile(); // for libtool - QString pkgConfigPrefix() const; - QString pkgConfigFileName(bool fixify=true); - QString pkgConfigFixPath(QString) const; - void writePkgConfigFile(); // for pkg-config void writePrlFile(QTextStream &); public: diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 7c68316..d7145b4 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -1340,177 +1340,4 @@ UnixMakefileGenerator::writeLibtoolFile() "libdir='" << Option::fixPathToTargetOS(install_dir, false) << "'\n"; } -QString -UnixMakefileGenerator::pkgConfigFileName(bool fixify) -{ - QString ret = var("TARGET"); - int slsh = ret.lastIndexOf(Option::dir_sep); - if(slsh != -1) - ret = ret.right(ret.length() - slsh - 1); - if(ret.startsWith("lib")) - ret = ret.mid(3); - int dot = ret.indexOf('.'); - if(dot != -1) - ret = ret.left(dot); - ret += Option::pkgcfg_ext; - if(!project->isEmpty("QMAKE_PKGCONFIG_DESTDIR")) - ret.prepend(project->first("QMAKE_PKGCONFIG_DESTDIR") + Option::dir_sep); - if(fixify) { - if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR")) - ret.prepend(project->first("DESTDIR")); - ret = Option::fixPathToLocalOS(fileFixify(ret, qmake_getpwd(), Option::output_dir)); - } - return ret; -} - -QString -UnixMakefileGenerator::pkgConfigPrefix() const -{ - if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX")) - return project->first("QMAKE_PKGCONFIG_PREFIX"); - return QLibraryInfo::location(QLibraryInfo::PrefixPath); -} - -QString -UnixMakefileGenerator::pkgConfigFixPath(QString path) const -{ - QString prefix = pkgConfigPrefix(); - if(path.startsWith(prefix)) - path = path.replace(prefix, "${prefix}"); - return path; -} - -void -UnixMakefileGenerator::writePkgConfigFile() -{ - QString fname = pkgConfigFileName(), lname = fname; - mkdir(fileInfo(fname).path()); - int slsh = lname.lastIndexOf(Option::dir_sep); - if(slsh != -1) - lname = lname.right(lname.length() - slsh - 1); - QFile ft(fname); - if(!ft.open(QIODevice::WriteOnly)) - return; - project->values("ALL_DEPS").append(fileFixify(fname)); - QTextStream t(&ft); - - QString prefix = pkgConfigPrefix(); - QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR"); - if(libDir.isEmpty()) - libDir = prefix + Option::dir_sep + "lib" + Option::dir_sep; - QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR"); - if(includeDir.isEmpty()) - includeDir = prefix + "/include"; - - t << "prefix=" << prefix << endl; - t << "exec_prefix=${prefix}\n" - << "libdir=" << pkgConfigFixPath(libDir) << "\n" - << "includedir=" << pkgConfigFixPath(includeDir) << endl; - // non-standard entry. Provides useful info normally only - // contained in the internal .qmake.cache file - t << varGlue("CONFIG", "qt_config=", " ", "") << endl; - - //extra PKGCONFIG variables - const QStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES"); - for(int i = 0; i < pkgconfig_vars.size(); ++i) { - QString var = project->first(pkgconfig_vars.at(i) + ".name"), - val = project->values(pkgconfig_vars.at(i) + ".value").join(" "); - if(var.isEmpty()) - continue; - if(val.isEmpty()) { - const QStringList &var_vars = project->values(pkgconfig_vars.at(i) + ".variable"); - for(int v = 0; v < var_vars.size(); ++v) { - const QStringList &vars = project->values(var_vars.at(v)); - for(int var = 0; var < vars.size(); ++var) { - if(!val.isEmpty()) - val += " "; - val += pkgConfigFixPath(vars.at(var)); - } - } - } - t << var << "=" << val << endl; - } - - t << endl; - - QString name = project->first("QMAKE_PKGCONFIG_NAME"); - if(name.isEmpty()) { - name = project->first("QMAKE_ORIG_TARGET").toLower(); - name.replace(0, 1, name[0].toUpper()); - } - t << "Name: " << name << endl; - QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(" "); - if(desc.isEmpty()) { - if(name.isEmpty()) { - desc = project->first("QMAKE_ORIG_TARGET").toLower(); - desc.replace(0, 1, desc[0].toUpper()); - } else { - desc = name; - } - if(project->first("TEMPLATE") == "lib") { - if(project->isActiveConfig("plugin")) - desc += " Plugin"; - else - desc += " Library"; - } else if(project->first("TEMPLATE") == "app") { - desc += " Application"; - } - } - t << "Description: " << desc << endl; - t << "Version: " << project->first("VERSION") << endl; - - // libs - t << "Libs: "; - QString pkgConfiglibDir; - QString pkgConfiglibName; - if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) { - pkgConfiglibDir = "-F${libdir}"; - QString bundle; - if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME")) - bundle = unescapeFilePath(project->first("QMAKE_FRAMEWORK_BUNDLE_NAME")); - else - bundle = unescapeFilePath(project->first("TARGET")); - int suffix = bundle.lastIndexOf(".framework"); - if (suffix != -1) - bundle = bundle.left(suffix); - pkgConfiglibName = "-framework " + bundle + " "; - } else { - pkgConfiglibDir = "-L${libdir}"; - pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length()); - } - t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl; - - QStringList libs; - if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) { - libs = project->values("QMAKE_INTERNAL_PRL_LIBS"); - } else { - libs << "QMAKE_LIBS"; //obvious one - } - libs << "QMAKE_LIBS_PRIVATE"; - libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread? - t << "Libs.private: "; - for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) { - t << project->values((*it)).join(" ") << " "; - } - t << endl; - - // flags - // ### too many - t << "Cflags: " - // << var("QMAKE_CXXFLAGS") << " " - << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << project->values("PRL_EXPORT_CXXFLAGS").join(" ") - << project->values("QMAKE_PKGCONFIG_CFLAGS").join(" ") - // << varGlue("DEFINES","-D"," -D"," ") - << " -I${includedir}" << endl; - - // requires - const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(" "); - if (!requires.isEmpty()) { - t << "Requires: " << requires << endl; - } - - t << endl; -} - QT_END_NAMESPACE diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp index b5c33c4..585a0f4 100644 --- a/qmake/generators/win32/borland_bmake.cpp +++ b/qmake/generators/win32/borland_bmake.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/borland_bmake.h b/qmake/generators/win32/borland_bmake.h index f306e17..7a2734f 100644 --- a/qmake/generators/win32/borland_bmake.h +++ b/qmake/generators/win32/borland_bmake.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index e4082cc..2639332 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -142,6 +142,9 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib") { + if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") + writePkgConfigFile(); + if(Option::mkfile::do_stub_makefile) { t << "QMAKE = " << var("QMAKE_QMAKE") << endl; QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 564cd48..5bc9c7b 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index f093e90..9fd5fa9 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -994,10 +994,6 @@ static inline QString toString(subSystemOption option) return "Console"; case subSystemWindows: return "Windows"; - case optLTCGOptimize: - return "PGOptimization"; - case optLTCGUpdate: - return "PGUpdate"; } return QString(); } diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h index 498552e..c80a270 100644 --- a/qmake/generators/win32/msbuild_objectmodel.h +++ b/qmake/generators/win32/msbuild_objectmodel.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index b72a8dfd..1b2cd18 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index b3fcb82..8954655 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 834e5fd..69cfc0d 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index b80d8d0..5431ce0 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 8719045..0df33d0 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index e843375..656afa9 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp index 7ba0c65..1e7c4b7 100644 --- a/qmake/generators/win32/msvc_vcxproj.cpp +++ b/qmake/generators/win32/msvc_vcxproj.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/msvc_vcxproj.h b/qmake/generators/win32/msvc_vcxproj.h index 45e6b95..3283cc7 100644 --- a/qmake/generators/win32/msvc_vcxproj.h +++ b/qmake/generators/win32/msvc_vcxproj.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index a2f4c7b..409d550 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -840,6 +840,18 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) uninst.append("\n\t"); uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); } + if(project->isActiveConfig("create_pc")) { + QString dst_pc = pkgConfigFileName(false); + if (!dst_pc.isEmpty()) { + dst_pc = filePrefixRoot(root, targetdir + dst_pc); + if(!ret.isEmpty()) + ret += "\n\t"; + ret += "-$(INSTALL_FILE) \"" + pkgConfigFileName(true) + "\" \"" + dst_pc + "\""; + if(!uninst.isEmpty()) + uninst.append("\n\t"); + uninst.append("-$(DEL_FILE) \"" + dst_pc + "\""); + } + } if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) { QString lib_target = getLibTarget(); lib_target.remove('"'); diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 0e95beb..cfc2c55 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp index 718bdd6..8b049ad 100644 --- a/qmake/generators/xmloutput.cpp +++ b/qmake/generators/xmloutput.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/generators/xmloutput.h b/qmake/generators/xmloutput.h index 7c0667c..9b97a3d 100644 --- a/qmake/generators/xmloutput.h +++ b/qmake/generators/xmloutput.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/main.cpp b/qmake/main.cpp index 42679a2..7dab23d 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/meta.cpp b/qmake/meta.cpp index 5b36682..ef822a6 100644 --- a/qmake/meta.cpp +++ b/qmake/meta.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/meta.h b/qmake/meta.h index 313ff9e..5fd3e72 100644 --- a/qmake/meta.h +++ b/qmake/meta.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/option.cpp b/qmake/option.cpp index 27e7c18..fcbf5fa 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/option.h b/qmake/option.h index b09ead2..23be12f 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/project.cpp b/qmake/project.cpp index 6d43147..af8cdf6 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -237,57 +237,54 @@ static QStringList split_arg_list(QString params) const ushort RPAREN = ')'; const ushort SINGLEQUOTE = '\''; const ushort DOUBLEQUOTE = '"'; + const ushort BACKSLASH = '\\'; const ushort COMMA = ','; const ushort SPACE = ' '; //const ushort TAB = '\t'; - ushort unicode; const QChar *params_data = params.data(); const int params_len = params.length(); - int last = 0; - while(last < params_len && (params_data[last].unicode() == SPACE - /*|| params_data[last].unicode() == TAB*/)) - ++last; - for(int x = last, parens = 0; x <= params_len; x++) { - unicode = params_data[x].unicode(); - if(x == params_len) { - while(x && params_data[x-1].unicode() == SPACE) - --x; - QString mid(params_data+last, x-last); - if(quote) { - if(mid[0] == quote && mid[(int)mid.length()-1] == quote) - mid = mid.mid(1, mid.length()-2); + for(int last = 0; ;) { + while(last < params_len && (params_data[last].unicode() == SPACE + /*|| params_data[last].unicode() == TAB*/)) + ++last; + for(int x = last, parens = 0; ; x++) { + if(x == params_len) { + while(x > last && params_data[x-1].unicode() == SPACE) + --x; + args << params.mid(last, x - last); + return args; + } + ushort unicode = params_data[x].unicode(); + if(x != (int)params_len-1 && unicode == BACKSLASH && + (params_data[x+1].unicode() == SINGLEQUOTE || params_data[x+1].unicode() == DOUBLEQUOTE)) { + x++; //get that 'escape' + } else if(quote && unicode == quote) { quote = 0; + } else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) { + quote = unicode; + } else if(unicode == RPAREN) { + --parens; + } else if(unicode == LPAREN) { + ++parens; + } + if(!parens && !quote && unicode == COMMA) { + int prev = last; + last = x+1; + while(x > prev && params_data[x-1].unicode() == SPACE) + --x; + args << params.mid(prev, x - prev); + break; } - args << mid; - break; - } - if(unicode == LPAREN) { - --parens; - } else if(unicode == RPAREN) { - ++parens; - } else if(quote && unicode == quote) { - quote = 0; - } else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) { - quote = unicode; - } - if(!parens && !quote && unicode == COMMA) { - QString mid = params.mid(last, x - last).trimmed(); - args << mid; - last = x+1; - while(last < params_len && (params_data[last].unicode() == SPACE - /*|| params_data[last].unicode() == TAB*/)) - ++last; } } - return args; } static QStringList split_value_list(const QString &vals) { QString build; QStringList ret; - QStack<char> quote; + ushort quote = 0; const ushort LPAREN = '('; const ushort RPAREN = ')'; @@ -303,17 +300,17 @@ static QStringList split_value_list(const QString &vals) if(x != (int)vals_len-1 && unicode == BACKSLASH && (vals_data[x+1].unicode() == SINGLEQUOTE || vals_data[x+1].unicode() == DOUBLEQUOTE)) { build += vals_data[x++]; //get that 'escape' - } else if(!quote.isEmpty() && unicode == quote.top()) { - quote.pop(); - } else if(unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE) { - quote.push(unicode); + } else if(quote && unicode == quote) { + quote = 0; + } else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) { + quote = unicode; } else if(unicode == RPAREN) { --parens; } else if(unicode == LPAREN) { ++parens; } - if(!parens && quote.isEmpty() && (vals_data[x] == Option::field_sep)) { + if(!parens && !quote && (vals_data[x] == Option::field_sep)) { ret << build; build.clear(); } else { @@ -1642,6 +1639,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap<QString, QStringL if(flags & IncludeFlagFeature) { if(!file.endsWith(Option::prf_ext)) file += Option::prf_ext; + validateModes(); // init dir_sep if(file.indexOf(Option::dir_sep) == -1 || !QFile::exists(file)) { static QStringList *feature_roots = 0; if(!feature_roots) { @@ -2988,6 +2986,7 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList var = ".BUILTIN." + var; place[var] = QStringList(qmake_getpwd()); } else if(var == QLatin1String("DIR_SEPARATOR")) { + validateModes(); var = ".BUILTIN." + var; place[var] = QStringList(Option::dir_sep); } else if(var == QLatin1String("DIRLIST_SEPARATOR")) { diff --git a/qmake/project.h b/qmake/project.h index 1d9ec04..09aa45e 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/property.cpp b/qmake/property.cpp index fde7c65..d84f8e1 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/property.h b/qmake/property.h index 545ea58..43b7529 100644 --- a/qmake/property.h +++ b/qmake/property.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/qmake/qmake_pch.h b/qmake/qmake_pch.h index e5a3aee..25f2716 100644 --- a/qmake/qmake_pch.h +++ b/qmake/qmake_pch.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** |