1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** Contact: Qt Software Information (qt-info@nokia.com) |
|
5 ** |
|
6 ** This file is part of the $MODULE$ of the Qt Toolkit. |
|
7 ** |
|
8 ** $QT_BEGIN_LICENSE:LGPL$ |
|
9 ** No Commercial Usage |
|
10 ** This file contains pre-release code and may not be distributed. |
|
11 ** You may use this file in accordance with the terms and conditions |
|
12 ** contained in the either Technology Preview License Agreement or the |
|
13 ** Beta Release License Agreement. |
|
14 ** |
|
15 ** GNU Lesser General Public License Usage |
|
16 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
17 ** General Public License version 2.1 as published by the Free Software |
|
18 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
19 ** packaging of this file. Please review the following information to |
|
20 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
21 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
22 ** |
|
23 ** In addition, as a special exception, Nokia gives you certain |
|
24 ** additional rights. These rights are described in the Nokia Qt LGPL |
|
25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this |
|
26 ** package. |
|
27 ** |
|
28 ** GNU General Public License Usage |
|
29 ** Alternatively, this file may be used under the terms of the GNU |
|
30 ** General Public License version 3.0 as published by the Free Software |
|
31 ** Foundation and appearing in the file LICENSE.GPL included in the |
|
32 ** packaging of this file. Please review the following information to |
|
33 ** ensure the GNU General Public License version 3.0 requirements will be |
|
34 ** met: http://www.gnu.org/copyleft/gpl.html. |
|
35 ** |
|
36 ** If you are unsure which license is appropriate for your use, please |
|
37 ** contact the sales department at qt-sales@nokia.com. |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "symmake.h" |
|
43 #include "initprojectdeploy_symbian.h" |
|
44 |
|
45 #include <qstring.h> |
|
46 #include <qhash.h> |
|
47 #include <qstringlist.h> |
|
48 #include <qdir.h> |
|
49 #include <qdatetime.h> |
|
50 #include <stdlib.h> |
|
51 #include <qdebug.h> |
|
52 |
|
53 #define RESOURCE_DIRECTORY_MMP "/resource/apps" |
|
54 #define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" |
|
55 #define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" |
|
56 #define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def" |
|
57 #define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonU.def" |
|
58 #define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1) |
|
59 |
|
60 #define BLD_INF_RULES_BASE "BLD_INF_RULES." |
|
61 #define BLD_INF_TAG_PLATFORMS "prj_platforms" |
|
62 #define BLD_INF_TAG_MMPFILES "prj_mmpfiles" |
|
63 #define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" |
|
64 #define BLD_INF_TAG_EXTENSIONS "prj_extensions" |
|
65 #define RSS_RULES "RSS_RULES" |
|
66 #define RSS_RULES_BASE "RSS_RULES." |
|
67 #define RSS_TAG_NBROFICONS "number_of_icons" |
|
68 #define RSS_TAG_ICONFILE "icon_file" |
|
69 |
|
70 #define DUMP_VAR(v) \ |
|
71 { \ |
|
72 QString s(v); \ |
|
73 QStringList list = project->values(s); \ |
|
74 printf("----------------------------------\n", qPrintable(s)); \ |
|
75 printf("Dumping %s (%d items) from %s, %d\n", \ |
|
76 qPrintable(s), \ |
|
77 list.count(), \ |
|
78 __FILE__, \ |
|
79 __LINE__); \ |
|
80 foreach(QString l, list) \ |
|
81 printf("\t%s\n", qPrintable(l)); \ |
|
82 } |
|
83 |
|
84 QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) |
|
85 { |
|
86 static QString epocRootStr; |
|
87 if (epocRootStr.isEmpty()) { |
|
88 QFileInfo efi(epocRoot()); |
|
89 epocRootStr = efi.canonicalFilePath(); |
|
90 if (epocRootStr.isEmpty()) { |
|
91 fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot())); |
|
92 epocRootStr = "/"; |
|
93 } |
|
94 if (!epocRootStr.endsWith("/")) |
|
95 epocRootStr += "/"; |
|
96 |
|
97 epocRootStr += "epoc32/"; |
|
98 } |
|
99 |
|
100 QString resultPath = origPath; |
|
101 |
|
102 // Make it relative, unless it starts with "%epocroot%/epoc32/" |
|
103 if (resultPath.startsWith(epocRootStr, Qt::CaseInsensitive)) { |
|
104 resultPath.replace(epocRootStr, "/epoc32/", Qt::CaseInsensitive); |
|
105 } else { |
|
106 resultPath = parentDir.relativeFilePath(resultPath); |
|
107 } |
|
108 resultPath = QDir::cleanPath(resultPath); |
|
109 |
|
110 if (resultPath.isEmpty()) |
|
111 resultPath = "."; |
|
112 |
|
113 return resultPath; |
|
114 } |
|
115 |
|
116 QString SymbianMakefileGenerator::canonizePath(const QString& origPath) |
|
117 { |
|
118 // Since current path gets appended almost always anyway, use it as default |
|
119 // for nonexisting paths. |
|
120 static QString defaultPath; |
|
121 if (defaultPath.isEmpty()) { |
|
122 QFileInfo fi("."); |
|
123 defaultPath = fi.canonicalFilePath(); |
|
124 } |
|
125 |
|
126 // Prepend epocroot to any paths beginning with "/epoc32/" |
|
127 QString resultPath = QDir::fromNativeSeparators(origPath); |
|
128 QString tempPath(resultPath); |
|
129 bool isEpoc = false; |
|
130 if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) { |
|
131 isEpoc = true; |
|
132 resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1); |
|
133 } |
|
134 |
|
135 QFileInfo fi(fileInfo(resultPath)); |
|
136 if(fi.isDir()) { |
|
137 if (isEpoc) |
|
138 resultPath = fi.absoluteFilePath();//canonicalFilePath(); |
|
139 else |
|
140 resultPath = fi.canonicalFilePath(); |
|
141 } else { |
|
142 if (isEpoc) |
|
143 resultPath = fi.absolutePath();//canonicalPath(); |
|
144 else |
|
145 resultPath = fi.canonicalPath(); |
|
146 } |
|
147 //some fix for the not existed EPOC32\include folder |
|
148 if (isEpoc) { |
|
149 int index = resultPath.lastIndexOf("/epoc32/"); |
|
150 QString tmpRes = resultPath.mid(index); |
|
151 if (tmpRes != tempPath) { |
|
152 //we have the problems for not existed include directory |
|
153 //change the path |
|
154 resultPath.replace(tmpRes, tempPath); |
|
155 } |
|
156 } |
|
157 |
|
158 resultPath = QDir::cleanPath(resultPath); |
|
159 |
|
160 if (resultPath.isEmpty()) |
|
161 resultPath = defaultPath; |
|
162 |
|
163 return resultPath; |
|
164 } |
|
165 |
|
166 SymbianMakefileGenerator::SymbianMakefileGenerator() : MakefileGenerator() { } |
|
167 SymbianMakefileGenerator::~SymbianMakefileGenerator() { } |
|
168 |
|
169 void SymbianMakefileGenerator::writeHeader(QTextStream &t) { |
|
170 t << "// ============================================================================" << endl; |
|
171 t << "// * Makefile for building: " << escapeFilePath(var("TARGET")) << endl; |
|
172 t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
173 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
174 t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
175 t << "// * user." << endl; |
|
176 t << "// * Project: " << fileFixify(project->projectFile()) << endl; |
|
177 t << "// * Template: " << var("TEMPLATE") << endl; |
|
178 //if(!project->isActiveConfig("build_pass")) |
|
179 // t << "// = Command: " << build_args().replace("$(QMAKE)", |
|
180 // (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE"))) << endl; |
|
181 t << "// ============================================================================" << endl; |
|
182 t << endl; |
|
183 |
|
184 // defining define for bld.inf |
|
185 |
|
186 QString shortProFilename = project->projectFile(); |
|
187 shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
188 shortProFilename.replace(QString(".pro"), QString("")); |
|
189 |
|
190 QString bldinfDefine = shortProFilename; |
|
191 bldinfDefine.append("_"); |
|
192 bldinfDefine.append(generate_uid(project->projectFile())); |
|
193 |
|
194 bldinfDefine.prepend("BLD_INF_"); |
|
195 removeSpecialCharacters(bldinfDefine); |
|
196 |
|
197 t << "#define " << bldinfDefine.toUpper() << endl << endl; |
|
198 } |
|
199 |
|
200 bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) { |
|
201 writeHeader(t); |
|
202 |
|
203 QString numberOfIcons; |
|
204 QString iconFile; |
|
205 QStringList userRssRules; |
|
206 readRssRules(numberOfIcons, iconFile, userRssRules); |
|
207 |
|
208 // Get the application translations and convert to symbian OS lang code, i.e. decical number |
|
209 QStringList symbianLangCodes = symbianLangCodesFromTsFiles(); |
|
210 |
|
211 // Generate pkg files if there are any actual files to deploy |
|
212 bool generatePkg = false; |
|
213 if (getTargetExtension() == "exe") { |
|
214 generatePkg = true; |
|
215 } else { |
|
216 foreach(QString item, project->values("DEPLOYMENT")) { |
|
217 if (!project->values(item + ".sources").isEmpty()) { |
|
218 generatePkg = true; |
|
219 break; |
|
220 } |
|
221 } |
|
222 } |
|
223 |
|
224 if (generatePkg) { |
|
225 QStringList platformList = project->values("SYMBIAN_PLATFORMS"); |
|
226 foreach(QString platform, platformList) { |
|
227 if(platform.compare("WINSCW", Qt::CaseInsensitive)) { |
|
228 generatePkgFile(platform.toLower(), "udeb", iconFile); |
|
229 generatePkgFile(platform.toLower(), "urel", iconFile); |
|
230 } |
|
231 } |
|
232 } |
|
233 |
|
234 writeBldInfContent(t, generatePkg); |
|
235 |
|
236 // Generate empty wrapper makefile here, because wrapper makefile must exist before writeMkFile, |
|
237 // but all required data is not yet available. |
|
238 bool isPrimaryMakefile = true; |
|
239 QString wrapperFileName("Makefile"); |
|
240 QString outputFileName = fileInfo(Option::output.fileName()).fileName(); |
|
241 if (outputFileName != BLD_INF_FILENAME) { |
|
242 wrapperFileName.append(".").append((outputFileName.size() > BLD_INF_FILENAME_LEN && outputFileName.left(BLD_INF_FILENAME_LEN) == BLD_INF_FILENAME) ? outputFileName.mid(8) : outputFileName); |
|
243 isPrimaryMakefile = false; |
|
244 } |
|
245 |
|
246 QFile wrapperMakefile(wrapperFileName); |
|
247 if(wrapperMakefile.open(QIODevice::WriteOnly)) { |
|
248 generatedFiles << wrapperFileName; |
|
249 } else { |
|
250 fprintf(stderr, "Error: Could not open wrapper makefile '%s'\n", qPrintable(wrapperFileName)); |
|
251 return false; |
|
252 } |
|
253 |
|
254 if (getTargetExtension() == "subdirs") { |
|
255 // If we have something to deploy, generate extension makefile for just that, since |
|
256 // normal extension makefile is not getting generated and we need emulator deployment to be done. |
|
257 if (generatePkg) |
|
258 writeMkFile(wrapperFileName, true); |
|
259 writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); |
|
260 return true; |
|
261 } |
|
262 |
|
263 writeMkFile(wrapperFileName, false); |
|
264 |
|
265 QString shortProFilename = project->projectFile(); |
|
266 shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
267 shortProFilename.replace(QString(".pro"), QString("")); |
|
268 |
|
269 QString mmpFilename = shortProFilename; |
|
270 mmpFilename.append("_"); |
|
271 mmpFilename.append(uid3); |
|
272 mmpFilename.append(".mmp"); |
|
273 writeMmpFile(mmpFilename, symbianLangCodes); |
|
274 |
|
275 if (getTargetExtension() == "exe") { |
|
276 if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { |
|
277 QString appname = escapeFilePath(fileFixify(project->first("TARGET"))); |
|
278 appname = removePathSeparators(appname); |
|
279 writeRegRssFile(appname, userRssRules); |
|
280 writeRssFile(appname, numberOfIcons, iconFile); |
|
281 writeLocFile(appname, symbianLangCodes); |
|
282 } |
|
283 } |
|
284 |
|
285 writeCustomDefFile(); |
|
286 writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); |
|
287 |
|
288 return true; |
|
289 } |
|
290 |
|
291 bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) { |
|
292 QString pkgFilename = QString("%1_%2_%3.%4") |
|
293 .arg(fileInfo(project->projectFile()).completeBaseName()) |
|
294 .arg(compiler) |
|
295 .arg(config) |
|
296 .arg("pkg"); |
|
297 QFile pkgFile(pkgFilename); |
|
298 if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) |
|
299 return false; |
|
300 |
|
301 generatedFiles << pkgFile.fileName(); |
|
302 |
|
303 // header info |
|
304 QTextStream t(&pkgFile); |
|
305 t << QString("; %1 generated by qmake at %2").arg(pkgFilename).arg(QDateTime::currentDateTime().toString(Qt::ISODate)) << endl; |
|
306 t << "; This file is generated by qmake and should not be modified by the user" << endl; |
|
307 t << ";" << endl << endl; |
|
308 |
|
309 // language, (*** hardcoded to english atm) |
|
310 t << "; Language" << endl; |
|
311 t << "&EN" << endl << endl; |
|
312 |
|
313 // name of application, UID and version |
|
314 QString applicationName = project->first("TARGET"); |
|
315 int last = applicationName.lastIndexOf(QLatin1Char('/')); |
|
316 applicationName = applicationName.mid( last == -1 ? 0 : last+1 ); |
|
317 |
|
318 QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); |
|
319 |
|
320 t << "; SIS header: name, uid, version" << endl; |
|
321 t << QString("#{\"%1\"},(%2),%3").arg(applicationName).arg(uid3).arg(applicationVersion) << endl << endl; |
|
322 |
|
323 // vendor names (*** hardcoded for now) |
|
324 t << "; Localised Vendor name" << endl; |
|
325 t << "%{\"Nokia, Qt Software\"}" << endl << endl; |
|
326 t << "; Unique Vendor name" << endl; |
|
327 t << ":\"Nokia, Qt Software\"" << endl << endl; |
|
328 |
|
329 // Dependencies |
|
330 t << "; Dependencies" << endl; |
|
331 foreach(QString item, project->values("DEPLOYMENT")) { |
|
332 QStringList dependencies = project->values(item + ".depends"); |
|
333 foreach(QString dependency, dependencies) { |
|
334 t << dependency << endl; |
|
335 } |
|
336 } |
|
337 t << endl; |
|
338 |
|
339 // install paths on the phone *** should be dynamic at some point |
|
340 QString installPathBin = "!:\\sys\\bin"; |
|
341 QString installPathResource = "!:\\resource\\apps"; |
|
342 QString installPathRegResource = "!:\\private\\10003a3f\\import\\apps"; |
|
343 |
|
344 // find location of builds |
|
345 QString epocReleasePath = QString("%1epoc32/release/%2/%3") |
|
346 .arg(epocRoot()) |
|
347 .arg(compiler) |
|
348 .arg(config); |
|
349 |
|
350 |
|
351 if (getTargetExtension() == "exe") { |
|
352 // deploy .exe file |
|
353 t << "; Executable and default resource files" << endl; |
|
354 QString exeFile = applicationName + ".exe"; |
|
355 t << QString("\"%1/%2\" - \"%3\\%4\"") |
|
356 .arg(epocReleasePath) |
|
357 .arg(exeFile) |
|
358 .arg(installPathBin) |
|
359 .arg(exeFile) << endl; |
|
360 |
|
361 // deploy rsc & reg_rsc file |
|
362 if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { |
|
363 t << QString("\"%1epoc32/data/z/resource/apps/%2\" - \"%3\\%4\"") |
|
364 .arg(epocRoot()) |
|
365 .arg(applicationName + ".rsc") |
|
366 .arg(installPathResource) |
|
367 .arg(applicationName + ".rsc") << endl; |
|
368 |
|
369 t << QString("\"%1epoc32/data/z/private/10003a3f/import/apps/%2\" - \"%3\\%4\"") |
|
370 .arg(epocRoot()) |
|
371 .arg(applicationName + "_reg.rsc") |
|
372 .arg(installPathRegResource) |
|
373 .arg(applicationName + "_reg.rsc") << endl; |
|
374 |
|
375 QString myIconFile = iconFile; |
|
376 myIconFile = myIconFile.replace("\\\\", "\\"); |
|
377 |
|
378 if (!iconFile.isEmpty()) { |
|
379 t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") |
|
380 .arg(epocRoot()) |
|
381 .arg(QString(myIconFile).replace('\\','/')) |
|
382 .arg(myIconFile) << endl << endl; |
|
383 } |
|
384 } |
|
385 } |
|
386 |
|
387 // deploy any additional DEPLOYMENT files |
|
388 DeploymentList depList; |
|
389 QString remoteTestPath; |
|
390 remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); |
|
391 |
|
392 initProjectDeploySymbian( project, depList, remoteTestPath, true, compiler, config, generatedDirs, generatedFiles ); |
|
393 if (depList.size()) |
|
394 t << "; DEPLOYMENT" << endl; |
|
395 for (int i=0; i<depList.size(); ++i) { |
|
396 t << QString("\"%1\" - \"%2\"") |
|
397 .arg(QString(depList.at(i).from).replace('\\','/')) |
|
398 .arg(depList.at(i).to) << endl; |
|
399 } |
|
400 |
|
401 return true; |
|
402 } |
|
403 |
|
404 bool SymbianMakefileGenerator::writeCustomDefFile() { |
|
405 if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { |
|
406 // Create custom def file for plugin |
|
407 QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); |
|
408 |
|
409 if(ft.open(QIODevice::WriteOnly)) { |
|
410 generatedFiles << ft.fileName(); |
|
411 QTextStream t(&ft); |
|
412 |
|
413 t << "; ==============================================================================" << endl; |
|
414 t << "; Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
415 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
416 t << "; This file is generated by qmake and should not be modified by the" << endl; |
|
417 t << "; user." << endl; |
|
418 t << "; Name : " PLUGIN_COMMON_DEF_FILE_ACTUAL << endl; |
|
419 t << "; Part of : " << project->values("TARGET").join(" ") << endl; |
|
420 t << "; Description : Fixes common plugin symbols to known ordinals" << endl; |
|
421 t << "; Version : " << endl; |
|
422 t << ";" << endl; |
|
423 t << "; ==============================================================================" << "\n" << endl; |
|
424 |
|
425 t << endl; |
|
426 |
|
427 t << "EXPORTS" << endl; |
|
428 t << "\tqt_plugin_query_verification_data @ 1 NONAME" << endl; |
|
429 t << "\tqt_plugin_instance @ 2 NONAME" << endl; |
|
430 t << endl; |
|
431 } else { |
|
432 return false; |
|
433 } |
|
434 } |
|
435 |
|
436 return true; |
|
437 } |
|
438 |
|
439 void SymbianMakefileGenerator::init() |
|
440 { |
|
441 MakefileGenerator::init(); |
|
442 /* |
|
443 DUMP_VAR("GENERATED_SOURCES"); |
|
444 */ |
|
445 // fixing again !!! |
|
446 if(0 != project->values("QMAKE_PLATFORM").size()) |
|
447 platform = varGlue("QMAKE_PLATFORM", "", " ", ""); |
|
448 |
|
449 if(0 == project->values("QMAKESPEC").size()) |
|
450 project->values("QMAKESPEC").append(qgetenv("QMAKESPEC")); |
|
451 |
|
452 if(!isConfigSetToSymbian()) |
|
453 project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); |
|
454 |
|
455 |
|
456 // bld.inf |
|
457 project->values("MAKEFILE") += BLD_INF_FILENAME; |
|
458 |
|
459 // .mmp |
|
460 initMmpVariables(); |
|
461 |
|
462 // UID1 |
|
463 uid1 = generateUID1(); |
|
464 |
|
465 // check TARGET.UID2 and TARGET.UID3 presence |
|
466 if(0 != project->values("TARGET.UID3").size()) { |
|
467 uid3 = project->first("TARGET.UID3"); |
|
468 } else { |
|
469 uid3 = generateUID3(); |
|
470 } |
|
471 |
|
472 // some fix |
|
473 if((project->values("TEMPLATE")).contains("app")) |
|
474 targetType = "exe"; |
|
475 else if((project->values("TEMPLATE")).contains("lib")) { |
|
476 // check CONFIG to see if we are to build staticlib or dll |
|
477 if(project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static")) |
|
478 targetType = "staticlib"; |
|
479 else if (project->values("CONFIG").contains("plugin")) |
|
480 targetType = "plugin"; |
|
481 else // for now it will be default |
|
482 targetType = "dll"; |
|
483 } |
|
484 else // fix |
|
485 targetType = "subdirs"; |
|
486 |
|
487 if(0 != project->values("TARGET.UID2").size()) { |
|
488 uid2 = project->first("TARGET.UID2"); |
|
489 } else if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { |
|
490 uid2 = "0x20004C45"; |
|
491 } else { |
|
492 if(getTargetExtension() == "exe") { |
|
493 if(project->values("QT").contains("gui", Qt::CaseInsensitive)) { |
|
494 // exe and also gui |
|
495 uid2 = "0x100039CE"; |
|
496 } else { |
|
497 // exe but not gui.. uid2 is ignored anyway |
|
498 // set it to 0 |
|
499 uid2 = "0"; |
|
500 } |
|
501 } else if(getTargetExtension() == "dll" || getTargetExtension() == "lib") { |
|
502 uid2 = "0x1000008d"; |
|
503 } |
|
504 } |
|
505 |
|
506 uid2 = uid2.trimmed(); |
|
507 uid3 = uid3.trimmed(); |
|
508 |
|
509 // UID is valid as either hex or decimal, so just convert it to number and back to hex |
|
510 // to get proper string for private dir |
|
511 bool conversionOk = false; |
|
512 uint uidNum = uid3.toUInt(&conversionOk, 0); |
|
513 |
|
514 if (!conversionOk) { |
|
515 fprintf(stderr, "Error: Invalid UID \"%s\".", uid3.toUtf8().constData()); |
|
516 } else { |
|
517 privateDirUid.setNum(uidNum, 16); |
|
518 while (privateDirUid.length() < 8) |
|
519 privateDirUid.insert(0,QLatin1Char('0')); |
|
520 } |
|
521 } |
|
522 |
|
523 QString SymbianMakefileGenerator::getTargetExtension() { |
|
524 QString ret; |
|
525 if(targetType.compare("exe", Qt::CaseInsensitive) == 0 || targetType.compare("app", Qt::CaseInsensitive) == 0) { |
|
526 ret.append("exe"); |
|
527 } else if (targetType.compare("staticlib",Qt::CaseInsensitive) == 0) { |
|
528 ret.append("lib"); |
|
529 } else if (targetType.compare("dll", Qt::CaseInsensitive) == 0 || targetType.compare("plugin", Qt::CaseInsensitive) == 0) { |
|
530 ret.append("dll"); |
|
531 } else if (targetType.compare("subdirs", Qt::CaseInsensitive) == 0) { |
|
532 // just fix |
|
533 ret.append("subdirs"); |
|
534 } else { |
|
535 // if nothing said then assume "exe" |
|
536 ret.append("exe"); |
|
537 } |
|
538 |
|
539 return ret; |
|
540 } |
|
541 |
|
542 bool SymbianMakefileGenerator::isConfigSetToSymbian() { |
|
543 return project->values("CONFIG").contains("symbian", Qt::CaseInsensitive); |
|
544 } |
|
545 |
|
546 QString SymbianMakefileGenerator::generateUID1() { |
|
547 // just for now |
|
548 return QString(""); |
|
549 } |
|
550 |
|
551 QString SymbianMakefileGenerator::generateUID2() { |
|
552 // standard stuff; picked form symbian |
|
553 // later meybe read from somewhere |
|
554 return QString(""); |
|
555 } |
|
556 |
|
557 QString SymbianMakefileGenerator::generateUID3() { |
|
558 |
|
559 QString target = project->first("TARGET"); |
|
560 QString currPath = qmake_getpwd(); |
|
561 target.prepend("/").prepend(currPath); |
|
562 return generate_test_uid(target); |
|
563 |
|
564 } |
|
565 |
|
566 bool SymbianMakefileGenerator::initMmpVariables() { |
|
567 QStringList sysincspaths; |
|
568 QStringList srcincpaths; |
|
569 QStringList srcpaths; |
|
570 |
|
571 srcpaths << project->values("SOURCES") << project->values("GENERATED_SOURCES"); |
|
572 srcpaths << project->values("UNUSED_SOURCES") << project->values("UI_SOURCES_DIR"); |
|
573 srcpaths << project->values("UI_DIR"); |
|
574 |
|
575 QDir current = QDir::current(); |
|
576 QString canonizedCurrent = canonizePath("."); |
|
577 |
|
578 for(int j = 0; j < srcpaths.size(); ++j) { |
|
579 QFileInfo fi(fileInfo(srcpaths.at(j))); |
|
580 // Sometimes sources have other than *.c* files (e.g. *.moc); prune them. |
|
581 if (fi.suffix().startsWith("c")) { |
|
582 if(fi.filePath().length() > fi.fileName().length() ) { |
|
583 appendIfnotExist(srcincpaths, fi.path() ); |
|
584 sources[canonizePath(fi.path())] += fi.fileName(); |
|
585 } else { |
|
586 sources[canonizedCurrent] += fi.fileName(); |
|
587 appendIfnotExist(srcincpaths, canonizedCurrent); |
|
588 } |
|
589 } |
|
590 } |
|
591 |
|
592 QStringList incpaths; |
|
593 incpaths << project->values("INCLUDEPATH"); |
|
594 incpaths << QLibraryInfo::location(QLibraryInfo::HeadersPath); |
|
595 incpaths << project->values("HEADERS"); |
|
596 incpaths << srcincpaths; |
|
597 incpaths << project->values("UI_HEADERS_DIR"); |
|
598 incpaths << project->values("UI_DIR"); |
|
599 |
|
600 QString epocPath("epoc32"); |
|
601 for(int j = 0; j < incpaths.size(); ++j) { |
|
602 QString includepath = canonizePath(incpaths.at(j)); |
|
603 appendIfnotExist(sysincspaths, includepath); |
|
604 if (!includepath.contains(epocPath)) // No temp dirs for epoc includes |
|
605 appendIfnotExist(sysincspaths, includepath + QString("/tmp")); |
|
606 } |
|
607 |
|
608 // remove duplicate include path entries |
|
609 // convert to native directory separators |
|
610 // to check if includepaths are same |
|
611 QStringList temporary; |
|
612 for(int i = 0; i < sysincspaths.size(); ++i) { |
|
613 QString origPath = sysincspaths.at(i); |
|
614 QFileInfo origPathInfo(fileInfo(origPath)); |
|
615 bool bFound = false; |
|
616 |
|
617 for(int j = 0; j < temporary.size(); ++j) { |
|
618 QString tmpPath = temporary.at(j); |
|
619 QFileInfo tmpPathInfo(fileInfo(tmpPath)); |
|
620 |
|
621 if(origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { |
|
622 bFound = true; |
|
623 if(!tmpPathInfo.isRelative() && origPathInfo.isRelative()) { |
|
624 // we keep the relative notation |
|
625 temporary.removeOne(tmpPath); |
|
626 temporary << origPath; |
|
627 } |
|
628 } |
|
629 } |
|
630 |
|
631 if(!bFound) |
|
632 temporary << origPath; |
|
633 |
|
634 } |
|
635 |
|
636 sysincspaths.clear(); |
|
637 sysincspaths << temporary; |
|
638 |
|
639 systeminclude.insert("SYSTEMINCLUDE", sysincspaths); |
|
640 |
|
641 return true; |
|
642 } |
|
643 |
|
644 bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList) { |
|
645 |
|
646 QStringList tmpStringList; |
|
647 |
|
648 for(int i = 0; i < stringList.size(); ++i) { |
|
649 QString string = stringList.at(i); |
|
650 if(tmpStringList.contains(string)) |
|
651 continue; |
|
652 else |
|
653 tmpStringList.append(string); |
|
654 } |
|
655 |
|
656 stringList.clear(); |
|
657 stringList = tmpStringList; |
|
658 return true; |
|
659 } |
|
660 |
|
661 bool SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t){ |
|
662 t << "// ==============================================================================" << endl; |
|
663 t << "// Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
664 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
665 t << "// This file is generated by qmake and should not be modified by the" << endl; |
|
666 t << "// user." << endl; |
|
667 t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length()-4,4))) << ".mmp" << endl; |
|
668 t << "// ==============================================================================" << endl << endl; |
|
669 |
|
670 return true; |
|
671 } |
|
672 |
|
673 bool SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) |
|
674 { |
|
675 QFile ft(filename); |
|
676 if(ft.open(QIODevice::WriteOnly)) { |
|
677 generatedFiles << ft.fileName(); |
|
678 |
|
679 //printf("WRITING: %s \n", qPrintable(filename)); |
|
680 |
|
681 QTextStream t(&ft); |
|
682 |
|
683 writeMmpFileHeader(t); |
|
684 |
|
685 writeMmpFileTargetPart(t); |
|
686 |
|
687 writeMmpFileResourcePart(t, symbianLangCodes); |
|
688 |
|
689 writeMmpFileMacrosPart(t); |
|
690 |
|
691 writeMmpFileIncludePart(t); |
|
692 |
|
693 QDir current = QDir::current(); |
|
694 |
|
695 for(QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { |
|
696 QStringList values = it.value(); |
|
697 QString currentSourcePath = it.key(); |
|
698 |
|
699 if (values.size()) |
|
700 t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, current) << endl; |
|
701 |
|
702 for (int i = 0; i < values.size(); ++i) { |
|
703 QString sourceFileName = values.at(i); |
|
704 t << "SOURCE\t\t" << sourceFileName << endl; |
|
705 } |
|
706 t << endl; |
|
707 } |
|
708 t << endl; |
|
709 |
|
710 writeMmpFileLibraryPart(t); |
|
711 |
|
712 writeMmpFileCapabilityPart(t); |
|
713 |
|
714 writeMmpFileCompilerOptionPart(t); |
|
715 |
|
716 writeMmpFileBinaryVersionPart(t); |
|
717 |
|
718 writeMmpFileRulesPart(t); |
|
719 } else { |
|
720 return false; |
|
721 } |
|
722 |
|
723 return true; |
|
724 } |
|
725 |
|
726 bool SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) { |
|
727 |
|
728 t << endl; |
|
729 |
|
730 if(isConfigSetToSymbian()) |
|
731 return true; |
|
732 |
|
733 QStringList &defines = project->values("DEFINES"); |
|
734 if (defines.size()) |
|
735 t << "// Qt Macros" << endl; |
|
736 for(int i = 0; i < defines.size(); ++i) { |
|
737 QString def = defines.at(i); |
|
738 addMacro(t, def); |
|
739 } |
|
740 |
|
741 // These are required in order that all methods will be correctly exported e.g from qtestlib |
|
742 QStringList &exp_defines = project->values("PRL_EXPORT_DEFINES"); |
|
743 if (exp_defines.size()) |
|
744 t << endl << "// Qt Export Defines" << endl; |
|
745 for(int i = 0; i < exp_defines.size(); ++i) { |
|
746 QString def = exp_defines.at(i); |
|
747 addMacro(t, def); |
|
748 } |
|
749 |
|
750 t << endl; |
|
751 |
|
752 return true; |
|
753 } |
|
754 |
|
755 bool SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) { |
|
756 t << "MACRO" << "\t\t" << value << endl; |
|
757 return true; |
|
758 } |
|
759 |
|
760 |
|
761 bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { |
|
762 QString targetTypeValue(""); |
|
763 if(getTargetExtension() == "exe") { |
|
764 t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << "\n"; |
|
765 if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) |
|
766 targetTypeValue = QString("STDEXE"); |
|
767 else |
|
768 targetTypeValue = QString("EXE"); |
|
769 } else if (getTargetExtension() == "dll"){ |
|
770 t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".dll")) << "\n"; |
|
771 if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) |
|
772 targetTypeValue = QString("STDDLL"); |
|
773 else |
|
774 targetTypeValue = QString("DLL"); |
|
775 } else if (getTargetExtension() == "lib"){ |
|
776 t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".lib")) << "\n"; |
|
777 if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) |
|
778 targetTypeValue = QString("STDLIB"); |
|
779 else |
|
780 targetTypeValue = QString("LIB"); |
|
781 } else { |
|
782 printf("unexpected target and targettype %s\n", getTargetExtension().toAscii().data()); |
|
783 } |
|
784 if (0 != project->values("TARGETTYPE_OVERRIDE").size()) { |
|
785 targetTypeValue = project->first("TARGETTYPE_OVERRIDE"); |
|
786 } |
|
787 |
|
788 t << "TARGETTYPE" << "\t\t" << targetTypeValue << endl; |
|
789 |
|
790 t << endl; |
|
791 |
|
792 t << "UID" << "\t\t" << uid2 << " " << uid3 << endl; |
|
793 |
|
794 if(0 != project->values("TARGET.SID").size()) { |
|
795 t << "SECUREID" << "\t\t" << project->values("TARGET.SID").join(" ") << endl; |
|
796 } else { |
|
797 if(0 == uid3.size()) |
|
798 t << "SECUREID" << "\t\t" << "0" << endl; |
|
799 else |
|
800 t << "SECUREID" << "\t\t" << uid3 << endl; |
|
801 } |
|
802 |
|
803 // default value used from mkspecs..qconfig.h is 0 |
|
804 if(0 != project->values("TARGET.VID").size()) { |
|
805 t << "VENDORID" << "\t\t" << project->values("TARGET.VID").join(" ") << endl; |
|
806 } |
|
807 |
|
808 t << endl; |
|
809 |
|
810 if(0 != project->first("TARGET.EPOCSTACKSIZE").size()) |
|
811 t << "EPOCSTACKSIZE" << "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; |
|
812 if(0 != project->values("TARGET.EPOCHEAPSIZE").size()) |
|
813 t << "EPOCHEAPSIZE" << "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; |
|
814 if(0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) |
|
815 t << "EPOCALLOWDLLDATA" << endl; |
|
816 |
|
817 if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { |
|
818 // use custom def file for Qt plugins |
|
819 t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; |
|
820 } |
|
821 |
|
822 t << endl; |
|
823 |
|
824 return true; |
|
825 } |
|
826 |
|
827 |
|
828 /* |
|
829 Application registration resource files |
|
830 should be installed to the |
|
831 |
|
832 \private\10003a3f\import\apps directory. |
|
833 */ |
|
834 bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) { |
|
835 if((getTargetExtension() == "exe") && |
|
836 !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { |
|
837 QString target = escapeFilePath(fileFixify(project->first("TARGET"))); |
|
838 target = removePathSeparators(target); |
|
839 |
|
840 QString locTarget = target; |
|
841 locTarget.append(".rss"); |
|
842 |
|
843 t << "SOURCEPATH\t\t\t. " << endl; |
|
844 t << "LANG SC "; // no endl |
|
845 foreach(QString lang, symbianLangCodes) { |
|
846 t << lang << " "; // no endl |
|
847 } |
|
848 t << endl; |
|
849 t << "START RESOURCE\t\t" << locTarget << endl; |
|
850 t << "HEADER" << endl; |
|
851 t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP<< endl; |
|
852 t << "END" << endl << endl; |
|
853 |
|
854 // now append extension |
|
855 QString regTarget = target; |
|
856 regTarget.append("_reg.rss"); |
|
857 // must state SOURCEPATH for resources |
|
858 // relative placement (relative to dir where .mmp located) |
|
859 // absolute placement (!RELATIVE! to EPOCROOT dir) |
|
860 |
|
861 |
|
862 t << "SOURCEPATH\t\t\t. " << endl; |
|
863 t << "START RESOURCE\t\t" << regTarget << endl; |
|
864 if (isForSymbianSbsv2()) |
|
865 t << "DEPENDS " << target << ".rsg" << endl; |
|
866 t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl; |
|
867 t << "END" << endl << endl; |
|
868 } |
|
869 return true; |
|
870 } |
|
871 |
|
872 bool SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) { |
|
873 |
|
874 QDir current = QDir::current(); |
|
875 |
|
876 for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { |
|
877 QStringList values = it.value(); |
|
878 for (int i = 0; i < values.size(); ++i) { |
|
879 QString handledPath = values.at(i); |
|
880 t << "SYSTEMINCLUDE" << "\t\t" << fixPathForMmp(handledPath, current) << endl; |
|
881 } |
|
882 } |
|
883 |
|
884 t << endl; |
|
885 |
|
886 return true; |
|
887 } |
|
888 |
|
889 bool SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) { |
|
890 |
|
891 writeMmpFileSystemIncludePart(t); |
|
892 |
|
893 return true; |
|
894 } |
|
895 |
|
896 bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) { |
|
897 QStringList &libs = project->values("LIBS"); |
|
898 libs << project->values("QMAKE_LIBS"); |
|
899 |
|
900 removeDuplicatedStrings(libs); |
|
901 |
|
902 for(int i = 0; i < libs.size(); ++i) { |
|
903 QString lib = libs.at(i); |
|
904 // The -L flag is uninteresting, since all symbian libraries exist in the |
|
905 // same directory. |
|
906 if(lib.startsWith("-l")) { |
|
907 lib.remove(0,2); |
|
908 QString mmpStatement; |
|
909 if (lib.endsWith(".dll")) { |
|
910 lib.chop(4); |
|
911 mmpStatement = "LIBRARY\t\t"; |
|
912 } else if (lib.endsWith(".lib")) { |
|
913 lib.chop(4); |
|
914 mmpStatement = "STATICLIBRARY\t"; |
|
915 } else { |
|
916 // Hacky way to find out what kind of library it is. Check the |
|
917 // ARMV5 build directory for library type. We default to shared |
|
918 // library, since that is probably more common. |
|
919 QString udebStaticLibLocation(epocRoot()); |
|
920 QString urelStaticLibLocation(udebStaticLibLocation); |
|
921 udebStaticLibLocation += QString("epoc32/release/armv5/udeb/%1.lib").arg(lib); |
|
922 urelStaticLibLocation += QString("epoc32/release/armv5/urel/%1.lib").arg(lib); |
|
923 if (QFile::exists(udebStaticLibLocation) || QFile::exists(urelStaticLibLocation)) { |
|
924 mmpStatement = "STATICLIBRARY\t"; |
|
925 } else { |
|
926 mmpStatement = "LIBRARY\t\t"; |
|
927 } |
|
928 } |
|
929 t << mmpStatement << lib << ".lib" << endl; |
|
930 } |
|
931 } |
|
932 |
|
933 t << endl; |
|
934 |
|
935 return true; |
|
936 } |
|
937 |
|
938 bool SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) { |
|
939 if(0 != project->first("TARGET.CAPABILITY").size()) { |
|
940 QStringList &capabilities = project->values("TARGET.CAPABILITY"); |
|
941 t << "CAPABILITY" << "\t\t"; |
|
942 |
|
943 for(int i = 0; i < capabilities.size(); ++i) { |
|
944 QString cap = capabilities.at(i); |
|
945 t << cap << " "; |
|
946 } |
|
947 } |
|
948 else { |
|
949 t << "CAPABILITY" << "\t\t" << "None"; |
|
950 } |
|
951 t << endl << endl; |
|
952 |
|
953 return true; |
|
954 } |
|
955 |
|
956 bool SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) { |
|
957 QString cw, armcc; |
|
958 |
|
959 if(0 != project->values("QMAKE_CXXFLAGS.CW").size()) { |
|
960 cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" ")); |
|
961 cw.append(" "); |
|
962 } |
|
963 |
|
964 if(0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) { |
|
965 armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" ")); |
|
966 armcc.append(" "); |
|
967 } |
|
968 |
|
969 if(0 != project->values("QMAKE_CFLAGS.CW").size()) { |
|
970 cw.append(project->values("QMAKE_CFLAGS.CW").join(" ")); |
|
971 cw.append(" "); |
|
972 } |
|
973 |
|
974 if(0 != project->values("QMAKE_CFLAGS.ARMCC").size()) { |
|
975 armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" ")); |
|
976 armcc.append(" "); |
|
977 } |
|
978 |
|
979 if(0 != project->values("QMAKE_CXXFLAGS").size()) { |
|
980 cw.append(project->values("QMAKE_CXXFLAGS").join(" ")); |
|
981 cw.append(" "); |
|
982 armcc.append(project->values("QMAKE_CXXFLAGS").join(" ")); |
|
983 armcc.append(" "); |
|
984 } |
|
985 |
|
986 if(0 != project->values("QMAKE_CFLAGS").size()) { |
|
987 cw.append(project->values("QMAKE_CFLAGS").join(" ")); |
|
988 cw.append(" "); |
|
989 armcc.append(project->values("QMAKE_CFLAGS").join(" ")); |
|
990 armcc.append(" "); |
|
991 } |
|
992 |
|
993 if (!cw.isEmpty() && cw[cw.size()-1] == ' ') |
|
994 cw.chop(1); |
|
995 if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ') |
|
996 armcc.chop(1); |
|
997 |
|
998 if (!cw.isEmpty()) |
|
999 t << "OPTION" << '\t' << " CW " << cw << endl; |
|
1000 if (!armcc.isEmpty()) |
|
1001 t << "OPTION" << '\t' << " ARMCC "<< armcc << endl; |
|
1002 // others to come |
|
1003 |
|
1004 t << endl; |
|
1005 return true; |
|
1006 } |
|
1007 |
|
1008 bool SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) { |
|
1009 QString applicationVersion = project->first("VERSION"); |
|
1010 QStringList verNumList = applicationVersion.split('.'); |
|
1011 uint major = 0; |
|
1012 uint minor = 0; |
|
1013 uint patch = 0; |
|
1014 bool success = false; |
|
1015 |
|
1016 if (verNumList.size() > 0) { |
|
1017 major = verNumList[0].toUInt(&success); |
|
1018 if (success && verNumList.size() > 1) { |
|
1019 minor = verNumList[1].toUInt(&success); |
|
1020 if (success && verNumList.size() > 2) { |
|
1021 patch = verNumList[2].toUInt(&success); |
|
1022 } |
|
1023 } |
|
1024 } |
|
1025 |
|
1026 QString mmpVersion; |
|
1027 if (success && major <= 0xFFFF && minor <= 0xFF && patch <= 0xFF) { |
|
1028 // Symbian binary version only has major and minor components, so compress |
|
1029 // Qt's minor and patch values into the minor component. Since Symbian's minor |
|
1030 // component is a 16 bit value, only allow 8 bits for each to avoid overflow. |
|
1031 mmpVersion.append(QString::number(major)) |
|
1032 .append('.') |
|
1033 .append(QString::number((minor << 8) + patch)); |
|
1034 } else { |
|
1035 if (!applicationVersion.isEmpty()) |
|
1036 fprintf(stderr, "Invalid VERSION string: %s\n", qPrintable(applicationVersion)); |
|
1037 mmpVersion = "10.0"; // Default binary version for symbian is 10.0 |
|
1038 } |
|
1039 |
|
1040 t << "VERSION " << mmpVersion << endl; |
|
1041 |
|
1042 return true; |
|
1043 } |
|
1044 |
|
1045 bool SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) { |
|
1046 foreach(QString item, project->values("MMP_RULES")) { |
|
1047 t << endl; |
|
1048 // If there is no stringlist defined for a rule, use rule name directly |
|
1049 // This is convenience for defining single line mmp statements |
|
1050 if (project->values(item).isEmpty()) { |
|
1051 t << item << endl; |
|
1052 } else { |
|
1053 foreach(QString itemRow, project->values(item)) { |
|
1054 t << itemRow << endl; |
|
1055 } |
|
1056 } |
|
1057 } |
|
1058 return true; |
|
1059 } |
|
1060 |
|
1061 bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) { |
|
1062 // Read user defined bld inf rules |
|
1063 QMap<QString, QStringList> userBldInfRules; |
|
1064 for(QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { |
|
1065 if (it.key().startsWith(BLD_INF_RULES_BASE)) { |
|
1066 QString newKey = it.key().mid(sizeof(BLD_INF_RULES_BASE)-1); |
|
1067 if (newKey.isEmpty()) { |
|
1068 fprintf(stderr, "Warning: Empty BLD_INF_RULES key encountered\n"); |
|
1069 continue; |
|
1070 } |
|
1071 QStringList newValues; |
|
1072 QStringList values = it.value(); |
|
1073 foreach(QString item, values) { |
|
1074 // If there is no stringlist defined for a rule, use rule name directly |
|
1075 // This is convenience for defining single line statements |
|
1076 if (project->values(item).isEmpty()) { |
|
1077 newValues << item; |
|
1078 } else { |
|
1079 foreach(QString itemRow, project->values(item)) { |
|
1080 newValues << itemRow; |
|
1081 } |
|
1082 } |
|
1083 } |
|
1084 userBldInfRules.insert(newKey, newValues); |
|
1085 } |
|
1086 } |
|
1087 |
|
1088 // Add includes of subdirs bld.inf files |
|
1089 |
|
1090 QString mmpfilename = escapeFilePath(fileFixify(project->projectFile())); |
|
1091 mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf(".")+1, 3, "mmp"); |
|
1092 QString currentPath = qmake_getpwd(); |
|
1093 |
|
1094 if(!currentPath.endsWith(QString("/"))) |
|
1095 currentPath.append("/"); |
|
1096 |
|
1097 QStringList mmpProjects = project->values("MMPFILES_DIRECT_DEPENDS"); |
|
1098 QStringList shadowProjects = project->values("SHADOW_BLD_INFS"); |
|
1099 |
|
1100 removeDuplicatedStrings(mmpProjects); |
|
1101 removeDuplicatedStrings(shadowProjects); |
|
1102 |
|
1103 // go in reverse order ... as that is the way how I build the list |
|
1104 QListIterator<QString> iT(mmpProjects); |
|
1105 iT.toBack(); |
|
1106 while(iT.hasPrevious()) { |
|
1107 QString fullMmpName = iT.previous(); |
|
1108 QString relativePath; |
|
1109 QString bldinfFilename; |
|
1110 |
|
1111 QString fullProFilename = fullMmpName; |
|
1112 fullProFilename.replace(QString(".mmp"), QString(".pro")); |
|
1113 QString uid = generate_uid(fullProFilename); |
|
1114 |
|
1115 QString cleanMmpName = fullProFilename; |
|
1116 cleanMmpName.replace(QString(".pro"), QString("")); |
|
1117 cleanMmpName.replace(0, cleanMmpName.lastIndexOf("/") + 1, QString("")); |
|
1118 |
|
1119 if(shadowProjects.contains(BLD_INF_FILENAME "." + cleanMmpName)) { // shadow project |
|
1120 QDir directory(currentPath); |
|
1121 relativePath = directory.relativeFilePath(fullProFilename); |
|
1122 bldinfFilename = BLD_INF_FILENAME "." + cleanMmpName; |
|
1123 if(relativePath.contains("/")) { |
|
1124 // shadow .pro not in same |
|
1125 // directory as parent .pro |
|
1126 if(relativePath.startsWith("..")) { |
|
1127 // shadow .pro out of parent .pro |
|
1128 relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); |
|
1129 bldinfFilename.prepend("/").prepend(relativePath); |
|
1130 } else { |
|
1131 relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); |
|
1132 bldinfFilename.prepend("/").prepend(relativePath); |
|
1133 } |
|
1134 } else { |
|
1135 // shadow .pro and parent .pro in same directory |
|
1136 bldinfFilename.prepend("./"); |
|
1137 } |
|
1138 } else { // regular project |
|
1139 // calc relative path |
|
1140 QDir directory(currentPath); |
|
1141 relativePath = directory.relativeFilePath(fullProFilename); |
|
1142 relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); |
|
1143 bldinfFilename = relativePath.append("/").append(BLD_INF_FILENAME); |
|
1144 } |
|
1145 |
|
1146 QString bldinfDefine = QString("BLD_INF_") + cleanMmpName + QString("_") + uid; |
|
1147 bldinfDefine = bldinfDefine.toUpper(); |
|
1148 removeSpecialCharacters(bldinfDefine); |
|
1149 |
|
1150 t << "#ifndef " << bldinfDefine << endl; |
|
1151 t << "\t#include \"" << QDir::toNativeSeparators(bldinfFilename) << "\"" << endl; |
|
1152 t << "#endif // " << bldinfDefine << endl; |
|
1153 } |
|
1154 |
|
1155 // Add supported project platforms |
|
1156 |
|
1157 t << endl << BLD_INF_TAG_PLATFORMS << endl << endl; |
|
1158 if(0 != project->values("SYMBIAN_PLATFORMS").size()) |
|
1159 t << project->values("SYMBIAN_PLATFORMS").join(" ") << endl; |
|
1160 |
|
1161 QStringList userItems = userBldInfRules.value(BLD_INF_TAG_PLATFORMS); |
|
1162 foreach(QString item, userItems) |
|
1163 t << item << endl; |
|
1164 userBldInfRules.remove(BLD_INF_TAG_PLATFORMS); |
|
1165 t << endl; |
|
1166 |
|
1167 // Add project mmps and old style extension makefiles |
|
1168 QString mmpTag; |
|
1169 if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) |
|
1170 mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); |
|
1171 else |
|
1172 mmpTag = QLatin1String(BLD_INF_TAG_MMPFILES); |
|
1173 |
|
1174 t << endl << mmpTag << endl << endl; |
|
1175 |
|
1176 writeBldInfMkFilePart(t, addDeploymentExtension); |
|
1177 if (getTargetExtension() == "subdirs") { |
|
1178 mmpProjects.removeOne(mmpfilename); |
|
1179 } |
|
1180 |
|
1181 if(getTargetExtension() != "subdirs") { |
|
1182 QString shortProFilename = project->projectFile(); |
|
1183 shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); |
|
1184 shortProFilename.replace(QString(".pro"), QString("")); |
|
1185 |
|
1186 QString mmpFilename = shortProFilename + QString("_") + uid3 + QString(".mmp"); |
|
1187 |
|
1188 t << mmpFilename << endl; |
|
1189 } |
|
1190 |
|
1191 userItems = userBldInfRules.value(mmpTag); |
|
1192 foreach(QString item, userItems) |
|
1193 t << item << endl; |
|
1194 userBldInfRules.remove(mmpTag); |
|
1195 |
|
1196 t << endl << BLD_INF_TAG_EXTENSIONS << endl << endl; |
|
1197 |
|
1198 // Generate extension rules |
|
1199 writeBldInfExtensionRulesPart(t); |
|
1200 |
|
1201 userItems = userBldInfRules.value(BLD_INF_TAG_EXTENSIONS); |
|
1202 foreach(QString item, userItems) |
|
1203 t << item << endl; |
|
1204 userBldInfRules.remove(BLD_INF_TAG_EXTENSIONS); |
|
1205 |
|
1206 // Add rest of the user defined content |
|
1207 |
|
1208 for(QMap<QString, QStringList>::iterator it = userBldInfRules.begin(); it != userBldInfRules.end(); ++it) { |
|
1209 t << endl << endl << it.key() << endl << endl; |
|
1210 userItems = it.value(); |
|
1211 foreach(QString item, userItems) |
|
1212 t << item << endl; |
|
1213 } |
|
1214 |
|
1215 return true; |
|
1216 } |
|
1217 |
|
1218 bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &userItems) { |
|
1219 QString filename(appName); |
|
1220 filename.append("_reg.rss"); |
|
1221 QFile ft(filename); |
|
1222 if(ft.open(QIODevice::WriteOnly)) { |
|
1223 generatedFiles << ft.fileName(); |
|
1224 QTextStream t(&ft); |
|
1225 t << "// ============================================================================" << endl; |
|
1226 t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
1227 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
1228 t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
1229 t << "// * user." << endl; |
|
1230 t << "// ============================================================================" << endl; |
|
1231 t << endl; |
|
1232 t << "#include <" << appName << ".rsg>" << endl; |
|
1233 t << "#include <appinfo.rh>" << endl; |
|
1234 t << endl; |
|
1235 //t << "#include <data_caging_paths.hrh>" << "\n" << endl; |
|
1236 t << "UID2 " << "KUidAppRegistrationResourceFile" << endl; |
|
1237 t << "UID3 " << uid3 << endl << endl; |
|
1238 t << "RESOURCE APP_REGISTRATION_INFO" << endl; |
|
1239 t << "\t{" << endl; |
|
1240 t << "\tapp_file=\"" << appName << "\";" << endl; |
|
1241 t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << appName << "\";" << endl; |
|
1242 t << endl; |
|
1243 |
|
1244 foreach(QString item, userItems) |
|
1245 t << "\t" << item << endl; |
|
1246 t << "\t}" << endl; |
|
1247 } else { |
|
1248 return false; |
|
1249 } |
|
1250 return true; |
|
1251 } |
|
1252 |
|
1253 bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfIcons, QString &iconFile) { |
|
1254 QString filename(appName); |
|
1255 filename.append(".rss"); |
|
1256 QFile ft(filename); |
|
1257 if(ft.open(QIODevice::WriteOnly)) { |
|
1258 generatedFiles << ft.fileName(); |
|
1259 QTextStream t(&ft); |
|
1260 t << "// ============================================================================" << endl; |
|
1261 t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
1262 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
1263 t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
1264 t << "// * user." << endl; |
|
1265 t << "// ============================================================================" << endl; |
|
1266 t << endl; |
|
1267 t << "#include <appinfo.rh>" << endl; |
|
1268 t << "#include \"" << appName << ".loc\"" << endl; |
|
1269 t << endl; |
|
1270 t << "RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info" << endl; |
|
1271 t << "\t{" << endl; |
|
1272 t << "\tshort_caption = STRING_r_short_caption;" << endl; |
|
1273 t << "\tcaption_and_icon =" << endl; |
|
1274 t << "\tCAPTION_AND_ICON_INFO" << endl; |
|
1275 t << "\t\t{" << endl; |
|
1276 t << "\t\tcaption = STRING_r_caption;" << endl; |
|
1277 |
|
1278 if(numberOfIcons.isEmpty() || iconFile.isEmpty() ) { |
|
1279 // There can be maximum one item in this tag, validated when parsed |
|
1280 t << "\t\tnumber_of_icons = 0;" << endl; |
|
1281 t << "\t\ticon_file = \"\";" << endl; |
|
1282 } |
|
1283 else { |
|
1284 // There can be maximum one item in this tag, validated when parsed |
|
1285 t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl; |
|
1286 t << "\t\ticon_file = \"" << iconFile << "\";" << endl; |
|
1287 } |
|
1288 t << "\t\t};" << endl; |
|
1289 t << "\t}" << endl; |
|
1290 t << endl; |
|
1291 } else { |
|
1292 return false; |
|
1293 } |
|
1294 return true; |
|
1295 } |
|
1296 |
|
1297 bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbianLangCodes) { |
|
1298 QString filename(appName); |
|
1299 filename.append(".loc"); |
|
1300 QFile ft(filename); |
|
1301 if(ft.open(QIODevice::WriteOnly)) { |
|
1302 generatedFiles << ft.fileName(); |
|
1303 QTextStream t(&ft); |
|
1304 t << "// ============================================================================" << endl; |
|
1305 t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
|
1306 t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; |
|
1307 t << "// * This file is generated by qmake and should not be modified by the" << endl; |
|
1308 t << "// * user." << endl; |
|
1309 t << "// ============================================================================" << endl; |
|
1310 t << endl; |
|
1311 t << "#ifdef LANGUAGE_SC" << endl; |
|
1312 //t << "#include \"" << appName << ".l01\"" << endl; |
|
1313 t << "#define STRING_r_short_caption \"" << appName << "\"" << endl; |
|
1314 t << "#define STRING_r_caption \"" << appName << "\"" << endl; |
|
1315 foreach(QString lang, symbianLangCodes) { |
|
1316 t << "#elif defined LANGUAGE_" << lang << endl; |
|
1317 //t << "#include \"" << appName << ".l" << lang << "\"" << endl; |
|
1318 t << "#define STRING_r_short_caption \"" << appName << "\"" << endl; |
|
1319 t << "#define STRING_r_caption \"" << appName << "\"" << endl; |
|
1320 } |
|
1321 t << "#else" << endl; |
|
1322 t << "#define STRING_r_short_caption \"" << appName << "\"" << endl; |
|
1323 t << "#define STRING_r_caption \"" << appName << "\"" << endl; |
|
1324 t << "#endif" << endl; |
|
1325 } else { |
|
1326 return false; |
|
1327 } |
|
1328 return true; |
|
1329 } |
|
1330 |
|
1331 void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) { |
|
1332 for(QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { |
|
1333 if (it.key().startsWith(RSS_RULES_BASE)) { |
|
1334 QString newKey = it.key().mid(sizeof(RSS_RULES_BASE)-1); |
|
1335 if (newKey.isEmpty()) { |
|
1336 fprintf(stderr, "Warning: Empty RSS_RULES_BASE key encountered\n"); |
|
1337 continue; |
|
1338 } |
|
1339 QStringList newValues; |
|
1340 QStringList values = it.value(); |
|
1341 foreach(QString item, values) { |
|
1342 // If there is no stringlist defined for a rule, use rule name directly |
|
1343 // This is convenience for defining single line statements |
|
1344 if (project->values(item).isEmpty()) { |
|
1345 newValues << item; |
|
1346 } else { |
|
1347 foreach(QString itemRow, project->values(item)) { |
|
1348 newValues << itemRow; |
|
1349 } |
|
1350 } |
|
1351 } |
|
1352 // Verify thet there is exactly one value in RSS_TAG_NBROFICONS |
|
1353 if (newKey == RSS_TAG_NBROFICONS) { |
|
1354 if (newValues.count() == 1) { |
|
1355 numberOfIcons = newValues[0]; |
|
1356 } else { |
|
1357 fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", |
|
1358 RSS_RULES_BASE, RSS_TAG_NBROFICONS); |
|
1359 continue; |
|
1360 } |
|
1361 // Verify thet there is exactly one value in RSS_TAG_ICONFILE |
|
1362 } else if (newKey == RSS_TAG_ICONFILE) { |
|
1363 if (newValues.count() == 1) { |
|
1364 iconFile = newValues[0]; |
|
1365 } else { |
|
1366 fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", |
|
1367 RSS_RULES_BASE, RSS_TAG_ICONFILE); |
|
1368 continue; |
|
1369 } |
|
1370 } else { |
|
1371 fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", |
|
1372 RSS_RULES_BASE, newKey.toLatin1().constData()); |
|
1373 continue; |
|
1374 } |
|
1375 } |
|
1376 } |
|
1377 |
|
1378 foreach(QString item, project->values(RSS_RULES)) { |
|
1379 // If there is no stringlist defined for a rule, use rule name directly |
|
1380 // This is convenience for defining single line mmp statements |
|
1381 if (project->values(item).isEmpty()) { |
|
1382 userRssRules << item; |
|
1383 } else { |
|
1384 userRssRules << project->values(item); |
|
1385 } |
|
1386 } |
|
1387 |
|
1388 // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist |
|
1389 // or neither of them exist |
|
1390 if ( !((numberOfIcons.isEmpty() && iconFile.isEmpty()) || |
|
1391 (!numberOfIcons.isEmpty() && !iconFile.isEmpty())) ) { |
|
1392 numberOfIcons.clear(); |
|
1393 iconFile.clear(); |
|
1394 fprintf(stderr, "Warning: Both or neither of '%s%s' and '%s%s' keys must exist.\n", |
|
1395 RSS_RULES_BASE, RSS_TAG_NBROFICONS, RSS_RULES_BASE, RSS_TAG_ICONFILE ); |
|
1396 } |
|
1397 |
|
1398 // Validate that RSS_TAG_NBROFICONS contains only numbers |
|
1399 if( !numberOfIcons.isEmpty() ) { |
|
1400 bool ok; |
|
1401 numberOfIcons = numberOfIcons.simplified(); |
|
1402 int tmp = numberOfIcons.toInt(&ok); |
|
1403 if (!ok) { |
|
1404 numberOfIcons.clear(); |
|
1405 iconFile.clear(); |
|
1406 fprintf(stderr, "Warning: '%s%s' must be integer in decimal format.\n", |
|
1407 RSS_RULES_BASE, RSS_TAG_NBROFICONS ); |
|
1408 } |
|
1409 } |
|
1410 } |
|
1411 |
|
1412 QStringList SymbianMakefileGenerator::symbianLangCodesFromTsFiles() { |
|
1413 QStringList tsfiles; |
|
1414 QStringList symbianLangCodes; |
|
1415 tsfiles << project->values("TRANSLATIONS"); |
|
1416 |
|
1417 fillQt2S60LangMapTable(); |
|
1418 |
|
1419 foreach(QString file, tsfiles) { |
|
1420 int extIndex = file.lastIndexOf("."); |
|
1421 int langIndex = file.lastIndexOf("_", (extIndex - file.length())); |
|
1422 langIndex += 1; |
|
1423 QString qtlang = file.mid(langIndex, extIndex - langIndex ); |
|
1424 QString s60lang = qt2S60LangMapTable.value(qtlang, QString("SC")); |
|
1425 |
|
1426 if( !symbianLangCodes.contains(s60lang) && s60lang != "SC" ) |
|
1427 symbianLangCodes += s60lang; |
|
1428 } |
|
1429 |
|
1430 return symbianLangCodes; |
|
1431 } |
|
1432 |
|
1433 void SymbianMakefileGenerator::fillQt2S60LangMapTable() { |
|
1434 qt2S60LangMapTable.reserve(170); // 165 items at time of writing. |
|
1435 qt2S60LangMapTable.insert("ab", "SC"); //Abkhazian // |
|
1436 qt2S60LangMapTable.insert("om", "SC"); //Afan // |
|
1437 qt2S60LangMapTable.insert("aa", "SC"); //Afar // |
|
1438 qt2S60LangMapTable.insert("af", "34"); //Afrikaans //Afrikaans |
|
1439 qt2S60LangMapTable.insert("sq", "35"); //Albanian //Albanian |
|
1440 qt2S60LangMapTable.insert("am", "36"); //Amharic //Amharic |
|
1441 qt2S60LangMapTable.insert("ar", "37"); //Arabic //Arabic |
|
1442 qt2S60LangMapTable.insert("hy", "38"); //Armenian //Armenian |
|
1443 qt2S60LangMapTable.insert("as", "SC"); //Assamese // |
|
1444 qt2S60LangMapTable.insert("ay", "SC"); //Aymara // |
|
1445 qt2S60LangMapTable.insert("az", "SC"); //Azerbaijani // |
|
1446 qt2S60LangMapTable.insert("ba", "SC"); //Bashkir // |
|
1447 qt2S60LangMapTable.insert("eu", "SC"); //Basque // |
|
1448 qt2S60LangMapTable.insert("bn", "41"); //Bengali //Bengali |
|
1449 qt2S60LangMapTable.insert("dz", "SC"); //Bhutani // |
|
1450 qt2S60LangMapTable.insert("bh", "SC"); //Bihari // |
|
1451 qt2S60LangMapTable.insert("bi", "SC"); //Bislama // |
|
1452 qt2S60LangMapTable.insert("br", "SC"); //Breton // |
|
1453 qt2S60LangMapTable.insert("bg", "42"); //Bulgarian //Bulgarian |
|
1454 qt2S60LangMapTable.insert("my", "43"); //Burmese //Burmese |
|
1455 qt2S60LangMapTable.insert("be", "40"); //Byelorussian //Belarussian |
|
1456 qt2S60LangMapTable.insert("km", "SC"); //Cambodian // |
|
1457 qt2S60LangMapTable.insert("ca", "44"); //Catalan //Catalan |
|
1458 qt2S60LangMapTable.insert("zh", "SC"); //Chinese // |
|
1459 qt2S60LangMapTable.insert("co", "SC"); //Corsican // |
|
1460 qt2S60LangMapTable.insert("hr", "45"); //Croatian //Croatian |
|
1461 qt2S60LangMapTable.insert("cs", "25"); //Czech //Czech |
|
1462 qt2S60LangMapTable.insert("da", "07"); //Danish //Danish |
|
1463 qt2S60LangMapTable.insert("nl", "18"); //Dutch //Dutch |
|
1464 qt2S60LangMapTable.insert("en", "01"); //English //English(UK) |
|
1465 qt2S60LangMapTable.insert("eo", "SC"); //Esperanto // |
|
1466 qt2S60LangMapTable.insert("et", "49"); //Estonian //Estonian |
|
1467 qt2S60LangMapTable.insert("fo", "SC"); //Faroese // |
|
1468 qt2S60LangMapTable.insert("fj", "SC"); //Fiji // |
|
1469 qt2S60LangMapTable.insert("fi", "09"); //Finnish //Finnish |
|
1470 qt2S60LangMapTable.insert("fr", "02"); //French //French |
|
1471 qt2S60LangMapTable.insert("fy", "SC"); //Frisian // |
|
1472 qt2S60LangMapTable.insert("gd", "52"); //Gaelic //Gaelic |
|
1473 qt2S60LangMapTable.insert("gl", "SC"); //Galician // |
|
1474 qt2S60LangMapTable.insert("ka", "53"); //Georgian //Georgian |
|
1475 qt2S60LangMapTable.insert("de", "03"); //German //German |
|
1476 qt2S60LangMapTable.insert("el", "54"); //Greek //Greek |
|
1477 qt2S60LangMapTable.insert("kl", "SC"); //Greenlandic // |
|
1478 qt2S60LangMapTable.insert("gn", "SC"); //Guarani // |
|
1479 qt2S60LangMapTable.insert("gu", "56"); //Gujarati //Gujarati |
|
1480 qt2S60LangMapTable.insert("ha", "SC"); //Hausa // |
|
1481 qt2S60LangMapTable.insert("he", "57"); //Hebrew //Hebrew |
|
1482 qt2S60LangMapTable.insert("hi", "58"); //Hindi //Hindi |
|
1483 qt2S60LangMapTable.insert("hu", "17"); //Hungarian //Hungarian |
|
1484 qt2S60LangMapTable.insert("is", "15"); //Icelandic //Icelandic |
|
1485 qt2S60LangMapTable.insert("id", "59"); //Indonesian //Indonesian |
|
1486 qt2S60LangMapTable.insert("ia", "SC"); //Interlingua // |
|
1487 qt2S60LangMapTable.insert("ie", "SC"); //Interlingue // |
|
1488 qt2S60LangMapTable.insert("iu", "SC"); //Inuktitut // |
|
1489 qt2S60LangMapTable.insert("ik", "SC"); //Inupiak // |
|
1490 qt2S60LangMapTable.insert("ga", "60"); //Irish //Irish |
|
1491 qt2S60LangMapTable.insert("it", "05"); //Italian //Italian |
|
1492 qt2S60LangMapTable.insert("ja", "32"); //Japanese //Japanese |
|
1493 qt2S60LangMapTable.insert("jv", "SC"); //Javanese // |
|
1494 qt2S60LangMapTable.insert("kn", "62"); //Kannada //Kannada |
|
1495 qt2S60LangMapTable.insert("ks", "SC"); //Kashmiri // |
|
1496 qt2S60LangMapTable.insert("kk", "63"); //Kazakh //Kazakh |
|
1497 qt2S60LangMapTable.insert("rw", "SC"); //Kinyarwanda // |
|
1498 qt2S60LangMapTable.insert("ky", "SC"); //Kirghiz // |
|
1499 qt2S60LangMapTable.insert("ko", "65"); //Korean //Korean |
|
1500 qt2S60LangMapTable.insert("ku", "SC"); //Kurdish // |
|
1501 qt2S60LangMapTable.insert("rn", "SC"); //Kurundi // |
|
1502 qt2S60LangMapTable.insert("lo", "66"); //Laothian //Laothian |
|
1503 qt2S60LangMapTable.insert("la", "SC"); //Latin // |
|
1504 qt2S60LangMapTable.insert("lv", "67"); //Latvian //Latvian |
|
1505 qt2S60LangMapTable.insert("ln", "SC"); //Lingala // |
|
1506 qt2S60LangMapTable.insert("lt", "68"); //Lithuanian //Lithuanian |
|
1507 qt2S60LangMapTable.insert("mk", "69"); //Macedonian //Macedonian |
|
1508 qt2S60LangMapTable.insert("mg", "SC"); //Malagasy // |
|
1509 qt2S60LangMapTable.insert("ms", "70"); //Malay //Malay |
|
1510 qt2S60LangMapTable.insert("ml", "71"); //Malayalam //Malayalam |
|
1511 qt2S60LangMapTable.insert("mt", "SC"); //Maltese // |
|
1512 qt2S60LangMapTable.insert("mi", "SC"); //Maori // |
|
1513 qt2S60LangMapTable.insert("mr", "72"); //Marathi //Marathi |
|
1514 qt2S60LangMapTable.insert("mo", "73"); //Moldavian //Moldovian |
|
1515 qt2S60LangMapTable.insert("mn", "74"); //Mongolian //Mongolian |
|
1516 qt2S60LangMapTable.insert("na", "SC"); //Nauru // |
|
1517 qt2S60LangMapTable.insert("ne", "SC"); //Nepali // |
|
1518 qt2S60LangMapTable.insert("nb", "08"); //Norwegian //Norwegian |
|
1519 qt2S60LangMapTable.insert("oc", "SC"); //Occitan // |
|
1520 qt2S60LangMapTable.insert("or", "SC"); //Oriya // |
|
1521 qt2S60LangMapTable.insert("ps", "SC"); //Pashto // |
|
1522 qt2S60LangMapTable.insert("fa", "SC"); //Persian // |
|
1523 qt2S60LangMapTable.insert("pl", "27"); //Polish //Polish |
|
1524 qt2S60LangMapTable.insert("pt", "13"); //Portuguese //Portuguese |
|
1525 qt2S60LangMapTable.insert("pa", "77"); //Punjabi //Punjabi |
|
1526 qt2S60LangMapTable.insert("qu", "SC"); //Quechua // |
|
1527 qt2S60LangMapTable.insert("rm", "SC"); //RhaetoRomance // |
|
1528 qt2S60LangMapTable.insert("ro", "78"); //Romanian //Romanian |
|
1529 qt2S60LangMapTable.insert("ru", "16"); //Russian //Russian |
|
1530 qt2S60LangMapTable.insert("sm", "SC"); //Samoan // |
|
1531 qt2S60LangMapTable.insert("sg", "SC"); //Sangho // |
|
1532 qt2S60LangMapTable.insert("sa", "SC"); //Sanskrit // |
|
1533 qt2S60LangMapTable.insert("sr", "79"); //Serbian //Serbian |
|
1534 qt2S60LangMapTable.insert("sh", "SC"); //SerboCroatian // |
|
1535 qt2S60LangMapTable.insert("st", "SC"); //Sesotho // |
|
1536 qt2S60LangMapTable.insert("tn", "SC"); //Setswana // |
|
1537 qt2S60LangMapTable.insert("sn", "SC"); //Shona // |
|
1538 qt2S60LangMapTable.insert("sd", "SC"); //Sindhi // |
|
1539 qt2S60LangMapTable.insert("si", "80"); //Singhalese //Sinhalese |
|
1540 qt2S60LangMapTable.insert("ss", "SC"); //Siswati // |
|
1541 qt2S60LangMapTable.insert("sk", "26"); //Slovak //Slovak |
|
1542 qt2S60LangMapTable.insert("sl", "28"); //Slovenian //Slovenian |
|
1543 qt2S60LangMapTable.insert("so", "81"); //Somali //Somali |
|
1544 qt2S60LangMapTable.insert("es", "04"); //Spanish //Spanish |
|
1545 qt2S60LangMapTable.insert("su", "SC"); //Sundanese // |
|
1546 qt2S60LangMapTable.insert("sw", "84"); //Swahili //Swahili |
|
1547 qt2S60LangMapTable.insert("sv", "06"); //Swedish //Swedish |
|
1548 qt2S60LangMapTable.insert("tl", "39"); //Tagalog //Tagalog |
|
1549 qt2S60LangMapTable.insert("tg", "SC"); //Tajik // |
|
1550 qt2S60LangMapTable.insert("ta", "87"); //Tamil //Tamil |
|
1551 qt2S60LangMapTable.insert("tt", "SC"); //Tatar // |
|
1552 qt2S60LangMapTable.insert("te", "88"); //Telugu //Telugu |
|
1553 qt2S60LangMapTable.insert("th", "33"); //Thai //Thai |
|
1554 qt2S60LangMapTable.insert("bo", "89"); //Tibetan //Tibetan |
|
1555 qt2S60LangMapTable.insert("ti", "90"); //Tigrinya //Tigrinya |
|
1556 qt2S60LangMapTable.insert("to", "SC"); //Tonga // |
|
1557 qt2S60LangMapTable.insert("ts", "SC"); //Tsonga // |
|
1558 qt2S60LangMapTable.insert("tr", "14"); //Turkish //Turkish |
|
1559 qt2S60LangMapTable.insert("tk", "92"); //Turkmen //Turkmen |
|
1560 qt2S60LangMapTable.insert("tw", "SC"); //Twi // |
|
1561 qt2S60LangMapTable.insert("ug", "SC"); //Uigur // |
|
1562 qt2S60LangMapTable.insert("uk", "93"); //Ukrainian //Ukrainian |
|
1563 qt2S60LangMapTable.insert("ur", "94"); //Urdu //Urdu |
|
1564 qt2S60LangMapTable.insert("uz", "SC"); //Uzbek // |
|
1565 qt2S60LangMapTable.insert("vi", "96"); //Vietnamese //Vietnamese |
|
1566 qt2S60LangMapTable.insert("vo", "SC"); //Volapuk // |
|
1567 qt2S60LangMapTable.insert("cy", "97"); //Welsh //Welsh |
|
1568 qt2S60LangMapTable.insert("wo", "SC"); //Wolof // |
|
1569 qt2S60LangMapTable.insert("xh", "SC"); //Xhosa // |
|
1570 qt2S60LangMapTable.insert("yi", "SC"); //Yiddish // |
|
1571 qt2S60LangMapTable.insert("yo", "SC"); //Yoruba // |
|
1572 qt2S60LangMapTable.insert("za", "SC"); //Zhuang // |
|
1573 qt2S60LangMapTable.insert("zu", "98"); //Zulu //Zulu |
|
1574 qt2S60LangMapTable.insert("nn", "75"); //Nynorsk //NorwegianNynorsk |
|
1575 qt2S60LangMapTable.insert("bs", "SC"); //Bosnian // |
|
1576 qt2S60LangMapTable.insert("dv", "SC"); //Divehi // |
|
1577 qt2S60LangMapTable.insert("gv", "SC"); //Manx // |
|
1578 qt2S60LangMapTable.insert("kw", "SC"); //Cornish // |
|
1579 qt2S60LangMapTable.insert("ak", "SC"); //Akan // |
|
1580 qt2S60LangMapTable.insert("kok", "SC"); //Konkani // |
|
1581 qt2S60LangMapTable.insert("gaa", "SC"); //Ga // |
|
1582 qt2S60LangMapTable.insert("ig", "SC"); //Igbo // |
|
1583 qt2S60LangMapTable.insert("kam", "SC"); //Kamba // |
|
1584 qt2S60LangMapTable.insert("syr", "SC"); //Syriac // |
|
1585 qt2S60LangMapTable.insert("byn", "SC"); //Blin // |
|
1586 qt2S60LangMapTable.insert("gez", "SC"); //Geez // |
|
1587 qt2S60LangMapTable.insert("kfo", "SC"); //Koro // |
|
1588 qt2S60LangMapTable.insert("sid", "SC"); //Sidamo // |
|
1589 qt2S60LangMapTable.insert("cch", "SC"); //Atsam // |
|
1590 qt2S60LangMapTable.insert("tig", "SC"); //Tigre // |
|
1591 qt2S60LangMapTable.insert("kaj", "SC"); //Jju // |
|
1592 qt2S60LangMapTable.insert("fur", "SC"); //Friulian // |
|
1593 qt2S60LangMapTable.insert("ve", "SC"); //Venda // |
|
1594 qt2S60LangMapTable.insert("ee", "SC"); //Ewe // |
|
1595 qt2S60LangMapTable.insert("wa", "SC"); //Walamo // |
|
1596 qt2S60LangMapTable.insert("haw", "SC"); //Hawaiian // |
|
1597 qt2S60LangMapTable.insert("kcg", "SC"); //Tyap // |
|
1598 qt2S60LangMapTable.insert("ny", "SC"); //Chewa // |
|
1599 } |
|
1600 |
|
1601 void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QString value) |
|
1602 { |
|
1603 if(!list.contains(value)) |
|
1604 list += value; |
|
1605 } |
|
1606 |
|
1607 void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QStringList values) |
|
1608 { |
|
1609 foreach(QString item, values) |
|
1610 appendIfnotExist(list, item); |
|
1611 } |
|
1612 |
|
1613 QString SymbianMakefileGenerator::removePathSeparators(QString &file) |
|
1614 { |
|
1615 QString ret = file; |
|
1616 while(ret.indexOf(QDir::separator()) > 0) { |
|
1617 ret.remove(0, ret.indexOf(QDir::separator())+1); |
|
1618 } |
|
1619 |
|
1620 return ret; |
|
1621 } |
|
1622 |
|
1623 |
|
1624 QString SymbianMakefileGenerator::removeTrailingPathSeparators(QString &file) |
|
1625 { |
|
1626 QString ret = file; |
|
1627 if(ret.endsWith(QDir::separator())) { |
|
1628 ret.remove(ret.length()-1,1); |
|
1629 } |
|
1630 |
|
1631 return ret; |
|
1632 } |
|
1633 |
|
1634 bool SymbianMakefileGenerator::generateCleanCommands(QTextStream& t, |
|
1635 const QStringList& toClean, |
|
1636 const QString& cmd, |
|
1637 const QString& cmdOptions, |
|
1638 const QString& itemPrefix, |
|
1639 const QString& itemSuffix) { |
|
1640 for (int i = 0; i < toClean.size(); ++i) { |
|
1641 QString item = toClean.at(i); |
|
1642 item.prepend(itemPrefix).append(itemSuffix); |
|
1643 #if defined(Q_OS_WIN) |
|
1644 t << "\t-@ if EXIST \"" << QDir::toNativeSeparators(item) << "\" "; |
|
1645 t << cmd << " " << cmdOptions << " \"" << QDir::toNativeSeparators(item) << "\"" << endl; |
|
1646 #else |
|
1647 t << "\t-if test -f " << QDir::toNativeSeparators(item) << "; then "; |
|
1648 t << cmd << " " << cmdOptions << " " << QDir::toNativeSeparators(item) << "; fi" << endl; |
|
1649 #endif |
|
1650 } |
|
1651 |
|
1652 return true; |
|
1653 } |
|
1654 |
|
1655 QString SymbianMakefileGenerator::getWithoutSpecialCharacters(QString& str) { |
|
1656 QString tmp = str; |
|
1657 |
|
1658 tmp.replace(QString("/"), QString("_")); |
|
1659 tmp.replace(QString("\\"), QString("_")); |
|
1660 tmp.replace(QString("-"), QString("_")); |
|
1661 tmp.replace(QString(":"), QString("_")); |
|
1662 tmp.replace(QString("."), QString("_")); |
|
1663 |
|
1664 return tmp; |
|
1665 } |
|
1666 |
|
1667 void SymbianMakefileGenerator::removeSpecialCharacters(QString& str) { |
|
1668 str.replace(QString("/"), QString("_")); |
|
1669 str.replace(QString("\\"), QString("_")); |
|
1670 str.replace(QString("-"), QString("_")); |
|
1671 str.replace(QString(":"), QString("_")); |
|
1672 str.replace(QString("."), QString("_")); |
|
1673 str.replace(QString(" "), QString("_")); |
|
1674 } |
|