diff options
Diffstat (limited to 'qmake/generators/symbian')
-rw-r--r-- | qmake/generators/symbian/initprojectdeploy_symbian.cpp | 379 | ||||
-rw-r--r-- | qmake/generators/symbian/initprojectdeploy_symbian.h | 82 | ||||
-rw-r--r-- | qmake/generators/symbian/symbian_makefile.h | 105 | ||||
-rw-r--r-- | qmake/generators/symbian/symbiancommon.cpp | 1117 | ||||
-rw-r--r-- | qmake/generators/symbian/symbiancommon.h | 134 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 1136 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.h | 149 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_abld.cpp | 523 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_abld.h | 68 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.cpp | 760 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake_sbsv2.h | 84 |
11 files changed, 0 insertions, 4537 deletions
diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp deleted file mode 100644 index 6b7a061a6a..0000000000 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "initprojectdeploy_symbian.h" -#include <QDirIterator> -#include <project.h> -#include <qxmlstream.h> -#include <qsettings.h> -#include <qdebug.h> - -// Included from tools/shared -#include <symbian/epocroot_p.h> - -#define SYSBIN_DIR "/sys/bin" -#define HW_Z_DIR "epoc32/data/z" - -#define SUFFIX_DLL "dll" -#define SUFFIX_EXE "exe" -#define SUFFIX_QTPLUGIN "qtplugin" - -static QString fixPathToEpocOS(const QString &src) -{ - QString ret = Option::fixPathToTargetOS(src); - - bool pathHasDriveLetter = false; - if (ret.size() > 1) - pathHasDriveLetter = (ret.at(1) == QLatin1Char(':')); - - return pathHasDriveLetter ? ret.replace('/', '\\') : QDir::toNativeSeparators(ret); -} - -static bool isPlugin(const QFileInfo& info, const QString& devicePath) -{ - // Libraries are plugins if deployment path is something else than - // SYSBIN_DIR with or without drive letter - if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) - && (devicePath.size() < 8 - || (0 != devicePath.compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive) - && 0 != devicePath.mid(1).compare(QLatin1String(":" SYSBIN_DIR), Qt::CaseInsensitive) - && 0 != devicePath.compare(qt_epocRoot() + QLatin1String(HW_Z_DIR SYSBIN_DIR))))) { - return true; - } else { - return false; - } -} - -static bool isBinary(const QFileInfo& info) -{ - if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) || - 0 == info.suffix().compare(QLatin1String(SUFFIX_EXE), Qt::CaseInsensitive)) { - return true; - } else { - return false; - } -} - -static void createPluginStub(const QFileInfo& info, - const QString& devicePath, - DeploymentList &deploymentList, - QStringList& generatedDirs, - QStringList& generatedFiles) -{ - QString pluginStubDir = Option::output_dir + QLatin1Char('/') + QLatin1String(PLUGIN_STUB_DIR); - QDir().mkpath(pluginStubDir); - if (!generatedDirs.contains(pluginStubDir)) - generatedDirs << pluginStubDir; - // Plugin stubs must have different name from the actual plugins, because - // the toolchain for creating ROM images cannot handle non-binary .dll files properly. - QFile stubFile(pluginStubDir + QLatin1Char('/') + info.completeBaseName() + QLatin1Char('.') + QLatin1String(SUFFIX_QTPLUGIN)); - if (stubFile.open(QIODevice::WriteOnly)) { - if (!generatedFiles.contains(stubFile.fileName())) - generatedFiles << stubFile.fileName(); - QTextStream t(&stubFile); - // Add note to stub so that people will not wonder what it is. - // Creation date is added to make new stub to deploy always to - // force plugin cache miss when loading plugins. - t << "This file is a Qt plugin stub file. The real Qt plugin is located in " SYSBIN_DIR ". Created:" << QDateTime::currentDateTime().toString(Qt::ISODate) << "\n"; - } else { - fprintf(stderr, "cannot deploy \"%s\" because of plugin stub file creation failed\n", info.fileName().toLatin1().constData()); - } - QFileInfo stubInfo(stubFile); - deploymentList.append(CopyItem(Option::fixPathToLocalOS(stubInfo.absoluteFilePath()), - fixPathToEpocOS(devicePath + "/" + stubInfo.fileName()))); -} - -QString generate_uid(const QString& target) -{ - static QMap<QString, QString> targetToUid; - - QString tmp = targetToUid[target]; - - if (!tmp.isEmpty()) { - return tmp; - } - - quint32 hash = 5381; - int c; - - for (int i = 0; i < target.size(); ++i) { - c = target.at(i).toAscii(); - hash ^= c + ((c - i) << i % 20) + ((c + i) << (i + 5) % 20) + ((c - 2 * i) << (i + 10) % 20) + ((c + 2 * i) << (i + 15) % 20); - } - - tmp.setNum(hash, 16); - for (int i = tmp.size(); i < 8; ++i) - tmp.prepend("0"); - - targetToUid[target] = tmp; - - return tmp; -} - -// UIDs starting with 0xE are test UIDs in symbian -QString generate_test_uid(const QString& target) -{ - QString tmp = generate_uid(target); - tmp.replace(0, 1, "E"); - tmp.prepend("0x"); - - return tmp; -} - - -void initProjectDeploySymbian(QMakeProject* project, - DeploymentList &deploymentList, - const QString &testPath, - bool deployBinaries, - bool epocBuild, - const QString &platform, - const QString &build, - QStringList& generatedDirs, - QStringList& generatedFiles) -{ - QString targetPath = testPath; - if (targetPath.endsWith("/") || targetPath.endsWith("\\")) - targetPath = targetPath.mid(0, targetPath.size() - 1); - - bool targetPathHasDriveLetter = false; - if (targetPath.size() > 1) { - targetPathHasDriveLetter = targetPath.at(1) == QLatin1Char(':'); - } - - QString deploymentDrive; - if (0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { - deploymentDrive = qt_epocRoot() + HW_Z_DIR; - } else { - deploymentDrive = targetPathHasDriveLetter ? targetPath.left(2) : QLatin1String("c:"); - } - - foreach(QString item, project->values("DEPLOYMENT")) { - QString devicePath = project->first(item + ".path"); - QString devicePathWithoutDrive = devicePath; - - bool devicePathHasDriveLetter = false; - if (devicePath.size() > 1) { - devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':'); - } - - // Sometimes devicePath can contain disk but APP_RESOURCE_DIR does not, - // so remove the drive letter for comparison purposes. - if (devicePathHasDriveLetter) - { - devicePathWithoutDrive.remove(0,2); - } - if (!deployBinaries - && 0 != platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM)) - && !devicePathWithoutDrive.isEmpty() - && (0 == devicePathWithoutDrive.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive) - || 0 == devicePathWithoutDrive.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) { - // Do not deploy resources in emulator builds, as that seems to cause conflicts - // If there is ever a real need to deploy pre-built resources for emulator, - // BLD_INF_RULES.prj_exports can be used as a workaround. - continue; - } - - if (devicePath.isEmpty() || devicePath == QLatin1String(".")) { - devicePath = targetPath; - } - // check if item.path is relative (! either / or \) - else if (!(devicePath.at(0) == QLatin1Char('/') - || devicePath.at(0) == QLatin1Char('\\') - || devicePathHasDriveLetter)) { - // Create output path - devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('/') + devicePath)); - } else { - if (0 == platform.compare(QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM))) { - if (devicePathHasDriveLetter) { - if (devicePath.startsWith("!")) - devicePath = qt_epocRoot() + "epoc32/winscw/c" + devicePath.remove(0, 2); - else - devicePath = qt_epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1); - } else { - devicePath = qt_epocRoot() + "epoc32/winscw/c" + devicePath; - } - } else { - if (devicePathHasDriveLetter - && 0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { - devicePath.remove(0,2); - } - if (0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM)) - || (!devicePathHasDriveLetter && targetPathHasDriveLetter)) { - devicePath = deploymentDrive + devicePath; - } - } - } - - devicePath.replace(QLatin1String("\\"), QLatin1String("/")); - - if (!deployBinaries - && 0 == devicePath.right(8).compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive) - && 0 != platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { - // Skip deploying to SYSBIN_DIR for anything but binary deployments - // Note: Deploying pre-built binaries also follow this rule, so emulator builds - // will not get those deployed. Since there is no way to differentiate currently - // between pre-built binaries for emulator and HW anyway, this is not a major issue. - continue; - } - - QStringList flags = project->values(item + ".flags"); - - // ### Qt 5: remove .sources, inconsistent with INSTALLS - foreach(QString source, project->values(item + ".sources") + project->values(item + ".files")) { - source = Option::fixPathToLocalOS(source); - QString nameFilter; - QFileInfo info(source); - QString searchPath; - bool dirSearch = false; - - if (info.isDir()) { - nameFilter = QLatin1String("*"); - searchPath = info.absoluteFilePath(); - dirSearch = true; - } else { - if (info.exists() || source.indexOf('*') != -1) { - nameFilter = source.split(QDir::separator()).last(); - searchPath = info.absolutePath(); - } else { - // Entry was not found. That is ok if it is a binary, since those do not necessarily yet exist. - // Dlls need to be processed even when not deploying binaries for the stubs - if (isBinary(info)) { - if (deployBinaries) { - // Executables and libraries are deployed to \sys\bin - QFileInfo targetPath; - if (epocBuild) - targetPath.setFile(qt_epocRoot() + "epoc32/release/" + platform + "/" + build + "/"); - else - targetPath.setFile(info.path() + QDir::separator()); - if(devicePathHasDriveLetter) { - deploymentList.append(CopyItem( - Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(), - false, true), - fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/") - + info.fileName()), - flags)); - } else { - deploymentList.append(CopyItem( - Option::fixPathToLocalOS(targetPath.absolutePath() + "/" + info.fileName(), - false, true), - fixPathToEpocOS(deploymentDrive + QLatin1String("/" SYSBIN_DIR "/") - + info.fileName()), - flags)); - } - } - if (isPlugin(info, devicePath)) { - createPluginStub(info, devicePath, deploymentList, generatedDirs, generatedFiles); - continue; - } - } else { - // Generate deployment even if file doesn't exist, as this may be the case - // when generating .pkg files. - deploymentList.append(CopyItem(Option::fixPathToLocalOS(info.absoluteFilePath()), - fixPathToEpocOS(devicePath + "/" + info.fileName()), - flags)); - continue; - } - } - } - - int pathSize = info.absolutePath().size(); - QDirIterator iterator(searchPath, QStringList() << nameFilter - , QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks - , dirSearch ? QDirIterator::Subdirectories : QDirIterator::NoIteratorFlags); - - while (iterator.hasNext()) { - iterator.next(); - QFileInfo iteratorInfo(iterator.filePath()); - QString absoluteItemPath = Option::fixPathToLocalOS(iteratorInfo.absolutePath()); - int diffSize = absoluteItemPath.size() - pathSize; - - if (!iteratorInfo.isDir()) { - if (isPlugin(iterator.fileInfo(), devicePath)) { - // This deploys pre-built plugins. Other pre-built binaries will deploy normally, - // as they have SYSBIN_DIR target path. - if (deployBinaries - || (0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM)))) { - if (devicePathHasDriveLetter) { - deploymentList.append(CopyItem( - Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), - fixPathToEpocOS(devicePath.left(2) + QLatin1String(SYSBIN_DIR "/") - + iterator.fileName()), - flags)); - } else { - deploymentList.append(CopyItem( - Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), - fixPathToEpocOS(deploymentDrive + QLatin1String("/" SYSBIN_DIR "/") - + iterator.fileName()), - flags)); - } - } - createPluginStub(info, devicePath + "/" + absoluteItemPath.right(diffSize), - deploymentList, generatedDirs, generatedFiles); - continue; - } else { - deploymentList.append(CopyItem( - Option::fixPathToLocalOS(absoluteItemPath + "/" + iterator.fileName()), - fixPathToEpocOS(devicePath + "/" + absoluteItemPath.right(diffSize) - + "/" + iterator.fileName()), - flags)); - } - } - } - } - } - - // Remove deployments that do not actually do anything - if (0 == platform.compare(QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM)) - || 0 == platform.compare(QLatin1String(ROM_DEPLOYMENT_PLATFORM))) { - QMutableListIterator<CopyItem> i(deploymentList); - while(i.hasNext()) { - CopyItem &item = i.next(); - QFileInfo fromItem(item.from); - QFileInfo toItem(item.to); -#if defined(Q_OS_WIN) - if (0 == fromItem.absoluteFilePath().compare(toItem.absoluteFilePath(), Qt::CaseInsensitive)) -#else - if (0 == fromItem.absoluteFilePath().compare(toItem.absoluteFilePath())) -#endif - i.remove(); - } - } -} diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h deleted file mode 100644 index eed1e4d736..0000000000 --- a/qmake/generators/symbian/initprojectdeploy_symbian.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INITPROJECTDEPLOYSYMBIAN_H -#define INITPROJECTDEPLOYSYMBIAN_H - -#include <qstring.h> -#include <qstringlist.h> -#include <qdatetime.h> -#include <option.h> -#include <qdir.h> -#include <qfile.h> -#include <stdlib.h> - -#define PLUGIN_STUB_DIR "qmakepluginstubs" -#define ROM_DEPLOYMENT_PLATFORM "rom" -#define EMULATOR_DEPLOYMENT_PLATFORM "emulator" - -struct CopyItem -{ - CopyItem(const QString& f, const QString& t) - : from(f) , to(t) { } - CopyItem(const QString& f, const QString& t, const QStringList& l) - : from(f) , to(t), flags(l) { } - QString from; - QString to; - QStringList flags; -}; -typedef QList<CopyItem> DeploymentList; - -extern QString generate_uid(const QString& target); -extern QString generate_test_uid(const QString& target); - -extern void initProjectDeploySymbian(QMakeProject* project, - DeploymentList &deploymentList, - const QString &testPath, - bool deployBinaries, - bool epocBuild, - const QString &platform, - const QString &build, - QStringList& generatedDirs, - QStringList& generatedFiles); - -#endif // INITPROJECTDEPLOYSYMBIAN_H diff --git a/qmake/generators/symbian/symbian_makefile.h b/qmake/generators/symbian/symbian_makefile.h deleted file mode 100644 index 90044e04a2..0000000000 --- a/qmake/generators/symbian/symbian_makefile.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SYMBIAN_MAKEFILE_H -#define SYMBIAN_MAKEFILE_H - -#include "symbiancommon.h" - -// This allows us to reuse the code for both win32 and unix makefile generators. -template <class T> -class SymbianMakefileTemplate : public T, public SymbianCommonGenerator -{ -public: - SymbianMakefileTemplate() : SymbianCommonGenerator(this) {} - - void init() - { - T::init(); - SymbianCommonGenerator::init(); - } - - bool writeMakefile(QTextStream &t) - { - QString numberOfIcons; - QString iconFile; - QMap<QString, QStringList> userRssRules; - readRssRules(numberOfIcons, iconFile, userRssRules); - - // Generate pkg files if there are any actual files to deploy - bool generatePkg = false; - - if (targetType == TypeExe) { - generatePkg = true; - } else { - const QStringList deployments = this->project->values("DEPLOYMENT"); - for (int i = 0; i < deployments.count(); ++i) { - // ### Qt 5: remove .sources, inconsistent with INSTALLS - if (!this->project->values(deployments.at(i) + ".sources").isEmpty() || - !this->project->values(deployments.at(i) + ".files").isEmpty()) { - generatePkg = true; - break; - } - } - } - - SymbianLocalizationList symbianLocalizationList; - parseTsFiles(&symbianLocalizationList); - - if (generatePkg) { - generatePkgFile(iconFile, false, symbianLocalizationList); - } - - if (targetType == TypeExe) { - if (!this->project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { - writeRegRssFile(userRssRules); - writeRssFile(numberOfIcons, iconFile); - writeLocFile(symbianLocalizationList); - } - } - - writeCustomDefFile(); - - return T::writeMakefile(t); - } -}; - -#endif // SYMBIAN_MAKEFILE_H diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp deleted file mode 100644 index a0a8eea871..0000000000 --- a/qmake/generators/symbian/symbiancommon.cpp +++ /dev/null @@ -1,1117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "symbiancommon.h" -#include <qdebug.h> -#include <qxmlstream.h> - -// Included from tools/shared -#include <symbian/epocroot_p.h> - -#define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" - -#define RSS_RULES "RSS_RULES" -#define RSS_RULES_BASE "RSS_RULES." -#define RSS_TAG_NBROFICONS "number_of_icons" -#define RSS_TAG_ICONFILE "icon_file" -#define RSS_TAG_HEADER "header" -#define RSS_TAG_SERVICE_LIST "service_list" -#define RSS_TAG_FILE_OWNERSHIP_LIST "file_ownership_list" -#define RSS_TAG_DATATYPE_LIST "datatype_list" -#define RSS_TAG_FOOTER "footer" -#define RSS_TAG_DEFAULT "default_rules" // Same as just giving rules without tag - -#define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonu.def" - -#define MANUFACTURER_NOTE_FILE "manufacturer_note.txt" -#define DEFAULT_MANUFACTURER_NOTE \ - "The package is not supported for devices from this manufacturer. Please try the selfsigned " \ - "version of the package instead." - -SymbianCommonGenerator::SymbianCommonGenerator(MakefileGenerator *generator) - : generator(generator) -{ -} - -void SymbianCommonGenerator::init() -{ - QMakeProject *project = generator->project; - fixedTarget = project->first("QMAKE_ORIG_TARGET"); - if (fixedTarget.isEmpty()) - fixedTarget = project->first("TARGET"); - fixedTarget = generator->unescapeFilePath(fixedTarget); - fixedTarget = removePathSeparators(fixedTarget); - removeSpecialCharacters(fixedTarget); - - // This should not be empty since the mkspecs are supposed to set it if missing. - uid3 = project->first("TARGET.UID3").trimmed(); - - if ((project->values("TEMPLATE")).contains("app")) - targetType = TypeExe; - else if ((project->values("TEMPLATE")).contains("lib")) { - // Check CONFIG to see if we are to build staticlib or dll - if (project->isActiveConfig("staticlib") || project->isActiveConfig("static")) - targetType = TypeLib; - else if (project->isActiveConfig("plugin")) - targetType = TypePlugin; - else - targetType = TypeDll; - } else { - targetType = TypeSubdirs; - } - - // UID is valid as either hex or decimal, so just convert it to number and back to hex - // to get proper string for private dir - bool conversionOk = false; - uint uidNum = uid3.toUInt(&conversionOk, 0); - - if (!conversionOk) { - fprintf(stderr, "Error: Invalid UID \"%s\".\n", uid3.toUtf8().constData()); - } else { - privateDirUid.setNum(uidNum, 16); - while (privateDirUid.length() < 8) - privateDirUid.insert(0, QLatin1Char('0')); - } -} - -bool SymbianCommonGenerator::containsStartWithItem(const QChar &c, const QStringList& src) -{ - bool result = false; - foreach(QString str, src) { - if (str.startsWith(c)) { - result = true; - break; - } - } - return result; -} - -void SymbianCommonGenerator::removeSpecialCharacters(QString& str) -{ - // When modifying this method check also symbianRemoveSpecialCharacters in symbian.conf - QString underscore = QLatin1String("_"); - str.replace(QLatin1String("/"), underscore); - str.replace(QLatin1String("\\"), underscore); - str.replace(QLatin1String(" "), underscore); - str.replace(QLatin1String(":"), underscore); -} - -QString romPath(const QString& path) -{ - if(path.length() > 2 && path[1] == ':') - return QLatin1String("z:") + path.mid(2); - return QLatin1String("z:") + path; -} - -void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, - bool epocBuild, - const SymbianLocalizationList &symbianLocalizationList) -{ - QMakeProject *project = generator->project; - QString pkgFilename = Option::output_dir + QLatin1Char('/') + - QString("%1_template.pkg").arg(fixedTarget); - - QFile pkgFile(pkgFilename); - if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { - PRINT_FILE_CREATE_ERROR(pkgFilename); - return; - } - - QString stubPkgFileName = Option::output_dir + QLatin1Char('/') + - QString("%1_stub.pkg").arg(fixedTarget); - - QFile stubPkgFile(stubPkgFileName); - if (!stubPkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { - PRINT_FILE_CREATE_ERROR(stubPkgFileName); - return; - } - - generatedFiles << pkgFile.fileName(); - QTextStream t(&pkgFile); - generatedFiles << stubPkgFile.fileName(); - QTextStream ts(&stubPkgFile); - - QString installerSisHeader = project->values("DEPLOYMENT.installer_header").join("\n"); - if (installerSisHeader.isEmpty()) { - // Use correct protected UID for publishing if application UID is in protected range, - // otherwise use self-signable test UID. - QRegExp protUidMatcher("0[xX][0-7].*"); - if (protUidMatcher.exactMatch(uid3)) - installerSisHeader = QLatin1String("0x2002CCCF"); - else - installerSisHeader = QLatin1String("0xA000D7CE"); // Use default self-signable UID - } - - QString wrapperStreamBuffer; - QTextStream tw(&wrapperStreamBuffer); - - QString dateStr = QDateTime::currentDateTime().toString(Qt::ISODate); - - // Header info - QString wrapperPkgFilename = Option::output_dir + QLatin1Char('/') + QString("%1_installer.%2") - .arg(fixedTarget).arg("pkg"); - - QString headerComment = "; %1 generated by qmake at %2\n" - "; This file is generated by qmake and should not be modified by the user\n" - ";\n\n"; - t << headerComment.arg(pkgFilename).arg(dateStr); - tw << headerComment.arg(wrapperPkgFilename).arg(dateStr); - ts << headerComment.arg(stubPkgFileName).arg(dateStr); - - QStringList commonRawPreRules; - QStringList mainRawPreRules; - QStringList instRawPreRules; - QStringList stubRawPreRules; - - // Though there can't be more than one language or header line, use stringlists - // in case user wants comments to go with the rules. - // Note that it makes no sense to have file specific language or header rules, - // except what is provided for installer header via "DEPLOYMENT.installer_header" variable, - // because stub and main headers should always match. Vendor rules are similarly limited to - // make code cleaner as it is unlikely anyone will want different vendor in different files. - QStringList languageRules; - QStringList headerRules; - QStringList vendorRules; - - QStringList commonRawPostRules; - QStringList mainRawPostRules; - QStringList instRawPostRules; - QStringList stubRawPostRules; - - QStringList failList; // Used for detecting incorrect usage - - QString emptySuffix; - QString mainSuffix(".main"); - QString instSuffix(".installer"); - QString stubSuffix(".stub"); - - foreach(QString item, project->values("DEPLOYMENT")) { - parsePreRules(item, emptySuffix, &commonRawPreRules, &languageRules, &headerRules, &vendorRules); - parsePreRules(item, mainSuffix, &mainRawPreRules, &failList, &failList, &failList); - parsePreRules(item, instSuffix, &instRawPreRules, &failList, &failList, &failList); - parsePreRules(item, stubSuffix, &stubRawPreRules, &failList, &failList, &failList); - - parsePostRules(item, emptySuffix, &commonRawPostRules); - parsePostRules(item, mainSuffix, &mainRawPostRules); - parsePostRules(item, instSuffix, &instRawPostRules); - parsePostRules(item, stubSuffix, &stubRawPostRules); - } - - if (!failList.isEmpty()) { - fprintf(stderr, "Warning: Custom language, header, or vendor definitions are not " - "supported by file specific pkg_prerules.* variables.\n" - "Use plain pkg_prerules and/or DEPLOYMENT.installer_header for customizing " - "these items.\n"); - } - - foreach(QString item, commonRawPreRules) { - if (item.startsWith("(")) { - // Only regular pkg file should have package dependencies - mainRawPreRules << item; - } else if (item.startsWith("[")) { - // stub pkg file should not have platform dependencies - mainRawPreRules << item; - instRawPreRules << item; - } else { - mainRawPreRules << item; - instRawPreRules << item; - stubRawPreRules << item; - } - } - - // Currently common postrules only go to main - mainRawPostRules << commonRawPostRules; - - // Apply some defaults if specific data does not exist in PKG pre-rules - if (languageRules.isEmpty()) { - if (symbianLocalizationList.isEmpty()) { - languageRules << "; Language\n&EN\n\n"; - } else { - QStringList langCodes; - SymbianLocalizationListIterator iter(symbianLocalizationList); - while (iter.hasNext()) { - const SymbianLocalization &loc = iter.next(); - langCodes << loc.symbianLanguageCode; - } - languageRules << QString("; Languages\n&%1\n\n").arg(langCodes.join(",")); - } - } else if (headerRules.isEmpty()) { - // In case user defines langs, he must take care also about SIS header - fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); - } - - t << languageRules.join("\n") << endl; - tw << languageRules.join("\n") << endl; - ts << languageRules.join("\n") << endl; - - // Determine application version. If version has missing component values, - // those will default to zero. - // If VERSION is missing altogether or is invalid, use "1,0,0" - QStringList verNumList = project->first("VERSION").split('.'); - uint major = 0; - uint minor = 0; - uint patch = 0; - bool success = false; - - if (verNumList.size() > 0) { - major = verNumList[0].toUInt(&success); - if (success && verNumList.size() > 1) { - minor = verNumList[1].toUInt(&success); - if (success && verNumList.size() > 2) { - patch = verNumList[2].toUInt(&success); - } - } - } - - QString applicationVersion("1,0,0"); - if (success) - applicationVersion = QString("%1,%2,%3").arg(major).arg(minor).arg(patch); - - // Append package build version number if it is set - QString pkgBuildVersion = project->first("DEPLOYMENT.pkg_build_version"); - if (!pkgBuildVersion.isEmpty()) { - success = false; - uint build = pkgBuildVersion.toUInt(&success); - if (success && build < 100) { - if (pkgBuildVersion.size() == 1) - pkgBuildVersion.prepend(QLatin1Char('0')); - applicationVersion.append(pkgBuildVersion); - } else { - fprintf(stderr, "Warning: Invalid DEPLOYMENT.pkg_build_version (%s), must be a number between 0 - 99\n", qPrintable(pkgBuildVersion)); - } - } - - // Package header - QString sisHeader = "; SIS header: name, uid, version\n#{\"%1\"},(%2),%3\n\n"; - - QString defaultVisualTarget = project->values("DEPLOYMENT.display_name").join(" "); - if (defaultVisualTarget.isEmpty()) - defaultVisualTarget = generator->escapeFilePath(project->first("TARGET")); - defaultVisualTarget = removePathSeparators(defaultVisualTarget); - - QString visualTarget = generatePkgNameForHeader(symbianLocalizationList, defaultVisualTarget, false); - QString wrapperTarget = generatePkgNameForHeader(symbianLocalizationList, defaultVisualTarget, true); - - if (installerSisHeader.startsWith("0x", Qt::CaseInsensitive)) { - tw << sisHeader.arg(wrapperTarget).arg(installerSisHeader).arg(applicationVersion); - } else { - tw << installerSisHeader << endl; - } - - if (headerRules.isEmpty()) { - t << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion); - ts << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion); - } - else { - t << headerRules.join("\n") << endl; - ts << headerRules.join("\n") << endl; - } - - // Vendor name - if (!containsStartWithItem('%', vendorRules)) { - QString vendorStr = QLatin1String("\"Vendor\","); - QString locVendors = vendorStr; - for (int i = 1; i < symbianLocalizationList.size(); i++) { - locVendors.append(vendorStr); - } - locVendors.chop(1); - vendorRules << QString("; Default localized vendor name\n%{%1}\n\n").arg(locVendors); - } - if (!containsStartWithItem(':', vendorRules)) { - vendorRules << "; Default unique vendor name\n:\"Vendor\"\n\n"; - } - - t << vendorRules.join("\n") << endl; - tw << vendorRules.join("\n") << endl; - ts << vendorRules.join("\n") << endl; - - // PKG pre-rules - these are added before actual file installations i.e. SIS package body - QString comment = "\n; Manual PKG pre-rules from PRO files\n"; - - if (mainRawPreRules.size()) { - t << comment; - t << mainRawPreRules.join("\n") << endl; - } - if (instRawPreRules.size()) { - tw << comment; - tw << instRawPreRules.join("\n") << endl; - } - if (stubRawPreRules.size()) { - ts << comment; - ts << stubRawPreRules.join("\n") << endl; - } - - t << endl; - tw << endl; - ts << endl; - - // Begin Manufacturer block - if (!project->values("DEPLOYMENT.manufacturers").isEmpty()) { - QString manufacturerStr("IF "); - foreach(QString manufacturer, project->values("DEPLOYMENT.manufacturers")) { - manufacturerStr.append(QString("(MANUFACTURER)=(%1) OR \n ").arg(manufacturer)); - } - // Remove the final OR - manufacturerStr.chop(8); - t << manufacturerStr << endl; - } - - if (symbianLocalizationList.size()) { - // Add localized resources to DEPLOYMENT if default resource deployment is done - addLocalizedResourcesToDeployment("default_resource_deployment.files", symbianLocalizationList); - addLocalizedResourcesToDeployment("default_reg_deployment.files", symbianLocalizationList); - } - - // deploy files specified by DEPLOYMENT variable - QString remoteTestPath; - QString zDir; - remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); - if (epocBuild) - zDir = qt_epocRoot() + QLatin1String("epoc32/data/z"); - - DeploymentList depList; - initProjectDeploySymbian(project, depList, remoteTestPath, true, epocBuild, "$(PLATFORM)", "$(TARGET)", generatedDirs, generatedFiles); - if (depList.size()) - t << "; DEPLOYMENT" << endl; - for (int i = 0; i < depList.size(); ++i) { - QString from = depList.at(i).from; - QString to = depList.at(i).to; - QString flags; - bool showOnlyFile = false; - foreach(QString flag, depList.at(i).flags) { - if (flag == QLatin1String("FT") - || flag == QLatin1String("FILETEXT")) { - showOnlyFile = true; - } - flags.append(QLatin1Char(',')).append(flag); - } - - if (epocBuild) { - // Deploy anything not already deployed from under epoc32 instead from under - // \epoc32\data\z\ to enable using pkg file without rebuilding - // the project, which can be useful for some binary only distributions. - if (!from.contains(QLatin1String("epoc32"), Qt::CaseInsensitive)) { - from = to; - if (from.size() > 1 && from.at(1) == QLatin1Char(':')) - from = from.mid(2); - from.prepend(zDir); - } - } - - // Files with "FILETEXT"/"FT" flag are meant for showing only at installation time - // and therefore do not belong to the stub package and will not install the file into phone. - if (showOnlyFile) - to.clear(); - else - ts << QString("\"\" - \"%1\"").arg(romPath(to)) << endl; - - t << QString("\"%1\" - \"%2\"%3").arg(from.replace('\\','/')).arg(to).arg(flags) << endl; - - } - t << endl; - ts << endl; - - // PKG post-rules - these are added after actual file installations i.e. SIS package body - comment = "; Manual PKG post-rules from PRO files\n"; - - if (mainRawPostRules.size()) { - t << comment; - t << mainRawPostRules.join("\n") << endl; - } - if (instRawPostRules.size()) { - tw << comment; - tw << instRawPostRules.join("\n") << endl; - } - if (stubRawPostRules.size()) { - ts << comment; - ts << stubRawPostRules.join("\n") << endl; - } - - // Close Manufacturer block - if (!project->values("DEPLOYMENT.manufacturers").isEmpty()) { - QString manufacturerFailNoteFile; - if (project->values("DEPLOYMENT.manufacturers.fail_note").isEmpty()) { - manufacturerFailNoteFile = QString("%1_" MANUFACTURER_NOTE_FILE).arg(uid3); - QFile ft(manufacturerFailNoteFile); - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - QTextStream t2(&ft); - - t2 << QString(DEFAULT_MANUFACTURER_NOTE) << endl; - } else { - PRINT_FILE_CREATE_ERROR(manufacturerFailNoteFile) - } - } else { - manufacturerFailNoteFile = project->values("DEPLOYMENT.manufacturers.fail_note").join(""); - } - - t << "ELSEIF NOT(0) ; MANUFACTURER" << endl - << "\"" << generator->fileInfo(manufacturerFailNoteFile).absoluteFilePath() << "\"" - << " - \"\", FILETEXT, TEXTEXIT" << endl - << "ENDIF ; MANUFACTURER" << endl; - } - - // Write wrapper pkg - if (!installerSisHeader.isEmpty()) { - QFile wrapperPkgFile(wrapperPkgFilename); - if (!wrapperPkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { - PRINT_FILE_CREATE_ERROR(wrapperPkgFilename); - return; - } - - generatedFiles << wrapperPkgFile.fileName(); - QTextStream twf(&wrapperPkgFile); - - twf << wrapperStreamBuffer << endl; - - // Wrapped files deployment - QString currentPath = qmake_getpwd(); - QString sisName = QString("%1.sis").arg(fixedTarget); - twf << "\"" << currentPath << "/" << sisName << "\" - \"!:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; - - QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); - bootStrapPath.append("/smartinstaller.sis"); - QFileInfo fi(generator->fileInfo(bootStrapPath)); - twf << "@\"" << fi.absoluteFilePath() << "\",(0x2002CCCD)" << endl; - } -} - -QString SymbianCommonGenerator::removePathSeparators(QString &file) -{ - QString ret = file; - - if (QDir::separator().unicode() != '/') - ret.replace(QDir::separator(), QLatin1Char('/')); - - if (ret.indexOf(QLatin1Char('/')) >= 0) - ret.remove(0, ret.lastIndexOf(QLatin1Char('/')) + 1); - - return ret; -} - -void SymbianCommonGenerator::writeRegRssFile(QMap<QString, QStringList> &userItems) -{ - QString filename(fixedTarget); - filename.append("_reg.rss"); - if (!Option::output_dir.isEmpty()) - filename = Option::output_dir + '/' + filename; - QFile ft(filename); - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - QTextStream t(&ft); - t << "// ============================================================================" << endl; - t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; - t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; - t << "// * This file is generated by qmake and should not be modified by the" << endl; - t << "// * user." << endl; - t << "// ============================================================================" << endl; - t << endl; - t << "#include <" << fixedTarget << ".rsg>" << endl; - t << "#include <appinfo.rh>" << endl; - foreach(QString item, userItems[RSS_TAG_HEADER]) - t << item << endl; - t << endl; - t << "UID2 KUidAppRegistrationResourceFile" << endl; - t << "UID3 " << uid3 << endl << endl; - t << "RESOURCE APP_REGISTRATION_INFO" << endl; - t << "\t{" << endl; - t << "\tapp_file=\"" << fixedTarget << "\";" << endl; - t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl; - - writeRegRssList(t, userItems[RSS_TAG_SERVICE_LIST], - QLatin1String(RSS_TAG_SERVICE_LIST), - QLatin1String("SERVICE_INFO")); - writeRegRssList(t, userItems[RSS_TAG_FILE_OWNERSHIP_LIST], - QLatin1String(RSS_TAG_FILE_OWNERSHIP_LIST), - QLatin1String("FILE_OWNERSHIP_INFO")); - writeRegRssList(t, userItems[RSS_TAG_DATATYPE_LIST], - QLatin1String(RSS_TAG_DATATYPE_LIST), - QLatin1String("DATATYPE")); - t << endl; - - foreach(QString item, userItems[RSS_TAG_DEFAULT]) - t << "\t" << item.replace("\n","\n\t") << endl; - t << "\t}" << endl; - - foreach(QString item, userItems[RSS_TAG_FOOTER]) - t << item << endl; - } else { - PRINT_FILE_CREATE_ERROR(filename) - } -} - -void SymbianCommonGenerator::writeRegRssList(QTextStream &t, - QStringList &userList, - const QString &listTag, - const QString &listItem) -{ - int itemCount = userList.count(); - if (itemCount) { - t << "\t" << listTag << " ="<< endl; - t << "\t\t{" << endl; - foreach(QString item, userList) { - t << "\t\t" << listItem << endl; - t << "\t\t\t{" << endl; - t << "\t\t\t" << item.replace("\n","\n\t\t\t") << endl; - t << "\t\t\t}"; - if (--itemCount) - t << ","; - t << endl; - } - t << "\t\t}; "<< endl; - } -} - -void SymbianCommonGenerator::writeRssFile(QString &numberOfIcons, QString &iconFile) -{ - QString filename(fixedTarget); - if (!Option::output_dir.isEmpty()) - filename = Option::output_dir + '/' + filename; - filename.append(".rss"); - QFile ft(filename); - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - QTextStream t(&ft); - t << "// ============================================================================" << endl; - t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; - t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; - t << "// * This file is generated by qmake and should not be modified by the" << endl; - t << "// * user." << endl; - t << "// ============================================================================" << endl; - t << endl; - t << "CHARACTER_SET UTF8" << endl; - t << "#include <appinfo.rh>" << endl; - t << "#include \"" << fixedTarget << ".loc\"" << endl; - t << endl; - t << "RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info" << endl; - t << "\t{" << endl; - t << "\tshort_caption = STRING_r_short_caption;" << endl; - t << "\tcaption_and_icon =" << endl; - t << "\tCAPTION_AND_ICON_INFO" << endl; - t << "\t\t{" << endl; - t << "\t\tcaption = STRING_r_caption;" << endl; - - QString rssIconFile = iconFile; - rssIconFile = rssIconFile.replace("/", "\\\\"); - - if (numberOfIcons.isEmpty() || rssIconFile.isEmpty()) { - // There can be maximum one item in this tag, validated when parsed - t << "\t\tnumber_of_icons = 0;" << endl; - t << "\t\ticon_file = \"\";" << endl; - } else { - // There can be maximum one item in this tag, validated when parsed - t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl; - t << "\t\ticon_file = \"" << rssIconFile << "\";" << endl; - } - t << "\t\t};" << endl; - t << "\t}" << endl; - t << endl; - } else { - PRINT_FILE_CREATE_ERROR(filename); - } -} - -void SymbianCommonGenerator::writeLocFile(const SymbianLocalizationList &symbianLocalizationList) -{ - QString filename = generateLocFileName(); - QFile ft(filename); - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - QTextStream t(&ft); - - QString displayName = generator->project->values("DEPLOYMENT.display_name").join(" "); - if (displayName.isEmpty()) - displayName = generator->escapeFilePath(generator->project->first("TARGET")); - - t << "// ============================================================================" << endl; - t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; - t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; - t << "// * This file is generated by qmake and should not be modified by the" << endl; - t << "// * user." << endl; - t << "// ============================================================================" << endl; - t << endl; - t << "#ifdef LANGUAGE_SC" << endl; - t << "#define STRING_r_short_caption \"" << displayName << "\"" << endl; - t << "#define STRING_r_caption \"" << displayName << "\"" << endl; - - SymbianLocalizationListIterator iter(symbianLocalizationList); - while (iter.hasNext()) { - const SymbianLocalization &loc = iter.next(); - QString shortCaption = loc.shortCaption; - QString longCaption = loc.longCaption; - if (shortCaption.isEmpty()) - shortCaption = displayName; - if (longCaption.isEmpty()) - longCaption = displayName; - - t << "#elif defined LANGUAGE_" << loc.symbianLanguageCode << endl; - t << "#define STRING_r_short_caption \"" << shortCaption << "\"" << endl; - t << "#define STRING_r_caption \"" << longCaption << "\"" << endl; - } - - t << "#else" << endl; - t << "#define STRING_r_short_caption \"" << displayName << "\"" << endl; - t << "#define STRING_r_caption \"" << displayName << "\"" << endl; - t << "#endif" << endl; - } else { - PRINT_FILE_CREATE_ERROR(filename); - } -} - -void SymbianCommonGenerator::readRssRules(QString &numberOfIcons, - QString &iconFile, QMap<QString, - QStringList> &userRssRules) -{ - QMakeProject *project = generator->project; - for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { - if (it.key().startsWith(RSS_RULES_BASE)) { - QString newKey = it.key().mid(sizeof(RSS_RULES_BASE) - 1); - if (newKey.isEmpty()) { - fprintf(stderr, "Warning: Empty RSS_RULES_BASE key encountered\n"); - continue; - } - QStringList newValues; - QStringList values = it.value(); - foreach(QString item, values) { - // If there is no stringlist defined for a rule, use rule value directly - // This is convenience for defining single line statements - if (project->values(item).isEmpty()) { - newValues << item; - } else { - QStringList itemList; - foreach(QString itemRow, project->values(item)) { - itemList << itemRow; - } - newValues << itemList.join("\n"); - } - } - // Verify that there is exactly one value in RSS_TAG_NBROFICONS - if (newKey == RSS_TAG_NBROFICONS) { - if (newValues.count() == 1) { - numberOfIcons = newValues[0]; - } else { - fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", - RSS_RULES_BASE, RSS_TAG_NBROFICONS); - continue; - } - // Verify that there is exactly one value in RSS_TAG_ICONFILE - } else if (newKey == RSS_TAG_ICONFILE) { - if (newValues.count() == 1) { - iconFile = newValues[0]; - } else { - fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", - RSS_RULES_BASE, RSS_TAG_ICONFILE); - continue; - } - } else if (newKey == RSS_TAG_HEADER - || newKey == RSS_TAG_SERVICE_LIST - || newKey == RSS_TAG_FILE_OWNERSHIP_LIST - || newKey == RSS_TAG_DATATYPE_LIST - || newKey == RSS_TAG_FOOTER - || newKey == RSS_TAG_DEFAULT) { - userRssRules[newKey] = newValues; - continue; - } else { - fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", - RSS_RULES_BASE, newKey.toLatin1().constData()); - continue; - } - } - } - - QStringList newValues; - foreach(QString item, project->values(RSS_RULES)) { - // If there is no stringlist defined for a rule, use rule value directly - // This is convenience for defining single line statements - if (project->values(item).isEmpty()) { - newValues << item; - } else { - newValues << project->values(item); - } - } - userRssRules[RSS_TAG_DEFAULT] << newValues; - - // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist - // or neither of them exist - if (!((numberOfIcons.isEmpty() && iconFile.isEmpty()) || - (!numberOfIcons.isEmpty() && !iconFile.isEmpty()))) { - numberOfIcons.clear(); - iconFile.clear(); - fprintf(stderr, "Warning: Both or neither of '%s%s' and '%s%s' keys must exist.\n", - RSS_RULES_BASE, RSS_TAG_NBROFICONS, RSS_RULES_BASE, RSS_TAG_ICONFILE); - } - - // Validate that RSS_TAG_NBROFICONS contains only numbers - if (!numberOfIcons.isEmpty()) { - bool ok; - numberOfIcons = numberOfIcons.simplified(); - numberOfIcons.toInt(&ok); - if (!ok) { - numberOfIcons.clear(); - iconFile.clear(); - fprintf(stderr, "Warning: '%s%s' must be integer in decimal format.\n", - RSS_RULES_BASE, RSS_TAG_NBROFICONS); - } - } -} - -void SymbianCommonGenerator::writeCustomDefFile() -{ - if (targetType == TypePlugin && !generator->project->isActiveConfig("stdbinary")) { - // Create custom def file for plugin - QFile ft(Option::output_dir + QLatin1Char('/') + QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); - - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - QTextStream t(&ft); - - t << "; ==============================================================================" << endl; - t << "; Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; - t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; - t << "; This file is generated by qmake and should not be modified by the" << endl; - t << "; user." << endl; - t << "; Name : " PLUGIN_COMMON_DEF_FILE_ACTUAL << endl; - t << "; Part of : " << generator->project->values("TARGET").join(" ") << endl; - t << "; Description : Fixes common plugin symbols to known ordinals" << endl; - t << "; Version : " << endl; - t << ";" << endl; - t << "; ==============================================================================" << "\n" << endl; - - t << endl; - - t << "EXPORTS" << endl; - t << "\tqt_plugin_query_verification_data @ 1 NONAME" << endl; - t << "\tqt_plugin_instance @ 2 NONAME" << endl; - t << endl; - } else { - PRINT_FILE_CREATE_ERROR(QString(PLUGIN_COMMON_DEF_FILE_ACTUAL)) - } - } -} - -void SymbianCommonGenerator::parseTsFiles(SymbianLocalizationList *symbianLocalizationList) -{ - if (!generator->project->isActiveConfig("localize_deployment")) { - return; - } - - QStringList symbianTsFiles; - - symbianTsFiles << generator->project->values("SYMBIAN_MATCHED_TRANSLATIONS"); - - if (!symbianTsFiles.isEmpty()) { - fillQt2SymbianLocalizationList(symbianLocalizationList); - - QMutableListIterator<SymbianLocalization> iter(*symbianLocalizationList); - while (iter.hasNext()) { - SymbianLocalization &loc = iter.next(); - static QString matchStrTemplate = QLatin1String(".*_%1\\.ts"); - QString matchStr = matchStrTemplate.arg(loc.qtLanguageCode); - - foreach (QString file, symbianTsFiles) { - QRegExp matcher(matchStr); - if (matcher.exactMatch(file) && parseTsContent(file, &loc)) - break; - } - } - } -} - -void SymbianCommonGenerator::fillQt2SymbianLocalizationList(SymbianLocalizationList *symbianLocalizationList) -{ - static QString symbianCodePrefix = QLatin1String("SYMBIAN_LANG."); - - QStringList symbianLanguages = generator->project->values("SYMBIAN_MATCHED_LANGUAGES"); - - foreach (QString qtCode, symbianLanguages) { - SymbianLocalization newLoc; - QString symbianCodeVariable = symbianCodePrefix + qtCode; - newLoc.symbianLanguageCode = generator->project->first(symbianCodeVariable); - if (!newLoc.symbianLanguageCode.isEmpty()) { - newLoc.qtLanguageCode = qtCode; - symbianLocalizationList->append(newLoc); - } - } -} - -void SymbianCommonGenerator::parsePreRules(const QString &deploymentVariable, - const QString &variableSuffix, - QStringList *rawRuleList, - QStringList *languageRuleList, - QStringList *headerRuleList, - QStringList *vendorRuleList) -{ - QMakeProject *project = generator->project; - foreach(QString pkgrulesItem, project->values(deploymentVariable + ".pkg_prerules" + variableSuffix)) { - QStringList pkgrulesValue = project->values(pkgrulesItem); - // If there is no stringlist defined for a rule, use rule name directly - // This is convenience for defining single line statements - if (pkgrulesValue.isEmpty()) { - if (pkgrulesItem.startsWith("&")) - *languageRuleList << pkgrulesItem; - else if (pkgrulesItem.startsWith("#")) - *headerRuleList << pkgrulesItem; - else if (pkgrulesItem.startsWith("%") || pkgrulesItem.startsWith(":")) - *vendorRuleList << pkgrulesItem; - else - *rawRuleList << pkgrulesItem; - } else { - if (containsStartWithItem('&', pkgrulesValue)) { - foreach(QString pkgrule, pkgrulesValue) { - *languageRuleList << pkgrule; - } - } else if (containsStartWithItem('#', pkgrulesValue)) { - foreach(QString pkgrule, pkgrulesValue) { - *headerRuleList << pkgrule; - } - } else if (containsStartWithItem('%', pkgrulesValue) - || containsStartWithItem(':', pkgrulesValue)) { - foreach(QString pkgrule, pkgrulesValue) { - *vendorRuleList << pkgrule; - } - } else { - foreach(QString pkgrule, pkgrulesValue) { - *rawRuleList << pkgrule; - } - } - } - } -} - -void SymbianCommonGenerator::parsePostRules(const QString &deploymentVariable, - const QString &variableSuffix, - QStringList *rawRuleList) -{ - QMakeProject *project = generator->project; - foreach(QString pkgrulesItem, project->values(deploymentVariable + ".pkg_postrules" + variableSuffix)) { - QStringList pkgrulesValue = project->values(pkgrulesItem); - // If there is no stringlist defined for a rule, use rule name directly - // This is convenience for defining single line statements - if (pkgrulesValue.isEmpty()) { - *rawRuleList << pkgrulesItem; - } else { - foreach(QString pkgrule, pkgrulesValue) { - *rawRuleList << pkgrule; - } - } - } -} - -bool SymbianCommonGenerator::parseTsContent(const QString &tsFilename, SymbianLocalization *loc) -{ - bool retval = true; - QMakeProject *project = generator->project; - QFile tsFile(tsFilename); - - if (tsFile.exists()) { - if (tsFile.open(QIODevice::ReadOnly)) { - static QString applicationCaptionsContext = QLatin1String("QtApplicationCaptions"); - static QString pkgNameContext = QLatin1String("QtPackageNames"); - static QString tsElement = QLatin1String("TS"); - static QString contextElement = QLatin1String("context"); - static QString nameElement = QLatin1String("name"); - static QString messageElement = QLatin1String("message"); - static QString sourceElement = QLatin1String("source"); - static QString translationElement = QLatin1String("translation"); - static QString shortCaptionId = QLatin1String("Application short caption"); - static QString longCaptionId = QLatin1String("Application long caption"); - static QString pkgDisplayNameId = QLatin1String("Package name"); - static QString installerPkgDisplayNameId = QLatin1String("Smart installer package name"); - static QString languageAttribute = QLatin1String("language"); - static QChar underscoreChar = QLatin1Char('_'); - - enum CurrentContext { - ContextUnknown, - ContextUninteresting, - ContextInteresting - }; - - QXmlStreamReader xml(&tsFile); - - while (!xml.atEnd() && xml.name() != tsElement) - xml.readNextStartElement(); - - while (xml.readNextStartElement()) { - if (xml.name() == contextElement) { - CurrentContext currentContext = ContextUnknown; - while (xml.readNextStartElement()) { - if (currentContext == ContextUnknown) { - // Expect name element before message elements - if (xml.name() == nameElement) { - QString nameText = xml.readElementText(); - if (nameText == applicationCaptionsContext || nameText == pkgNameContext) { - currentContext = ContextInteresting; - } else { - currentContext = ContextUninteresting; - } - } else { - xml.skipCurrentElement(); - } - } else if (currentContext == ContextInteresting) { - if (xml.name() == messageElement) { - QString source; - QString translation; - while (xml.readNextStartElement()) { - if (xml.name() == sourceElement) { - source = xml.readElementText(); - } else if (xml.name() == translationElement) { - translation = xml.readElementText(); - } else { - xml.skipCurrentElement(); - } - } - - if (source == shortCaptionId) { - if (loc->shortCaption.isEmpty()) { - loc->shortCaption = translation; - } else { - fprintf(stderr, "Warning: Duplicate application short caption defined in (%s).\n", - qPrintable(tsFilename)); - } - } else if (source == longCaptionId) { - if (loc->longCaption.isEmpty()) { - loc->longCaption = translation; - } else { - fprintf(stderr, "Warning: Duplicate application long caption defined in (%s).\n", - qPrintable(tsFilename)); - } - } else if (source == pkgDisplayNameId) { - if (loc->pkgDisplayName.isEmpty()) { - loc->pkgDisplayName = translation; - } else { - fprintf(stderr, "Warning: Duplicate package display name defined in (%s).\n", - qPrintable(tsFilename)); - } - } else if (source == installerPkgDisplayNameId) { - if (loc->installerPkgDisplayName.isEmpty()) { - loc->installerPkgDisplayName = translation; - } else { - fprintf(stderr, "Warning: Duplicate smart installer package display name defined in (%s).\n", - qPrintable(tsFilename)); - } - } - } else { - xml.skipCurrentElement(); - } - } else { - xml.skipCurrentElement(); - } - } - } else { - xml.skipCurrentElement(); - } - } - if (xml.hasError()) { - retval = false; - fprintf(stderr, "ERROR: Encountered error \"%s\" when parsing ts file (%s).\n", - qPrintable(xml.errorString()), qPrintable(tsFilename)); - } - } else { - retval = false; - fprintf(stderr, "Warning: Could not open ts file (%s).\n", qPrintable(tsFilename)); - } - } else { - retval = false; - fprintf(stderr, "Warning: ts file does not exist: (%s), unable to parse it.\n", - qPrintable(tsFilename)); - } - - return retval; -} - -QString SymbianCommonGenerator::generatePkgNameForHeader(const SymbianLocalizationList &symbianLocalizationList, - const QString &defaultName, - bool isForSmartInstaller) -{ - QStringList allNames; - QString noTranslation = defaultName; - - if (isForSmartInstaller) - noTranslation += QLatin1String(" installer"); - - SymbianLocalizationListIterator iter(symbianLocalizationList); - while (iter.hasNext()) { - const SymbianLocalization &loc = iter.next(); - QString currentName; - if (isForSmartInstaller) { - currentName = loc.installerPkgDisplayName; - } else { - currentName = loc.pkgDisplayName; - } - - if (currentName.isEmpty()) - currentName = noTranslation; - - allNames << currentName; - } - - if (!allNames.size()) - allNames << noTranslation; - - return allNames.join("\",\""); - -} - -void SymbianCommonGenerator::addLocalizedResourcesToDeployment(const QString &deploymentFilesVar, - const SymbianLocalizationList &symbianLocalizationList) -{ - QStringList locResources; - foreach (QString defaultResource, generator->project->values(deploymentFilesVar)) { - if (defaultResource.endsWith(".rsc")) { - defaultResource.chop(2); - SymbianLocalizationListIterator iter(symbianLocalizationList); - while (iter.hasNext()) { - const SymbianLocalization &loc = iter.next(); - locResources << QString(defaultResource + loc.symbianLanguageCode); - } - } - } - generator->project->values(deploymentFilesVar) << locResources; -} - -QString SymbianCommonGenerator::generateLocFileName() -{ - QString fileName(fixedTarget); - if (!Option::output_dir.isEmpty()) - fileName = Option::output_dir + QLatin1Char('/') + fileName; - fileName.append(".loc"); - return fileName; -} diff --git a/qmake/generators/symbian/symbiancommon.h b/qmake/generators/symbian/symbiancommon.h deleted file mode 100644 index 8402e13647..0000000000 --- a/qmake/generators/symbian/symbiancommon.h +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SYMBIANCOMMON_H -#define SYMBIANCOMMON_H - -#include <project.h> -#include <makefile.h> -#include "initprojectdeploy_symbian.h" - -#define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename)); - -class SymbianLocalization -{ -public: - QString qtLanguageCode; - QString symbianLanguageCode; - QString shortCaption; - QString longCaption; - QString pkgDisplayName; - QString installerPkgDisplayName; -}; - -typedef QList<SymbianLocalization> SymbianLocalizationList; -typedef QListIterator<SymbianLocalization> SymbianLocalizationListIterator; - -class SymbianCommonGenerator -{ -public: - enum TargetType { - TypeExe, - TypeDll, - TypeLib, - TypePlugin, - TypeSubdirs - }; - - - SymbianCommonGenerator(MakefileGenerator *generator); - - virtual void init(); - -protected: - - QString removePathSeparators(QString &file); - void removeSpecialCharacters(QString& str); - void generatePkgFile(const QString &iconFile, - bool epocBuild, - const SymbianLocalizationList &symbianLocalizationList); - bool containsStartWithItem(const QChar &c, const QStringList& src); - - void writeRegRssFile(QMap<QString, QStringList> &useritems); - void writeRegRssList(QTextStream &t, QStringList &userList, - const QString &listTag, - const QString &listItem); - void writeRssFile(QString &numberOfIcons, QString &iconfile); - void writeLocFile(const SymbianLocalizationList &symbianLocalizationList); - void readRssRules(QString &numberOfIcons, - QString &iconFile, - QMap<QString, QStringList> &userRssRules); - - void writeCustomDefFile(); - - void parseTsFiles(SymbianLocalizationList *symbianLocalizationList); - void fillQt2SymbianLocalizationList(SymbianLocalizationList *symbianLocalizationList); - - void parsePreRules(const QString &deploymentVariable, - const QString &variableSuffix, - QStringList *rawRuleList, - QStringList *languageRuleList, - QStringList *headerRuleList, - QStringList *vendorRuleList); - void parsePostRules(const QString &deploymentVariable, - const QString &variableSuffix, - QStringList *rawRuleList); - bool parseTsContent(const QString &tsFilename, SymbianLocalization *loc); - QString generatePkgNameForHeader(const SymbianLocalizationList &symbianLocalizationList, - const QString &defaultName, - bool isForSmartInstaller); - void addLocalizedResourcesToDeployment(const QString &deploymentFilesVar, - const SymbianLocalizationList &symbianLocalizationList); - QString generateLocFileName(); - - -protected: - MakefileGenerator *generator; - - QStringList generatedFiles; - QStringList generatedDirs; - QString fixedTarget; - QString privateDirUid; - QString uid3; - TargetType targetType; -}; - -#endif // SYMBIANCOMMON_H diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp deleted file mode 100644 index 8bf217616c..0000000000 --- a/qmake/generators/symbian/symmake.cpp +++ /dev/null @@ -1,1136 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "symmake.h" - -#include <qstring.h> -#include <qhash.h> -#include <qstringlist.h> -#include <qdir.h> -#include <qdatetime.h> -#include <stdlib.h> -#include <qdebug.h> - -// Included from tools/shared -#include <symbian/epocroot_p.h> - -#define RESOURCE_DIRECTORY_MMP "/resource/apps" -#define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" -#define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def" -#define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1) - -#define BLD_INF_RULES_BASE "BLD_INF_RULES." -#define BLD_INF_TAG_PLATFORMS "prj_platforms" -#define BLD_INF_TAG_MMPFILES "prj_mmpfiles" -#define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" -#define BLD_INF_TAG_EXTENSIONS "prj_extensions" -#define BLD_INF_TAG_TESTEXTENSIONS "prj_testextensions" - -#define MMP_TARGET "TARGET" -#define MMP_TARGETTYPE "TARGETTYPE" -#define MMP_SECUREID "SECUREID" -#define MMP_OPTION "OPTION" -#define MMP_LINKEROPTION "LINKEROPTION" -#define MMP_CAPABILITY "CAPABILITY" -#define MMP_EPOCALLOWDLLDATA "EPOCALLOWDLLDATA" -#define MMP_EPOCHEAPSIZE "EPOCHEAPSIZE" -#define MMP_EPOCSTACKSIZE "EPOCSTACKSIZE" -#define MMP_UID "UID" -#define MMP_VENDORID "VENDORID" -#define MMP_VERSION "VERSION" -#define MMP_START_RESOURCE "START RESOURCE" -#define MMP_END_RESOURCE "END" - -#define VAR_CXXFLAGS "QMAKE_CXXFLAGS" -#define VAR_CFLAGS "QMAKE_CFLAGS" -#define VAR_LFLAGS "QMAKE_LFLAGS" - -#define DEFINE_REPLACE_REGEXP "[^A-Z0-9_]" - -QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) -{ - static QString epocRootStr; - if (epocRootStr.isEmpty()) { - epocRootStr = qt_epocRoot(); - QFileInfo efi(epocRootStr); - if (!efi.exists() || epocRootStr.isEmpty()) { - fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(qt_epocRoot())); - epocRootStr = "/"; - } else { - epocRootStr = efi.absoluteFilePath(); - } - if (!epocRootStr.endsWith("/")) - epocRootStr += "/"; - - epocRootStr += "epoc32/"; - } - - QString resultPath = origPath; - - // Make it relative, unless it starts with "%epocroot%/epoc32/" - if (resultPath.startsWith(epocRootStr, Qt::CaseInsensitive)) { - resultPath.replace(epocRootStr, "/epoc32/", Qt::CaseInsensitive); - } else { - resultPath = parentDir.relativeFilePath(resultPath); - } - resultPath = QDir::cleanPath(resultPath); - - if (resultPath.isEmpty()) - resultPath = "."; - - return resultPath; -} - -QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) -{ - // Prepend epocroot to any paths beginning with "/epoc32/" - QString resultPath = QDir::fromNativeSeparators(origPath); - if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) - resultPath = QDir::fromNativeSeparators(qt_epocRoot()) + resultPath.mid(1); - - QFileInfo fi(fileInfo(resultPath)); - - // Since origPath can be something given in HEADERS, we need to check if we are dealing - // with a file or a directory. In case the origPath doesn't yet exist, isFile() returns - // false and we default to assuming it is a dir. - if (fi.isFile()) { - resultPath = fi.absolutePath(); - } else { - resultPath = fi.absoluteFilePath(); - } - - resultPath = QDir::cleanPath(resultPath); - - return resultPath; -} - -SymbianMakefileGenerator::SymbianMakefileGenerator() : MakefileGenerator(), SymbianCommonGenerator(this) { } -SymbianMakefileGenerator::~SymbianMakefileGenerator() { } - -void SymbianMakefileGenerator::writeHeader(QTextStream &t) -{ - t << "// ============================================================================" << endl; - t << "// * Makefile for building: " << escapeFilePath(var("TARGET")) << endl; - t << "// * Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; - t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; - t << "// * This file is generated by qmake and should not be modified by the" << endl; - t << "// * user." << endl; - t << "// * Project: " << fileFixify(project->projectFile()) << endl; - t << "// * Template: " << var("TEMPLATE") << endl; - t << "// ============================================================================" << endl; - t << endl; - - // Defining define for bld.inf - - QString shortProFilename = project->projectFile(); - shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); - shortProFilename.replace(Option::pro_ext, QString("")); - - QString bldinfDefine = shortProFilename; - bldinfDefine.append("_"); - bldinfDefine.append(generate_uid(project->projectFile())); - bldinfDefine = bldinfDefine.toUpper(); - - // replace anything not alphanumeric with underscore - QRegExp replacementMask(DEFINE_REPLACE_REGEXP); - bldinfDefine.replace(replacementMask, QLatin1String("_")); - - bldinfDefine.prepend("BLD_INF_"); - - t << "#define " << bldinfDefine << endl << endl; -} - -bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) -{ - if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { - fprintf(stderr, "Project files not generated because all requirements are not met:\n\t%s\n", - qPrintable(var("QMAKE_FAILED_REQUIREMENTS"))); - return false; - } - - writeHeader(t); - - QString numberOfIcons; - QString iconFile; - QMap<QString, QStringList> userRssRules; - readRssRules(numberOfIcons, iconFile, userRssRules); - - SymbianLocalizationList symbianLocalizationList; - parseTsFiles(&symbianLocalizationList); - - // Generate pkg files if there are any actual files to deploy - bool generatePkg = false; - - if (targetType == TypeExe) { - generatePkg = true; - } else { - foreach(QString item, project->values("DEPLOYMENT")) { - // ### Qt 5: remove .sources, inconsistent with INSTALLS - if (!project->values(item + ".sources").isEmpty() || - !project->values(item + ".files").isEmpty()) { - generatePkg = true; - break; - } - } - } - - if (generatePkg) { - generatePkgFile(iconFile, true, symbianLocalizationList); - } - - writeBldInfContent(t, generatePkg, iconFile); - - // Generate empty wrapper makefile here, because wrapper makefile must exist before writeMkFile, - // but all required data is not yet available. - bool isPrimaryMakefile = true; - QString wrapperFileName = Option::output_dir + QLatin1Char('/') + QLatin1String("Makefile"); - QString outputFileName = fileInfo(Option::output.fileName()).fileName(); - if (outputFileName != BLD_INF_FILENAME) { - wrapperFileName.append(".").append(outputFileName.startsWith(BLD_INF_FILENAME) - ? outputFileName.mid(sizeof(BLD_INF_FILENAME)) - : outputFileName); - isPrimaryMakefile = false; - } - - QFile wrapperMakefile(wrapperFileName); - if (wrapperMakefile.open(QIODevice::WriteOnly)) { - generatedFiles << wrapperFileName; - } else { - PRINT_FILE_CREATE_ERROR(wrapperFileName); - return false; - } - - if (targetType == TypeSubdirs) { - // If we have something to deploy, generate extension makefile for just that, since - // normal extension makefile is not getting generated and we need emulator deployment to be done. - if (generatePkg) - writeMkFile(wrapperFileName, true); - writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); - return true; - } - - writeMkFile(wrapperFileName, false); - - QString absoluteMmpFileName = Option::output_dir + QLatin1Char('/') + mmpFileName; - writeMmpFile(absoluteMmpFileName, symbianLocalizationList); - - if (targetType == TypeExe) { - if (!project->isActiveConfig("no_icon")) { - writeRegRssFile(userRssRules); - writeRssFile(numberOfIcons, iconFile); - writeLocFile(symbianLocalizationList); - } - } - - writeCustomDefFile(); - writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); - - return true; -} - -void SymbianMakefileGenerator::init() -{ - MakefileGenerator::init(); - SymbianCommonGenerator::init(); - - if (0 != project->values("QMAKE_PLATFORM").size()) - platform = varGlue("QMAKE_PLATFORM", "", " ", ""); - - if (0 == project->values("QMAKESPEC").size()) - project->values("QMAKESPEC").append(qgetenv("QMAKESPEC")); - - project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); - project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); - - // Disallow renaming of bld.inf. - project->values("MAKEFILE").clear(); - project->values("MAKEFILE") += BLD_INF_FILENAME; - - // .mmp - mmpFileName = fixedTarget; - if (targetType == TypeExe) - mmpFileName.append("_exe"); - else if (targetType == TypeDll || targetType == TypePlugin) - mmpFileName.append("_dll"); - else if (targetType == TypeLib) - mmpFileName.append("_lib"); - mmpFileName.append(Option::mmp_ext); - - initMmpVariables(); - - uid2 = project->first("TARGET.UID2"); - - uid2 = uid2.trimmed(); -} - -QString SymbianMakefileGenerator::getTargetExtension() -{ - QString ret; - if (targetType == TypeExe) { - ret.append("exe"); - } else if (targetType == TypeLib) { - ret.append("lib"); - } else if (targetType == TypeDll || targetType == TypePlugin) { - ret.append("dll"); - } else if (targetType == TypeSubdirs) { - // Not actually usable, so return empty - } else { - // If nothing else set, default to exe - ret.append("exe"); - } - - return ret; -} - -QString SymbianMakefileGenerator::generateUID3() -{ - QString target = project->first("TARGET"); - QString currPath = qmake_getpwd(); - target.prepend("/").prepend(currPath); - return generate_test_uid(target); -} - -void SymbianMakefileGenerator::initMmpVariables() -{ - QStringList sysincspaths; - QStringList srcincpaths; - QStringList srcpaths; - - srcpaths << project->values("SOURCES") << project->values("GENERATED_SOURCES"); - srcpaths << project->values("UNUSED_SOURCES") << project->values("UI_SOURCES_DIR"); - srcpaths << project->values("UI_DIR"); - - QDir current = QDir::current(); - QString absolutizedCurrent = absolutizePath("."); - - for (int j = 0; j < srcpaths.size(); ++j) { - QFileInfo fi(fileInfo(srcpaths.at(j))); - // Sometimes sources have other than *.c* files (e.g. *.moc); prune them. - if (fi.suffix().startsWith("c")) { - if (fi.filePath().length() > fi.fileName().length()) { - appendIfnotExist(srcincpaths, fi.path()); - sources[absolutizePath(fi.path())] += fi.fileName(); - } else { - sources[absolutizedCurrent] += fi.fileName(); - appendIfnotExist(srcincpaths, absolutizedCurrent); - } - } - } - - QStringList incpaths; - incpaths << project->values("INCLUDEPATH"); - incpaths << QLibraryInfo::location(QLibraryInfo::HeadersPath); - incpaths << project->values("HEADERS"); - incpaths << srcincpaths; - incpaths << project->values("UI_HEADERS_DIR"); - incpaths << project->values("UI_DIR"); - - for (int j = 0; j < incpaths.size(); ++j) { - QString includepath = absolutizePath(incpaths.at(j)); - appendIfnotExist(sysincspaths, includepath); - appendAbldTempDirs(sysincspaths, includepath); - } - - // Remove duplicate include path entries - QStringList temporary; - for (int i = 0; i < sysincspaths.size(); ++i) { - QString origPath = sysincspaths.at(i); - QFileInfo origPathInfo(fileInfo(origPath)); - bool bFound = false; - - for (int j = 0; j < temporary.size(); ++j) { - QString tmpPath = temporary.at(j); - QFileInfo tmpPathInfo(fileInfo(tmpPath)); - - if (origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { - bFound = true; - if (!tmpPathInfo.isRelative() && origPathInfo.isRelative()) { - // We keep the relative notation - temporary.removeOne(tmpPath); - temporary << origPath; - } - } - } - - if (!bFound) - temporary << origPath; - - } - - sysincspaths.clear(); - sysincspaths << temporary; - - systeminclude.insert("SYSTEMINCLUDE", sysincspaths); - - // Check MMP_RULES for singleton keywords that are overridden - QStringList overridableMmpKeywords; - QStringList restrictableMmpKeywords; - QStringList restrictedMmpKeywords; - bool inResourceBlock = false; - - overridableMmpKeywords << QLatin1String(MMP_TARGETTYPE) << QLatin1String(MMP_EPOCHEAPSIZE); - restrictableMmpKeywords << QLatin1String(MMP_TARGET) << QLatin1String(MMP_SECUREID) - << QLatin1String(MMP_OPTION) << QLatin1String(MMP_LINKEROPTION) - << QLatin1String(MMP_CAPABILITY) << QLatin1String(MMP_EPOCALLOWDLLDATA) - << QLatin1String(MMP_EPOCSTACKSIZE) << QLatin1String(MMP_UID) - << QLatin1String(MMP_VENDORID) << QLatin1String(MMP_VERSION); - - foreach (QString item, project->values("MMP_RULES")) { - if (project->values(item).isEmpty()) { - handleMmpRulesOverrides(item, inResourceBlock, restrictedMmpKeywords, - restrictableMmpKeywords, overridableMmpKeywords); - } else { - foreach (QString itemRow, project->values(item)) { - handleMmpRulesOverrides(itemRow, inResourceBlock, restrictedMmpKeywords, - restrictableMmpKeywords, overridableMmpKeywords); - } - } - } - - if (restrictedMmpKeywords.size()) { - fprintf(stderr, "Warning: Restricted statements detected in MMP_RULES:\n" - " (%s)\n" - " Use corresponding qmake variable(s) instead.\n", - qPrintable(restrictedMmpKeywords.join(", "))); - } -} - -void SymbianMakefileGenerator::handleMmpRulesOverrides(QString &checkString, - bool &inResourceBlock, - QStringList &restrictedMmpKeywords, - const QStringList &restrictableMmpKeywords, - const QStringList &overridableMmpKeywords) -{ - QString simplifiedString = checkString.simplified(); - - if (!inResourceBlock && simplifiedString.startsWith(MMP_START_RESOURCE, Qt::CaseInsensitive)) - inResourceBlock = true; - else if (inResourceBlock && simplifiedString.startsWith(MMP_END_RESOURCE, Qt::CaseInsensitive)) - inResourceBlock = false; - - // Allow restricted and overridable items in RESOURCE blocks as those do not actually - // override anything. - if (!inResourceBlock) { - appendKeywordIfMatchFound(overriddenMmpKeywords, overridableMmpKeywords, simplifiedString); - appendKeywordIfMatchFound(restrictedMmpKeywords, restrictableMmpKeywords, simplifiedString); - } -} - -void SymbianMakefileGenerator::appendKeywordIfMatchFound(QStringList &list, - const QStringList &keywordList, - QString &checkString) -{ - // Check if checkString starts with any supplied keyword and - // add the found keyword to list if it does. - foreach (QString item, keywordList) { - if (checkString.startsWith(QString(item).append(" "), Qt::CaseInsensitive) - || checkString.compare(item, Qt::CaseInsensitive) == 0) { - appendIfnotExist(list, item); - } - } -} - - -bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList &stringList) -{ - QStringList tmpStringList; - - for (int i = 0; i < stringList.size(); ++i) { - QString string = stringList.at(i); - if (tmpStringList.contains(string)) - continue; - else - tmpStringList.append(string); - } - - stringList.clear(); - stringList = tmpStringList; - return true; -} - -void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t) -{ - t << "// ==============================================================================" << endl; - t << "// Generated by qmake (" << qmake_version() << ") (Qt " QT_VERSION_STR ") on: "; - t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; - t << "// This file is generated by qmake and should not be modified by the" << endl; - t << "// user." << endl; - t << "// Name : " << mmpFileName << endl; - t << "// ==============================================================================" << endl << endl; -} - -void SymbianMakefileGenerator::writeMmpFile(QString &filename, const SymbianLocalizationList &symbianLocalizationList) -{ - QFile ft(filename); - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - - QTextStream t(&ft); - - writeMmpFileHeader(t); - - writeMmpFileTargetPart(t); - - writeMmpFileResourcePart(t, symbianLocalizationList); - - writeMmpFileMacrosPart(t); - - writeMmpFileIncludePart(t); - - QDir current = QDir::current(); - - for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { - QStringList values = it.value(); - QString currentSourcePath = it.key(); - - if (values.size()) - t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, current) << endl; - - for (int i = 0; i < values.size(); ++i) { - QString sourceFileName = values.at(i); - t << "SOURCE\t\t" << sourceFileName << endl; - } - t << endl; - } - t << endl; - - if (!project->isActiveConfig("static") && !project->isActiveConfig("staticlib")) { - writeMmpFileLibraryPart(t); - } - - writeMmpFileCapabilityPart(t); - - writeMmpFileCompilerOptionPart(t); - - writeMmpFileBinaryVersionPart(t); - - writeMmpFileRulesPart(t); - } else { - PRINT_FILE_CREATE_ERROR(filename) - } -} - -void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) -{ - t << endl; - - QStringList &defines = project->values("DEFINES"); - if (defines.size()) - t << "// Qt Macros" << endl; - for (int i = 0; i < defines.size(); ++i) { - QString def = defines.at(i); - addMacro(t, def); - } - - // These are required in order that all methods will be correctly exported e.g from qtestlib - QStringList &exp_defines = project->values("PRL_EXPORT_DEFINES"); - if (exp_defines.size()) - t << endl << "// Qt Export Defines" << endl; - for (int i = 0; i < exp_defines.size(); ++i) { - QString def = exp_defines.at(i); - addMacro(t, def); - } - - t << endl; -} - -void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) -{ - t << "MACRO\t\t" << value << endl; -} - - -void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) -{ - bool skipTargetType = overriddenMmpKeywords.contains(MMP_TARGETTYPE); - bool skipEpocHeapSize = overriddenMmpKeywords.contains(MMP_EPOCHEAPSIZE); - - if (targetType == TypeExe) { - t << MMP_TARGET "\t\t" << fixedTarget << ".exe" << endl; - if (!skipTargetType) { - if (project->isActiveConfig("stdbinary")) - t << MMP_TARGETTYPE "\t\tSTDEXE" << endl; - else - t << MMP_TARGETTYPE "\t\tEXE" << endl; - } - } else if (targetType == TypeDll || targetType == TypePlugin) { - t << MMP_TARGET "\t\t" << fixedTarget << ".dll" << endl; - if (!skipTargetType) { - if (project->isActiveConfig("stdbinary")) - t << MMP_TARGETTYPE "\t\tSTDDLL" << endl; - else - t << MMP_TARGETTYPE "\t\tDLL" << endl; - } - } else if (targetType == TypeLib) { - t << MMP_TARGET "\t\t" << fixedTarget << ".lib" << endl; - if (!skipTargetType) { - if (project->isActiveConfig("stdbinary")) - t << MMP_TARGETTYPE "\t\tSTDLIB" << endl; - else - t << MMP_TARGETTYPE "\t\tLIB" << endl; - } - } else { - fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType); - } - - t << endl; - - t << MMP_UID "\t\t" << uid2 << " " << uid3 << endl; - - if (0 != project->values("TARGET.SID").size()) { - t << MMP_SECUREID "\t\t" << project->values("TARGET.SID").join(" ") << endl; - } else { - if (0 == uid3.size()) - t << MMP_SECUREID "\t\t0" << endl; - else - t << MMP_SECUREID "\t\t" << uid3 << endl; - } - - // default value used from mkspecs is 0 - if (0 != project->values("TARGET.VID").size()) { - t << MMP_VENDORID "\t\t" << project->values("TARGET.VID").join(" ") << endl; - } - - t << endl; - - if (0 != project->first("TARGET.EPOCSTACKSIZE").size()) - t << MMP_EPOCSTACKSIZE "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; - if (!skipEpocHeapSize && 0 != project->values("TARGET.EPOCHEAPSIZE").size()) - t << MMP_EPOCHEAPSIZE "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; - if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) - t << MMP_EPOCALLOWDLLDATA << endl; - - if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) { - // Use custom def file for Qt plugins - t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; - } - - t << endl; -} - - -/* - Application registration resource files should be installed to the - \private\10003a3f\import\apps directory. -*/ -void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, const SymbianLocalizationList &symbianLocalizationList) -{ - if ((targetType == TypeExe) && - !project->isActiveConfig("no_icon")) { - - QString locTarget = fixedTarget; - locTarget.append(".rss"); - - t << "SOURCEPATH\t\t\t. " << endl; - t << "LANG SC "; // no endl - SymbianLocalizationListIterator iter(symbianLocalizationList); - while (iter.hasNext()) { - const SymbianLocalization &loc = iter.next(); - t << loc.symbianLanguageCode << " "; // no endl - } - t << endl; - t << MMP_START_RESOURCE "\t\t" << locTarget << endl; - t << "HEADER" << endl; - t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; - t << MMP_END_RESOURCE << endl << endl; - - QString regTarget = fixedTarget; - regTarget.append("_reg.rss"); - - t << "SOURCEPATH\t\t\t." << endl; - t << MMP_START_RESOURCE "\t\t" << regTarget << endl; - if (isForSymbianSbsv2()) - t << "DEPENDS " << fixedTarget << ".rsg" << endl; - t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl; - t << MMP_END_RESOURCE << endl << endl; - } -} - -void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) -{ - QDir current = QDir::current(); - - for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { - QStringList values = it.value(); - for (int i = 0; i < values.size(); ++i) { - QString handledPath = values.at(i); - t << "SYSTEMINCLUDE\t\t" << fixPathForMmp(handledPath, current) << endl; - } - } - - t << endl; -} - -void SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) -{ - writeMmpFileSystemIncludePart(t); -} - -void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) -{ - QStringList &libs = project->values("LIBS"); - libs << project->values("QMAKE_LIBS") << project->values("QMAKE_LIBS_PRIVATE"); - - removeDuplicatedStrings(libs); - - for (int i = 0; i < libs.size(); ++i) { - QString lib = libs.at(i); - // The -L flag is uninteresting, since all symbian libraries exist in the same directory. - if (lib.startsWith("-l")) { - lib.remove(0, 2); - QString mmpStatement; - if (lib.endsWith(".lib")) { - lib.chop(4); - mmpStatement = "STATICLIBRARY\t"; - } else { - if (lib.endsWith(".dll")) - lib.chop(4); - mmpStatement = "LIBRARY\t\t"; - } - t << mmpStatement << lib << ".lib" << endl; - } - } - - t << endl; -} - -void SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) -{ - if (0 != project->first("TARGET.CAPABILITY").size()) { - QStringList &capabilities = project->values("TARGET.CAPABILITY"); - t << MMP_CAPABILITY "\t\t"; - - for (int i = 0; i < capabilities.size(); ++i) { - QString cap = capabilities.at(i); - t << cap << " "; - } - } else { - t << MMP_CAPABILITY "\t\tNone"; - } - t << endl << endl; -} - -void SymbianMakefileGenerator::writeMmpFileConditionalOptions(QTextStream& t, - const QString &optionType, - const QString &optionTag, - const QString &variableBase) -{ - foreach(QString compilerVersion, project->values("VERSION_FLAGS." + optionTag)) { - QStringList currentValues = project->values(variableBase + "." + compilerVersion); - if (currentValues.size()) { - t << "#if defined(" << compilerVersion << ")" << endl; - t << optionType << " " << optionTag << " " << currentValues.join(" ") << endl; - t << "#endif" << endl; - } - } -} - -void SymbianMakefileGenerator::writeMmpFileSimpleOption(QTextStream& t, - const QString &optionType, - const QString &optionTag, - const QString &options) -{ - QString trimmedOptions = options.trimmed(); - if (!trimmedOptions.isEmpty()) - t << optionType << " " << optionTag << " " << trimmedOptions << endl; -} - -void SymbianMakefileGenerator::appendMmpFileOptions(QString &options, const QStringList &list) -{ - if (list.size()) { - options.append(list.join(" ")); - options.append(" "); - } -} - -void SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) -{ - QStringList keywords = project->values("MMP_OPTION_KEYWORDS"); - QStringList commonCxxFlags = project->values(VAR_CXXFLAGS); - QStringList commonCFlags = project->values(VAR_CFLAGS); - QStringList commonLFlags = project->values(VAR_LFLAGS); - - foreach(QString item, keywords) { - QString compilerOption; - QString linkerOption; - - appendMmpFileOptions(compilerOption, project->values(VAR_CXXFLAGS "." + item)); - appendMmpFileOptions(compilerOption, project->values(VAR_CFLAGS "." + item)); - appendMmpFileOptions(compilerOption, commonCxxFlags); - appendMmpFileOptions(compilerOption, commonCFlags); - - appendMmpFileOptions(linkerOption, project->values(VAR_LFLAGS "." + item)); - appendMmpFileOptions(linkerOption, commonLFlags); - - writeMmpFileSimpleOption(t, MMP_OPTION, item, compilerOption); - writeMmpFileSimpleOption(t, MMP_LINKEROPTION, item, linkerOption); - - writeMmpFileConditionalOptions(t, MMP_OPTION, item, VAR_CXXFLAGS); - writeMmpFileConditionalOptions(t, MMP_LINKEROPTION, item, VAR_LFLAGS); - } - - t << endl; -} - -void SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) -{ - QString applicationVersion = project->first("VERSION"); - QStringList verNumList = applicationVersion.split('.'); - uint major = 0; - uint minor = 0; - uint patch = 0; - bool success = false; - - if (verNumList.size() > 0) { - major = verNumList[0].toUInt(&success); - if (success && verNumList.size() > 1) { - minor = verNumList[1].toUInt(&success); - if (success && verNumList.size() > 2) { - patch = verNumList[2].toUInt(&success); - } - } - } - - QString mmpVersion; - if (success && major <= 0xFFFF && minor <= 0xFF && patch <= 0xFF) { - // Symbian binary version only has major and minor components, so compress - // Qt's minor and patch values into the minor component. Since Symbian's minor - // component is a 16 bit value, only allow 8 bits for each to avoid overflow. - mmpVersion.append(QString::number(major)) - .append('.') - .append(QString::number((minor << 8) + patch)); - } else { - if (!applicationVersion.isEmpty()) - fprintf(stderr, "Invalid VERSION string: %s\n", qPrintable(applicationVersion)); - mmpVersion = "10.0"; // Default binary version for symbian is 10.0 - } - - t << MMP_VERSION " " << mmpVersion << endl; -} - -void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) -{ - foreach(QString item, project->values("MMP_RULES")) { - t << endl; - // If there is no stringlist defined for a rule, use rule name directly - // This is convenience for defining single line mmp statements - if (project->values(item).isEmpty()) { - t << item << endl; - } else { - foreach(QString itemRow, project->values(item)) { - t << itemRow << endl; - } - } - } -} - -void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension, const QString &iconFile) -{ - // Read user defined bld inf rules - - QMap<QString, QStringList> userBldInfRules; - for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { - if (it.key().startsWith(BLD_INF_RULES_BASE)) { - QString newKey = it.key().mid(sizeof(BLD_INF_RULES_BASE) - 1); - if (newKey.isEmpty()) { - fprintf(stderr, "Warning: Empty BLD_INF_RULES key encountered\n"); - continue; - } - QStringList newValues; - QStringList values = it.value(); - foreach(QString item, values) { - // If there is no stringlist defined for a rule, use rule name directly - // This is convenience for defining single line statements - if (project->values(item).isEmpty()) { - newValues << item; - } else { - foreach(QString itemRow, project->values(item)) { - newValues << itemRow; - } - } - } - userBldInfRules.insert(newKey, newValues); - } - } - - // Add includes of subdirs bld.inf files - - QString currentPath = qmake_getpwd(); - QDir directory(currentPath); - - const QStringList &subdirs = project->values("SUBDIRS"); - foreach(QString item, subdirs) { - bool fromFile = false; - QString fixedItem; - if (!project->isEmpty(item + ".file")) { - fixedItem = project->first(item + ".file"); - fromFile = true; - } else if (!project->isEmpty(item + ".subdir")) { - fixedItem = project->first(item + ".subdir"); - fromFile = false; - } else { - fixedItem = item; - fromFile = item.endsWith(Option::pro_ext); - } - - QString condition; - if (!project->isEmpty(item + ".condition")) - condition = project->first(item + ".condition"); - - QFileInfo subdir(fileInfo(fixedItem)); - QString relativePath = directory.relativeFilePath(fixedItem); - QString fullProName = subdir.absoluteFilePath(); - QString bldinfFilename; - QString subdirFileName; - - if (fromFile) { - subdirFileName = subdir.completeBaseName(); - } else { - subdirFileName = subdir.fileName(); - } - - if (subdir.isDir()) { - // Subdir is a regular project - bldinfFilename = relativePath + QString("/") + QString(BLD_INF_FILENAME); - fullProName += QString("/") + subdirFileName + Option::pro_ext; - } else { - // Subdir is actually a .pro file - if (relativePath.contains("/")) { - // .pro not in same directory as parent .pro - relativePath.remove(relativePath.lastIndexOf("/") + 1, relativePath.length()); - bldinfFilename = relativePath; - } else { - // .pro and parent .pro in same directory - bldinfFilename = QString("./"); - } - bldinfFilename += QString(BLD_INF_FILENAME ".") + subdirFileName; - } - - QString uid = generate_uid(fullProName); - QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid; - bldinfDefine = bldinfDefine.toUpper(); - - // replace anything not alphanumeric with underscore - QRegExp replacementMask(DEFINE_REPLACE_REGEXP); - bldinfDefine.replace(replacementMask, QLatin1String("_")); - - if (!condition.isEmpty()) - t << "#if defined(" << condition << ")" << endl; - - t << "#ifndef " << bldinfDefine << endl; - t << "\t#include \"" << bldinfFilename << "\"" << endl; - t << "#endif" << endl; - - if (!condition.isEmpty()) - t << "#endif" << endl; - - } - - // Add supported project platforms - - t << endl << BLD_INF_TAG_PLATFORMS << endl << endl; - if (0 != project->values("SYMBIAN_PLATFORMS").size()) - t << project->values("SYMBIAN_PLATFORMS").join(" ") << endl; - - QStringList userItems = userBldInfRules.value(BLD_INF_TAG_PLATFORMS); - foreach(QString item, userItems) - t << item << endl; - userBldInfRules.remove(BLD_INF_TAG_PLATFORMS); - t << endl; - - // Add project mmps and old style extension makefiles - - QString mmpTag; - if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) - mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); - else - mmpTag = QLatin1String(BLD_INF_TAG_MMPFILES); - - t << endl << mmpTag << endl << endl; - - writeBldInfMkFilePart(t, addDeploymentExtension); - if (targetType != TypeSubdirs) - t << mmpFileName << endl; - - userItems = userBldInfRules.value(mmpTag); - foreach(QString item, userItems) - t << item << endl; - userBldInfRules.remove(mmpTag); - - QString extensionTag; - if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) - extensionTag = QLatin1String(BLD_INF_TAG_TESTEXTENSIONS); - else - extensionTag = QLatin1String(BLD_INF_TAG_EXTENSIONS); - - t << endl << extensionTag << endl << endl; - - // Generate extension rules - - writeBldInfExtensionRulesPart(t, iconFile); - - userItems = userBldInfRules.value(extensionTag); - foreach(QString item, userItems) - t << item << endl; - userBldInfRules.remove(extensionTag); - - // Add rest of the user defined content - - for (QMap<QString, QStringList>::iterator it = userBldInfRules.begin(); it != userBldInfRules.end(); ++it) { - t << endl << endl << it.key() << endl << endl; - userItems = it.value(); - foreach(QString item, userItems) - t << item << endl; - } -} - -void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QString value) -{ - if (!list.contains(value)) - list += value; -} - -void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QStringList values) -{ - foreach(QString item, values) - appendIfnotExist(list, item); -} - - -QString SymbianMakefileGenerator::removeTrailingPathSeparators(QString &file) -{ - QString ret = file; - if (ret.endsWith(QDir::separator())) { - ret.remove(ret.length() - 1, 1); - } - - return ret; -} - -void SymbianMakefileGenerator::generateCleanCommands(QTextStream& t, - const QStringList& toClean, - const QString& cmd, - const QString& cmdOptions, - const QString& itemPrefix, - const QString& itemSuffix) -{ - for (int i = 0; i < toClean.size(); ++i) { - QString item = toClean.at(i); - item.prepend(itemPrefix).append(itemSuffix); -#if defined(Q_OS_WIN) - t << "\t-@ if EXIST \"" << QDir::toNativeSeparators(item) << "\" "; - t << cmd << " " << cmdOptions << " \"" << QDir::toNativeSeparators(item) << "\"" << endl; -#else - t << "\t-if test -e " << QDir::toNativeSeparators(item) << "; then "; - t << cmd << " " << cmdOptions << " " << QDir::toNativeSeparators(item) << "; fi" << endl; -#endif - } -} - -void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) -{ - t << "dodistclean:" << endl; - const QStringList &subdirs = project->values("SUBDIRS"); - foreach(QString item, subdirs) { - bool fromFile = false; - QString fixedItem; - if (!project->isEmpty(item + ".file")) { - fixedItem = project->first(item + ".file"); - fromFile = true; - } else if (!project->isEmpty(item + ".subdir")) { - fixedItem = project->first(item + ".subdir"); - fromFile = false; - } else { - fromFile = item.endsWith(Option::pro_ext); - fixedItem = item; - } - QFileInfo fi(fileInfo(fixedItem)); - if (!fromFile) { - t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.absoluteFilePath() + "/Makefile") << "\" dodistclean" << endl; - } else { - QString itemName = fi.fileName(); - int extIndex = itemName.lastIndexOf(Option::pro_ext); - if (extIndex) - fixedItem = fi.absolutePath() + "/" + QString("Makefile.") + itemName.mid(0, extIndex); - t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl; - } - - } - - generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).absoluteFilePath()); // bld.inf - generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup - generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean - QStringList fixedFiles; - QStringList fixedDirs; - foreach(QString item, generatedFiles) { - QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); - if (!fixedFiles.contains(fixedItem)) { - fixedFiles << fixedItem; - } - } - foreach(QString item, generatedDirs) { - QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); - if (!fixedDirs.contains(fixedItem)) { - fixedDirs << fixedItem; - } - } - generateCleanCommands(t, fixedFiles, "$(DEL_FILE)", "", "", ""); - generateCleanCommands(t, fixedDirs, "$(DEL_DIR)", "", "", ""); - t << endl; - - t << "distclean: clean dodistclean" << endl; - t << endl; -} - -// Returns a string that can be used as a dependency to loc file on other targets -QString SymbianMakefileGenerator::generateLocFileTarget(QTextStream& t, const QString& locCmd) -{ - QString locFile; - if (targetType == TypeExe && !project->isActiveConfig("no_icon")) { - locFile = Option::fixPathToLocalOS(generateLocFileName()); - t << locFile << QLatin1String(": ") << project->values("SYMBIAN_MATCHED_TRANSLATIONS").join(" ") << endl; - t << locCmd << endl; - t << endl; - locFile += QLatin1Char(' '); - } - - return locFile; -} diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h deleted file mode 100644 index 053b2752e4..0000000000 --- a/qmake/generators/symbian/symmake.h +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SYMMAKEFILE_H -#define SYMMAKEFILE_H - -#include "initprojectdeploy_symbian.h" -#include "symbiancommon.h" -#include <makefile.h> - -QT_BEGIN_NAMESPACE - -#define BLD_INF_FILENAME "bld.inf" -#define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t" -#define QT_EXTRA_INCLUDE_DIR "tmp" -#define MAKE_CACHE_NAME ".make.cache" -#define SYMBIAN_TEST_CONFIG "symbian_test" - -class SymbianMakefileGenerator : public MakefileGenerator, public SymbianCommonGenerator -{ -protected: - QString platform; - QString uid2; - QString mmpFileName; - QMap<QString, QStringList> sources; - QMap<QString, QStringList> systeminclude; - QMap<QString, QStringList> library; - // (output file) (source , command) - QMap<QString, QStringList> makmakeCommands; - QStringList overriddenMmpKeywords; - - QString fixPathForMmp(const QString& origPath, const QDir& parentDir); - QString absolutizePath(const QString& origPath); - - virtual bool writeMakefile(QTextStream &t); - - virtual void init(); - - QString getTargetExtension(); - - QString generateUID3(); - - void initMmpVariables(); - void generateMmpFileName(); - void handleMmpRulesOverrides(QString &checkString, - bool &inResourceBlock, - QStringList &restrictedMmpKeywords, - const QStringList &restrictableMmpKeywords, - const QStringList &overridableMmpKeywords); - void appendKeywordIfMatchFound(QStringList &list, - const QStringList &keywordList, - QString &checkString); - - void writeHeader(QTextStream &t); - void writeBldInfContent(QTextStream& t, - bool addDeploymentExtension, - const QString &iconFile); - - static bool removeDuplicatedStrings(QStringList& stringList); - - void writeMmpFileHeader(QTextStream &t); - void writeMmpFile(QString &filename, const SymbianLocalizationList &symbianLocalizationList); - void writeMmpFileMacrosPart(QTextStream& t); - void addMacro(QTextStream& t, const QString& value); - void writeMmpFileTargetPart(QTextStream& t); - void writeMmpFileResourcePart(QTextStream& t, const SymbianLocalizationList &symbianLocalizationList); - void writeMmpFileSystemIncludePart(QTextStream& t); - void writeMmpFileIncludePart(QTextStream& t); - void writeMmpFileLibraryPart(QTextStream& t); - void writeMmpFileCapabilityPart(QTextStream& t); - void writeMmpFileConditionalOptions(QTextStream& t, - const QString &optionType, - const QString &optionTag, - const QString &variableBase); - void writeMmpFileSimpleOption(QTextStream& t, - const QString &optionType, - const QString &optionTag, - const QString &options); - void appendMmpFileOptions(QString &options, const QStringList &list); - void writeMmpFileCompilerOptionPart(QTextStream& t); - void writeMmpFileBinaryVersionPart(QTextStream& t); - void writeMmpFileRulesPart(QTextStream& t); - - void appendIfnotExist(QStringList &list, QString value); - void appendIfnotExist(QStringList &list, QStringList values); - - QString removeTrailingPathSeparators(QString &file); - void generateCleanCommands(QTextStream& t, - const QStringList& toClean, - const QString& cmd, - const QString& cmdOptions, - const QString& itemPrefix, - const QString& itemSuffix); - - void generateDistcleanTargets(QTextStream& t); - QString generateLocFileTarget(QTextStream& t, const QString& locCmd); - - // Subclass implements - virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) = 0; - virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0; - virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0; - virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0; - virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath) = 0; - -public: - - SymbianMakefileGenerator(); - ~SymbianMakefileGenerator(); -}; - -#endif // SYMMAKEFILE_H diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp deleted file mode 100644 index 7863dca731..0000000000 --- a/qmake/generators/symbian/symmake_abld.cpp +++ /dev/null @@ -1,523 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "symmake_abld.h" -#include "initprojectdeploy_symbian.h" - -#include <qstring.h> -#include <qstringlist.h> -#include <qdir.h> -#include <qdatetime.h> -#include <qdebug.h> - -// Included from tools/shared -#include <symbian/epocroot_p.h> - -#define DO_NOTHING_TARGET "do_nothing" -#define CREATE_TEMPS_TARGET "create_temps" -#define EXTENSION_CLEAN "extension_clean" -#define PRE_TARGETDEPS_TARGET "pre_targetdeps" -#define COMPILER_CLEAN_TARGET "compiler_clean" -#define FINALIZE_TARGET "finalize" -#define GENERATED_SOURCES_TARGET "generated_sources" -#define ALL_SOURCE_DEPS_TARGET "all_source_deps" -#define DEPLOYMENT_TARGET "deployment" -#define DEPLOYMENT_CLEAN_TARGET "deployment_clean" -#define WINSCW_DEPLOYMENT_TARGET "winscw_deployment" -#define WINSCW_DEPLOYMENT_CLEAN_TARGET "winscw_deployment_clean" -#define STORE_BUILD_TARGET "store_build" - -SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } -SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } - -void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) -{ - QFile ft(gnuMakefileName); - if (ft.open(QIODevice::WriteOnly)) { - generatedFiles << ft.fileName(); - QTextStream t(&ft); - - t << "# ==============================================================================" << endl; - t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; - t << QDateTime::currentDateTime().toString() << endl; - t << "# This file is generated by qmake and should not be modified by the" << endl; - t << "# user." << endl; - t << "# Name : " << gnuMakefileName << endl; - t << "# Part of : " << project->values("TARGET").join(" ") << endl; - t << "# Description : This file is used to call necessary targets on wrapper makefile" << endl; - t << "# during normal Symbian build process." << endl; - t << "# Version : " << endl; - t << "#" << endl; - t << "# ==============================================================================" << "\n" << endl; - - t << endl << endl; - - t << "MAKE = make" << endl; - t << endl; - - t << "VISUAL_CFG = RELEASE" << endl; - t << "ifeq \"$(CFG)\" \"UDEB\"" << endl; - t << "VISUAL_CFG = DEBUG" << endl; - t << "endif" << endl; - t << endl; - - t << DO_NOTHING_TARGET " :" << endl; - t << "\t" << "@rem " DO_NOTHING_TARGET << endl << endl; - - QString buildDeps; - QString cleanDeps; - QString finalDeps; - QString cleanDepsWinscw; - QString finalDepsWinscw; - QStringList wrapperTargets; - if (deploymentOnly) { - buildDeps.append(STORE_BUILD_TARGET); - cleanDeps.append(DEPLOYMENT_CLEAN_TARGET); - cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET " " DEPLOYMENT_CLEAN_TARGET); - finalDeps.append(DEPLOYMENT_TARGET); - finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET " " DEPLOYMENT_TARGET); - wrapperTargets << WINSCW_DEPLOYMENT_TARGET - << WINSCW_DEPLOYMENT_CLEAN_TARGET - << DEPLOYMENT_TARGET - << DEPLOYMENT_CLEAN_TARGET - << STORE_BUILD_TARGET; - } else { - buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET); - cleanDeps.append(EXTENSION_CLEAN " " DEPLOYMENT_CLEAN_TARGET); - cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET " " DEPLOYMENT_CLEAN_TARGET); - finalDeps.append(FINALIZE_TARGET " " DEPLOYMENT_TARGET); - finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET " " DEPLOYMENT_TARGET); - wrapperTargets << PRE_TARGETDEPS_TARGET - << CREATE_TEMPS_TARGET - << EXTENSION_CLEAN - << FINALIZE_TARGET - << WINSCW_DEPLOYMENT_CLEAN_TARGET - << WINSCW_DEPLOYMENT_TARGET - << DEPLOYMENT_CLEAN_TARGET - << DEPLOYMENT_TARGET - << STORE_BUILD_TARGET; - } - - t << "MAKMAKE: " << buildDeps << endl << endl; - t << "LIB: " << buildDeps << endl << endl; - t << "BLD: " << buildDeps << endl << endl; - t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl; - t << "CLEAN: " << cleanDepsWinscw << endl; - t << "else" << endl; - t << "CLEAN: " << cleanDeps << endl; - t << "endif" << endl << endl; - t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl; - t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl; - t << "FREEZE: " DO_NOTHING_TARGET << endl << endl; - t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl; - t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl; - t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl; - t << "FINAL: " << finalDepsWinscw << endl; - t << "else" << endl; - t << "FINAL: " << finalDeps << endl; - t << "endif" << endl << endl; - - QString makefile(Option::fixPathToTargetOS(fileInfo(wrapperFileName).canonicalFilePath())); - foreach(QString target, wrapperTargets) { - t << target << " : " << makefile << endl; - t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SIS_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl; - } - - t << endl; - } // if(ft.open(QIODevice::WriteOnly)) -} - -void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) -{ - QStringList allPlatforms; - foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) { - allPlatforms << platform.toLower(); - } - - QStringList debugPlatforms = allPlatforms; - QStringList releasePlatforms = allPlatforms; - releasePlatforms.removeAll("winscw"); // No release for emulator - - QString testClause; - if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) - testClause = QLatin1String(" test"); - else - testClause = QLatin1String(""); - - QTextStream t(&wrapperFile); - - MakefileGenerator::writeHeader(t); - - t << "MAKEFILE = " << fileInfo(wrapperFile.fileName()).fileName() << endl; - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "DEL_TREE = " << var("QMAKE_DEL_TREE") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; - t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; -#ifdef Q_OS_WIN32 - t << "XCOPY = xcopy /d /f /h /r /y /i" << endl; - t << "ABLD = ABLD.BAT" << endl; -#elif defined(Q_OS_MAC) - t << "XCOPY = cp -R -v" << endl; - t << "ABLD = abld" << endl; -#else - t << "XCOPY = cp -R -u -v" << endl; - t << "ABLD = abld" << endl; -#endif - t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; - t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl; - t << "MAKE = make" << endl; - t << endl; - t << "ifeq (WINS,$(findstring WINS, $(PLATFORM)))" << endl; - t << "ZDIR=$(EPOCROOT)" << QDir::toNativeSeparators("epoc32/release/$(PLATFORM)/$(CFG)/z") << endl; - t << "else" << endl; - t << "ZDIR=$(EPOCROOT)" << QDir::toNativeSeparators("epoc32/data/z") << endl; - t << "endif" << endl; - t << endl; - t << "DEFINES" << '\t' << " = " - << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") - << varGlue("DEFINES","-D"," -D","") << endl; - - t << "INCPATH" << '\t' << " = "; - - for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { - QStringList values = it.value(); - for (int i = 0; i < values.size(); ++i) { - t << " -I\"" << values.at(i) << "\""; - } - } - t << endl; - t << "first: default" << endl; - if (debugPlatforms.contains("winscw")) - t << "default: debug-winscw"; - else if (debugPlatforms.contains("armv5")) - t << "default: debug-armv5"; - else if (debugPlatforms.size()) - t << "default: debug-" << debugPlatforms.first(); - else - t << "default: all"; - - t << endl; - if (!isPrimaryMakefile) { - t << "all:" << endl; - } else { - t << "all: debug release" << endl; - t << endl; - - QString qmakeCmd = "\t$(QMAKE) \"" + project->projectFile() + "\" " + buildArgs(); - - t << "qmake:" << endl; - t << qmakeCmd << endl; - t << endl; - - t << BLD_INF_FILENAME ": " << project->projectFile() << endl; - t << qmakeCmd << endl; - t << endl; - - t << "$(ABLD): " BLD_INF_FILENAME << endl; - t << "\tbldmake bldfiles" << endl; - t << endl; - - QString locFileDep = generateLocFileTarget(t, qmakeCmd); - - t << "debug: " << locFileDep << "$(ABLD)" << endl; - foreach(QString item, debugPlatforms) { - t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl; - } - t << endl; - t << "release: " << locFileDep << "$(ABLD)" << endl; - foreach(QString item, releasePlatforms) { - t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl; - } - t << endl; - - // For more specific builds, targets are in this form: build-platform, e.g. release-armv5 - foreach(QString item, debugPlatforms) { - t << "debug-" << item << ": " << locFileDep << "$(ABLD)" << endl; - t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl; - } - - foreach(QString item, releasePlatforms) { - t << "release-" << item << ": " << locFileDep << "$(ABLD)" << endl; - t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl; - } - - t << endl; - t << "export: $(ABLD)" << endl; - t << "\t$(ABLD)" << testClause << " export" << endl; - t << endl; - - t << "cleanexport: $(ABLD)" << endl; - t << "\t$(ABLD)" << testClause << " cleanexport" << endl; - t << endl; - - } - - // pre_targetdeps target depends on: - // - all targets specified in PRE_TARGETDEPS - // - the GENERATED_SOURCES sources (so that they get generated) - // - all dependencies of sources targeted for compilation - // (mainly to ensure that any included UNUSED_SOURCES that need to be generated get generated) - // - // Unfortunately, Symbian build chain doesn't support linking generated objects to target, - // so supporting generating sources is the best we can do. This is enough for mocs. - - if (targetType != TypeSubdirs) { - writeExtraTargets(t); - writeExtraCompilerTargets(t); - - t << CREATE_TEMPS_TARGET ":" << endl; - // generate command lines like this ... - // -@ if NOT EXIST ".\somedir" mkdir ".\somedir" - QStringList dirsToClean; - QString dirExists = var("QMAKE_CHK_DIR_EXISTS"); - QString mkdir = var("QMAKE_MKDIR"); - for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { - QStringList values = it.value(); - for (int i = 0; i < values.size(); ++i) { - if (values.at(i).endsWith("/" QT_EXTRA_INCLUDE_DIR)) { - QString fixedValue(QDir::toNativeSeparators(values.at(i))); - dirsToClean << fixedValue; - t << "\t-@ " << dirExists << " \"" << fixedValue << "\" " - << (isWindowsShell() ? "" : "|| ") - << mkdir << " \"" << fixedValue << "\"" << endl; - } - } - } - t << endl; - - // Note: EXTENSION_CLEAN will get called many times when doing reallyclean - // This is why the "2> NUL" gets appended to generated clean targets in makefile.cpp. - t << EXTENSION_CLEAN ": " COMPILER_CLEAN_TARGET << endl; - generateCleanCommands(t, dirsToClean, "$(DEL_TREE)", "", "", ""); - generateCleanCommands(t, project->values("QMAKE_CLEAN"), "$(DEL_FILE)", "", "", ""); - t << endl; - - t << PRE_TARGETDEPS_TARGET ":" - << MAKEFILE_DEPENDENCY_SEPARATOR GENERATED_SOURCES_TARGET - << MAKEFILE_DEPENDENCY_SEPARATOR ALL_SOURCE_DEPS_TARGET; - if (project->values("PRE_TARGETDEPS").size()) - t << MAKEFILE_DEPENDENCY_SEPARATOR << project->values("PRE_TARGETDEPS").join(MAKEFILE_DEPENDENCY_SEPARATOR); - t << endl << endl; - t << GENERATED_SOURCES_TARGET ":"; - if (project->values("GENERATED_SOURCES").size()) - t << MAKEFILE_DEPENDENCY_SEPARATOR << project->values("GENERATED_SOURCES").join(MAKEFILE_DEPENDENCY_SEPARATOR); - t << endl << endl; - t << ALL_SOURCE_DEPS_TARGET ":"; - - QStringList allDeps; - for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { - QString currentSourcePath = it.key(); - QStringList values = it.value(); - for (int i = 0; i < values.size(); ++i) { - // we need additional check - QString sourceFile = currentSourcePath + "/" + values.at(i); - QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile)); - appendIfnotExist(allDeps, deps); - } - } - - foreach(QString item, allDeps) { - t << MAKEFILE_DEPENDENCY_SEPARATOR << item; - } - t << endl << endl; - - // Post link operations - t << FINALIZE_TARGET ":" << endl; - if (!project->isEmpty("QMAKE_POST_LINK")) { - t << '\t' << var("QMAKE_POST_LINK"); - t << endl; - } - t << endl; - } else { - QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); - writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables | SubTargetSkipDefaultTargets); - qDeleteAll(subtargets); - } - - // Deploymend targets for both emulator and rom deployment - writeDeploymentTargets(t, false); - writeDeploymentTargets(t, true); - - generateDistcleanTargets(t); - - t << "clean: $(ABLD)" << endl; - t << "\t-$(ABLD)" << testClause << " reallyclean" << endl; - t << "\t-bldmake clean" << endl; - t << endl; - - t << "clean-debug: $(ABLD)" << endl; - foreach(QString item, debugPlatforms) { - t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl; - } - t << endl; - t << "clean-release: $(ABLD)" << endl; - foreach(QString item, releasePlatforms) { - t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl; - } - t << endl; - - // For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5 - foreach(QString item, debugPlatforms) { - t << "clean-debug-" << item << ": $(ABLD)" << endl; - t << "\t$(ABLD)" << testClause << " reallyclean " << item << " udeb" << endl; - } - foreach(QString item, releasePlatforms) { - t << "clean-release-" << item << ": $(ABLD)" << endl; - t << "\t$(ABLD)" << testClause << " reallyclean " << item << " urel" << endl; - } - t << endl; - - t << "freeze: $(ABLD)" << endl; - t << "\t$(ABLD)" << testClause << " freeze" << endl; - t << endl; - - // Abld toolchain doesn't differentiate between freezing release or debug - t << "freeze-debug: freeze" << endl << endl; - t << "freeze-release: freeze" << endl << endl; - - // For more specific builds, targets are in this form: freeze-build-platform, e.g. freeze-release-armv5, - // though note that debug and release targets of each platform are identical in symbian-abld. - foreach(QString item, debugPlatforms) { - t << "freeze-debug-" << item << ": $(ABLD)" << endl; - t << "\t$(ABLD)" << testClause << " freeze " << item << endl; - } - foreach(QString item, releasePlatforms) { - t << "freeze-release-" << item << ": $(ABLD)" << endl; - t << "\t$(ABLD)" << testClause << " freeze " << item << endl; - } - - t << endl; -} - -void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) -{ - // We don't use extensions for anything in abld - Q_UNUSED(t); - Q_UNUSED(iconTargetFile); -} - -bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool isRom) -{ - if (isRom) - t << DEPLOYMENT_TARGET ":" << endl; - else - t << WINSCW_DEPLOYMENT_TARGET ":" << endl; - - QString remoteTestPath = qt_epocRoot() - + QDir::toNativeSeparators(QLatin1String(isRom ? "epoc32/data/z/private/" - : "epoc32/winscw/c/private/")) - + privateDirUid; - DeploymentList depList; - - initProjectDeploySymbian(project, depList, remoteTestPath, false, true, - QLatin1String(isRom ? ROM_DEPLOYMENT_PLATFORM : EMULATOR_DEPLOYMENT_PLATFORM), - QString(), generatedDirs, generatedFiles); - - if (depList.size()) - t << "\t-echo Deploying changed files..." << endl; - - for (int i = 0; i < depList.size(); ++i) { -#ifdef Q_OS_WIN32 - // Xcopy prompts for selecting file or directory if target doesn't exist, - // and doesn't provide switch to force file selection. It does provide dir forcing, though, - // so strip the last part of the destination. - t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" - << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl; -#else - QString dirExists = var("QMAKE_CHK_DIR_EXISTS"); - QString mkdir = var("QMAKE_MKDIR"); - QString dir = QFileInfo(depList.at(i).to).dir().path(); - t << "\t-@ " << dirExists << " \"" << dir << "\" || " - << mkdir << " \"" << dir << "\"" << endl; - t << "\t-$(XCOPY) \"" << QDir::toNativeSeparators(depList.at(i).from) << "\" \"" - << QDir::toNativeSeparators(depList.at(i).to) << "\"" << endl; -#endif - } - - t << endl; - - if (isRom) - t << DEPLOYMENT_CLEAN_TARGET ":" << endl; - else - t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl; - - QStringList cleanList; - for (int i = 0; i < depList.size(); ++i) { - cleanList.append(QDir::toNativeSeparators(depList.at(i).to)); - } - generateCleanCommands(t, cleanList, "$(DEL_FILE)", "", "", ""); - - // Note: If deployment creates any directories, they will not get deleted after cleanup. - // To do this in robust fashion could be quite complex. - - t << endl; - - return true; -} - -void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) -{ - // Normally emulator deployment gets done via regular makefile, but since subdirs - // do not get that, special deployment only makefile is generated for them if needed. - if (targetType != TypeSubdirs || addDeploymentExtension) { - gnuMakefileName = QLatin1String("Makefile_") + fileInfo(mmpFileName).completeBaseName() - + QLatin1String(".mk"); - t << "gnumakefile " << gnuMakefileName << endl; - } -} - -void SymbianAbldMakefileGenerator::appendAbldTempDirs(QStringList& sysincspaths, QString includepath) -{ - // As a workaround for Symbian toolchain insistence to treat include - // statements as relative to source file rather than the file they appear in, - // we generate extra temporary include directories to make - // relative include paths used in various headers to work properly. - // Note that this is not a fix-all solution; it's just a stop-gap measure - // to make Qt itself build until toolchain can support relative includes in - // a way that Qt expects. - QString epocPath("epoc32"); - if (!includepath.contains(epocPath)) // No temp dirs for epoc includes - appendIfnotExist(sysincspaths, includepath + QString("/" QT_EXTRA_INCLUDE_DIR)); -} diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h deleted file mode 100644 index 91bfb12b88..0000000000 --- a/qmake/generators/symbian/symmake_abld.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SYMMAKE_ABLD_H -#define SYMMAKE_ABLD_H - -#include <symmake.h> - -QT_BEGIN_NAMESPACE - -class SymbianAbldMakefileGenerator : public SymbianMakefileGenerator -{ -protected: - - // Inherited from parent - virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile); - virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); - virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); - virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); - virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath); - - bool writeDeploymentTargets(QTextStream &t, bool isRom); - QString gnuMakefileName; -public: - - SymbianAbldMakefileGenerator(); - ~SymbianAbldMakefileGenerator(); -}; - -#endif // SYMMAKE_ABLD_H diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp deleted file mode 100644 index 84236f124a..0000000000 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ /dev/null @@ -1,760 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "symmake_sbsv2.h" -#include "initprojectdeploy_symbian.h" - -#include <qstring.h> -#include <qstringlist.h> -#include <qdir.h> -#include <qdatetime.h> -#include <qdebug.h> - -// Included from tools/shared -#include <symbian/epocroot_p.h> - -SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { } -SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { } - -#define FLM_DEST_DIR "epoc32/tools/makefile_templates/qt" -#define FLM_SOURCE_DIR "/mkspecs/symbian-sbsv2/flm/qt" -#define PLATFORM_GCCE "gcce" -#define PLATFORM_WINSCW "winscw" -#define PLATFORM_ARM_PREFIX "arm" -#define BUILD_DEBUG "udeb" -#define BUILD_RELEASE "urel" -#define SBS_RVCT_PREFIX "rvct" - -static QString winscwPlatform; -static QString armPlatformPrefix; -static QString gccePlatform; -static QString sbsRvctPrefix; - -#if defined(Q_OS_UNIX) - 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", "&&"); - - // Strip output suppression, as sbsv2 can't handle it in FLMs. Cannot be done by simply - // adding "@" to commandsToReplace, as it'd get handled last due to alphabetical ordering, - // potentially masking other commands that need replacing. - if (cmdLine->contains("@")) - cmdLine->replace(QRegExp(cmdFind.arg("@")), cmdReplace.arg("")); - - // 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() -{ - static bool flmExportDone = false; - - if (!flmExportDone) { - QDir sourceDir = QDir(QLibraryInfo::location(QLibraryInfo::PrefixPath) + FLM_SOURCE_DIR); - QFileInfoList sourceInfos = sourceDir.entryInfoList(QDir::Files); - - QDir destDir(qt_epocRoot() + FLM_DEST_DIR); - if (!destDir.exists()) { - if (destDir.mkpath(destDir.absolutePath())) - generatedDirs << destDir.absolutePath(); - } - - foreach(QFileInfo item, sourceInfos) { - QFileInfo destInfo = QFileInfo(destDir.absolutePath() + "/" + item.fileName()); - if (!destInfo.exists() || destInfo.lastModified() != item.lastModified()) { - if (destInfo.exists()) - QFile::remove(destInfo.absoluteFilePath()); - if (QFile::copy(item.absoluteFilePath(), destInfo.absoluteFilePath())) - generatedFiles << destInfo.absoluteFilePath(); - else - fprintf(stderr, "Error: Could not copy '%s' -> '%s'\n", - qPrintable(item.absoluteFilePath()), - qPrintable(destInfo.absoluteFilePath())); - } - } - flmExportDone = true; - } -} - -void SymbianSbsv2MakefileGenerator::findInstalledCompilerVersions(const QString &matchExpression, - const QString &versionPrefix, - QStringList *versionList) -{ - // No need to be able to find env variables on other operating systems, - // as only linux and windows have support for symbian-sbsv2 toolchain -#if defined(Q_OS_UNIX) || defined(Q_OS_WIN) - char *entry = 0; - int count = 0; - QRegExp matcher(matchExpression); - while ((entry = environ[count++])) { - if (matcher.exactMatch(QString::fromLocal8Bit(entry)) - && fileInfo(matcher.cap(matcher.captureCount())).exists()) { - // First capture (index 0) is the whole match, which is skipped. - // Next n captures are version numbers, which are interesting. - // Final capture is the env var value, which we already used, so that is skipped, too. - int capture = 1; - int finalCapture = matcher.captureCount() - 1; - QString version = versionPrefix; - while (capture <= finalCapture) { - version.append(matcher.cap(capture)); - if (capture != finalCapture) - version.append(QLatin1Char('.')); - capture++; - } - *versionList << version; - } - } -#endif -} - -void SymbianSbsv2MakefileGenerator::findGcceVersions(QStringList *gcceVersionList, - QString *defaultVersion) -{ - QString matchStr = QLatin1String("SBS_GCCE(\\d)(\\d)(\\d)BIN=(.*)"); - findInstalledCompilerVersions(matchStr, gccePlatform, gcceVersionList); - - QString qtGcceVersion = QString::fromLocal8Bit(qgetenv("QT_GCCE_VERSION")); - - if (!qtGcceVersion.isEmpty()) { - if (QRegExp("\\d+\\.\\d+\\.\\d+").exactMatch(qtGcceVersion)) { - *defaultVersion = gccePlatform + qtGcceVersion; - } else { - fprintf(stderr, "Warning: Variable QT_GCCE_VERSION ('%s') is in incorrect " - "format, expected format is: 'x.y.z'. Attempting to autodetect GCCE version.\n", - qPrintable(qtGcceVersion)); - } - } - - if (defaultVersion->isEmpty() && gcceVersionList->size()) { - gcceVersionList->sort(); - *defaultVersion = gcceVersionList->last(); - } -} - -void SymbianSbsv2MakefileGenerator::findRvctVersions(QStringList *rvctVersionList, - QString *defaultVersion) -{ - QString matchStr = QLatin1String("RVCT(\\d)(\\d)BIN=(.*)"); - findInstalledCompilerVersions(matchStr, sbsRvctPrefix, rvctVersionList); - - QString qtRvctVersion = QString::fromLocal8Bit(qgetenv("QT_RVCT_VERSION")); - - if (!qtRvctVersion.isEmpty()) { - if (QRegExp("\\d+\\.\\d+").exactMatch(qtRvctVersion)) { - *defaultVersion = sbsRvctPrefix + qtRvctVersion; - } else { - fprintf(stderr, "Warning: Variable QT_RVCT_VERSION ('%s') is in incorrect " - "format, expected format is: 'x.y'.\n", - qPrintable(qtRvctVersion)); - } - } -} - -QString SymbianSbsv2MakefileGenerator::configClause(const QString &platform, - const QString &build, - const QString &compilerVersion, - const QString &clauseTemplate) -{ - QString retval; - if (QString::compare(platform, winscwPlatform) == 0) { - retval = clauseTemplate.arg(build); - } else if (platform.startsWith(armPlatformPrefix)) { - QString fixedCompilerVersion = compilerVersion; - fixedCompilerVersion.replace(".","_"); - retval = clauseTemplate.arg(platform.mid(sizeof(PLATFORM_ARM_PREFIX)-1)) - .arg(build) - .arg(fixedCompilerVersion); - } // else - Unsupported platform for makefile target, return empty clause - return retval; -} - -void SymbianSbsv2MakefileGenerator::writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t) -{ - for (int i = 0; i < depList.size(); ++i) { - t << "START EXTENSION qt/qmake_emulator_deployment" << endl; - QString fromItem = depList.at(i).from; - QString toItem = depList.at(i).to; - fromItem.replace("\\", "/"); - toItem.replace("\\", "/"); -#if defined(Q_OS_WIN) - // add drive if it doesn't have one yet - if (toItem.size() > 1 && toItem[1] != QLatin1Char(':')) - toItem.prepend(QDir::current().absolutePath().left(2)); -#endif - t << "OPTION DEPLOY_SOURCE " << fromItem << endl; - t << "OPTION DEPLOY_TARGET " << toItem << endl; - t << "END" << endl; - } -} - -void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) -{ - // Can't use extension makefile with sbsv2 - Q_UNUSED(wrapperFileName); - Q_UNUSED(deploymentOnly); -} - -void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) -{ - static QString debugBuild; - static QString releaseBuild; - static QString defaultGcceCompilerVersion; - static QString defaultRvctCompilerVersion; - static QStringList rvctVersions; - static QStringList gcceVersions; - static QStringList allArmCompilerVersions; - - // Initialize static variables used in makefile creation - if (debugBuild.isEmpty()) { - debugBuild.append(QLatin1String(BUILD_DEBUG)); - releaseBuild.append(QLatin1String(BUILD_RELEASE)); - winscwPlatform.append(QLatin1String(PLATFORM_WINSCW)); - gccePlatform.append(QLatin1String(PLATFORM_GCCE)); - armPlatformPrefix.append(QLatin1String(PLATFORM_ARM_PREFIX)); - sbsRvctPrefix.append(QLatin1String(SBS_RVCT_PREFIX)); - - findGcceVersions(&gcceVersions, &defaultGcceCompilerVersion); - findRvctVersions(&rvctVersions, &defaultRvctCompilerVersion); - - allArmCompilerVersions << rvctVersions << gcceVersions; - - if (!allArmCompilerVersions.size()) { - fprintf(stderr, "Warning: No HW compilers detected. " - "Please install either GCCE or RVCT compiler to enable release builds.\n"); - } - } - - QStringList allPlatforms; - foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) { - allPlatforms << platform.toLower(); - } - - if (!gcceVersions.size()) - allPlatforms.removeAll(gccePlatform); - - QString testClause; - if (project->isActiveConfig(SYMBIAN_TEST_CONFIG)) - testClause = QLatin1String(".test"); - else - testClause = QLatin1String(""); - - // Note: armClause is used for gcce, too, which has a side effect - // of requiring armv* platform(s) in SYMBIAN_PLATFORMS in order - // to get any compiler version specific targets. - QString armClause = " -c " PLATFORM_ARM_PREFIX ".%1.%2.%3" + testClause; - QString genericArmClause; - if (defaultRvctCompilerVersion.isEmpty()) { - // Note: Argument %3 needs to be empty string in this version of clause - genericArmClause = " -c " PLATFORM_ARM_PREFIX "%1_%2%3" + testClause; - } else { - // If defaultRvctCompilerVersion is defined, use specific sbs clause for "generic" clause - genericArmClause = armClause; - } - QString winscwClause = " -c " PLATFORM_WINSCW "_%1.mwccinc" + testClause;; - - QStringList armPlatforms = allPlatforms.filter(QRegExp("^" PLATFORM_ARM_PREFIX)); - - if (!allArmCompilerVersions.size()) { - foreach (QString item, armPlatforms) { - allPlatforms.removeAll(item); - } - armPlatforms.clear(); - } - - QStringList allClauses; - QStringList debugClauses; - QStringList releaseClauses; - - // Only winscw and arm platforms are supported - QStringList debugPlatforms = allPlatforms; - QStringList releasePlatforms = allPlatforms; - releasePlatforms.removeAll(winscwPlatform); // No release for emulator - - if (!releasePlatforms.size()) { - fprintf(stderr, "Warning: No valid release platforms in SYMBIAN_PLATFORMS (%s)\n" - "Most likely required compiler(s) are not properly installed.\n", - qPrintable(project->values("SYMBIAN_PLATFORMS").join(" "))); - } - - if (debugPlatforms.contains(winscwPlatform)) - debugClauses << configClause(winscwPlatform, debugBuild, QString(), winscwClause); - - foreach(QString item, armPlatforms) { - // Only use single clause per arm platform even if multiple compiler versions were found, - // otherwise we get makefile target collisions from sbsv2 toolchain. - if (rvctVersions.size()) { - debugClauses << configClause(item, debugBuild, defaultRvctCompilerVersion, genericArmClause); - releaseClauses << configClause(item, releaseBuild, defaultRvctCompilerVersion, genericArmClause); - } else { - debugClauses << configClause(item, debugBuild, defaultGcceCompilerVersion, armClause); - releaseClauses << configClause(item, releaseBuild, defaultGcceCompilerVersion, armClause); - } - } - - allClauses << debugClauses << releaseClauses; - - QTextStream t(&wrapperFile); - - MakefileGenerator::writeHeader(t); - - t << "MAKEFILE = " << fileInfo(wrapperFile.fileName()).fileName() << endl; - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; - t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; - t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl; - t << "MAKE = make" << endl; - t << "SBS = sbs" << endl; - t << endl; - t << "DEFINES" << '\t' << " = " - << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") - << varGlue("DEFINES","-D"," -D","") << endl; - - t << "INCPATH" << '\t' << " = "; - - for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { - QStringList values = it.value(); - for (int i = 0; i < values.size(); ++i) { - t << " -I\"" << values.at(i) << "\" "; - } - } - - t << endl; - t << "first: default" << endl << endl; - if (!isPrimaryMakefile) { - t << "all:" << endl << endl; - t << "default: all" << endl << endl; - } else { - t << "all: debug release" << endl << endl; - if (debugPlatforms.contains(winscwPlatform)) - t << "default: debug-winscw"; - else if (debugPlatforms.size()) - t << "default: debug-" << debugPlatforms.first(); - else - t << "default: all"; - t << endl; - - QString qmakeCmd = "\t$(QMAKE) \"" + project->projectFile() + "\" " + buildArgs(); - - t << "qmake:" << endl; - t << qmakeCmd << endl; - t << endl; - - t << BLD_INF_FILENAME ": " << project->projectFile() << endl; - t << qmakeCmd << endl; - t << endl; - - QString locFileDep = generateLocFileTarget(t, qmakeCmd); - - t << "debug: " << locFileDep << BLD_INF_FILENAME << endl; - t << "\t$(SBS)"; - foreach(QString clause, debugClauses) { - t << clause; - } - t << endl; - t << "clean-debug: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean --toolcheck=off"; - foreach(QString clause, debugClauses) { - t << clause; - } - t << endl; - - t << "freeze-debug: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) freeze"; - foreach(QString clause, debugClauses) { - t << clause; - } - t << endl; - - t << "release: " << locFileDep << BLD_INF_FILENAME << endl; - t << "\t$(SBS)"; - foreach(QString clause, releaseClauses) { - t << clause; - } - t << endl; - t << "clean-release: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean --toolcheck=off"; - foreach(QString clause, releaseClauses) { - t << clause; - } - t << endl; - - t << "freeze-release: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) freeze"; - foreach(QString clause, releaseClauses) { - t << clause; - } - t << endl << endl; - - QString defaultGcceArmVersion; - if (armPlatforms.size()) { - defaultGcceArmVersion = armPlatforms.first(); - } else { - defaultGcceArmVersion = QLatin1String("armv5"); - } - - // For more specific builds, targets are in this form: - // release-armv5 - generic target, compiler version determined by toolchain or autodetection - // release-armv5-rvct4.0 - compiler version specific target - foreach(QString item, debugPlatforms) { - QString clause; - if (item.compare(winscwPlatform) == 0) - clause = configClause(item, debugBuild, QString(), winscwClause); - else if (item.compare(gccePlatform) == 0 ) - clause = configClause(defaultGcceArmVersion, debugBuild, defaultGcceCompilerVersion, armClause); - else // use generic arm clause - clause = configClause(item, debugBuild, defaultRvctCompilerVersion, genericArmClause); - - t << "debug-" << item << ": " << locFileDep << BLD_INF_FILENAME << endl; - t << "\t$(SBS)" << clause << endl; - t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean" << clause << endl; - t << "freeze-debug-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) freeze" << clause << endl; - } - - foreach(QString item, releasePlatforms) { - QString clause; - if (item.compare(gccePlatform) == 0 ) - clause = configClause(defaultGcceArmVersion, releaseBuild, defaultGcceCompilerVersion, armClause); - else // use generic arm clause - clause = configClause(item, releaseBuild, defaultRvctCompilerVersion, genericArmClause); - - t << "release-" << item << ": " << locFileDep << BLD_INF_FILENAME << endl; - t << "\t$(SBS)" << clause << endl; - t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean" << clause << endl; - t << "freeze-release-" << item << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) freeze" << clause << endl; - } - - foreach(QString item, armPlatforms) { - foreach(QString compilerVersion, allArmCompilerVersions) { - QString debugClause = configClause(item, debugBuild, compilerVersion, armClause); - QString releaseClause = configClause(item, releaseBuild, compilerVersion, armClause); - t << "debug-" << item << "-" << compilerVersion << ": " << locFileDep << BLD_INF_FILENAME << endl; - t << "\t$(SBS)" << debugClause << endl; - t << "clean-debug-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean" << debugClause << endl; - t << "freeze-debug-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) freeze" << debugClause << endl; - t << "release-" << item << "-" << compilerVersion << ": " << locFileDep << BLD_INF_FILENAME << endl; - t << "\t$(SBS)" << releaseClause << endl; - t << "clean-release-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) reallyclean" << releaseClause << endl; - t << "freeze-release-" << item << "-" << compilerVersion << ": " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) freeze" << releaseClause << endl; - } - } - - t << endl; - t << "export: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) export"; - foreach(QString clause, allClauses) { - t << clause; - } - t << endl << endl; - - t << "cleanexport: " << BLD_INF_FILENAME << endl; - t << "\t$(SBS) cleanexport"; - foreach(QString clause, allClauses) { - t << clause; - } - t << endl << endl; - - // Typically one wants to freeze release binaries, so make plain freeze target equal to - // freeze-release. If freezing of debug binaries is needed for some reason, then - // freeze-debug target should be used. There is no point to try freezing both with one - // target as both produce the same def file. - t << "freeze: freeze-release" << endl << endl; - } - - // Add all extra targets including extra compiler targets also to wrapper makefile, - // even though many of them may have already been added to bld.inf as FLMs. - // This is to enable use of targets like 'mocables', which call targets generated by extra compilers. - if (targetType != TypeSubdirs) { - t << extraTargetsCache; - t << extraCompilersCache; - } else { - QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); - writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets); - qDeleteAll(subtargets); - } - - 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 --toolcheck=off"; - foreach(QString clause, allClauses) { - t << clause; - } - t << endl << endl; - - t << endl; -} - -void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) -{ - // Makes sure we have needed FLMs in place. - exportFlm(); - - // Parse extra compilers data - QStringList defines; - QStringList incPath; - - defines << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") - << varGlue("DEFINES","-D"," -D",""); - for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { - QStringList values = it.value(); - for (int i = 0; i < values.size(); ++i) { - incPath << QLatin1String(" -I\"") + values.at(i) + "\""; - } - } - - QMap<QString, QString> commandsToReplace; - commandsToReplace.insert(project->values("QMAKE_COPY").join(" "), - project->values("QMAKE_SBSV2_COPY").join(" ")); - commandsToReplace.insert(project->values("QMAKE_COPY_DIR").join(" "), - project->values("QMAKE_SBSV2_COPY_DIR").join(" ")); - commandsToReplace.insert(project->values("QMAKE_MOVE").join(" "), - project->values("QMAKE_SBSV2_MOVE").join(" ")); - commandsToReplace.insert(project->values("QMAKE_DEL_FILE").join(" "), - project->values("QMAKE_SBSV2_DEL_FILE").join(" ")); - commandsToReplace.insert(project->values("QMAKE_MKDIR").join(" "), - project->values("QMAKE_SBSV2_MKDIR").join(" ")); - commandsToReplace.insert(project->values("QMAKE_DEL_DIR").join(" "), - project->values("QMAKE_SBSV2_DEL_DIR").join(" ")); - commandsToReplace.insert(project->values("QMAKE_DEL_TREE").join(" "), - project->values("QMAKE_SBSV2_DEL_TREE").join(" ")); - - // Write extra compilers and targets to initialize QMAKE_ET_* variables - // Cache results to avoid duplicate calls when creating wrapper makefile - QTextStream extraCompilerStream(&extraCompilersCache); - QTextStream extraTargetStream(&extraTargetsCache); - writeExtraCompilerTargets(extraCompilerStream); - writeExtraTargets(extraTargetStream); - - // Figure out everything the target depends on as we don't want to run extra targets that - // are not necessary. - QStringList allPreDeps; - foreach(QString item, project->values("PRE_TARGETDEPS")) { - allPreDeps.append(fileInfo(item).absoluteFilePath()); - } - - foreach (QString item, project->values("GENERATED_SOURCES")) { - allPreDeps.append(fileInfo(item).absoluteFilePath()); - } - - for (QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { - QString currentSourcePath = it.key(); - QStringList values = it.value(); - for (int i = 0; i < values.size(); ++i) { - QString sourceFile = currentSourcePath + "/" + values.at(i); - QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile)); - foreach(QString depItem, deps) { - appendIfnotExist(allPreDeps, fileInfo(depItem).absoluteFilePath()); - } - } - } - - // Write FLM rules for all extra targets and compilers that we depend on to build the target. - QStringList extraTargets; - extraTargets << project->values("QMAKE_EXTRA_TARGETS") << project->values("QMAKE_EXTRA_COMPILERS"); - foreach(QString item, extraTargets) { - foreach(QString targetItem, project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_TARGETS.") + item)) { - // Make sure targetpath is absolute - QString absoluteTarget = fileInfo(targetItem).absoluteFilePath(); - if (allPreDeps.contains(absoluteTarget)) { - QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem); - QString commandItem = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + item + targetItem).join(" "); - - // Make sure all deps paths are absolute - QString absoluteDeps; - foreach (QString depItem, deps) { - if (!depItem.isEmpty()) { - absoluteDeps.append(fileInfo(depItem).absoluteFilePath()); - absoluteDeps.append(" "); - } - } - - t << "START EXTENSION qt/qmake_extra_pre_targetdep.export" << endl; - t << "OPTION PREDEP_TARGET " << absoluteTarget << endl; - t << "OPTION DEPS " << absoluteDeps << endl; - - if (commandItem.indexOf("$(INCPATH)") != -1) - commandItem.replace("$(INCPATH)", incPath.join(" ")); - if (commandItem.indexOf("$(DEFINES)") != -1) - commandItem.replace("$(DEFINES)", defines.join(" ")); - - fixFlmCmd(&commandItem, commandsToReplace); - - t << "OPTION COMMAND " << commandItem << endl; - t << "END" << endl; - } - } - } - - t << endl; - - // Write deployment rules - QString remoteTestPath = qt_epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid; - DeploymentList depList; - - //write emulator deployment - t << "#if defined(WINSCW)" << endl; - initProjectDeploySymbian(project, depList, remoteTestPath, false, true, - QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles); - writeSbsDeploymentList(depList, t); - t << "#endif" << endl; - - //write ROM deployment - remoteTestPath = qt_epocRoot() + QLatin1String("epoc32/data/z/private/") + privateDirUid; - depList.clear(); - initProjectDeploySymbian(project, depList, remoteTestPath, false, true, - QLatin1String(ROM_DEPLOYMENT_PLATFORM), QString(), generatedDirs, generatedFiles); - writeSbsDeploymentList(depList, t); - t << endl; - - // 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 " << postLinkCmd << endl; - t << "OPTION LINK_TARGET " << fixedTarget << QLatin1String(".") << getTargetExtension() << endl; - t << "END" << endl; - t << endl; - } - - // Application icon generation - QStringList icons = project->values("ICON"); - if (icons.size()) { - QString icon = icons.first(); - if (icons.size() > 1) - fprintf(stderr, "Warning: Only first icon specified in ICON variable is used: '%s'.", qPrintable(icon)); - - t << "START EXTENSION s60/mifconv" << endl; - - QFileInfo iconInfo = fileInfo(icon); - - QFileInfo bldinf(project->values("MAKEFILE").first()); - QString iconPath = bldinf.dir().relativeFilePath(iconInfo.path()); - - QString iconFile = iconInfo.baseName(); - - QFileInfo iconTargetInfo = fileInfo(iconTargetFile); - QString iconTarget = iconTargetInfo.fileName(); - - t << "OPTION SOURCES -c32 " << iconFile << endl; - t << "OPTION SOURCEDIR " << iconPath << endl; - t << "OPTION TARGETFILE " << iconTarget << endl; - t << "OPTION SVGENCODINGVERSION 3" << endl; // Compatibility with S60 3.1 devices and up - t << "END" << endl; - } - - t << "START EXTENSION qt/qmake_store_build" << endl; - t << "END" << endl; - t << endl; - - // Handle QMAKE_CLEAN - QStringList cleanFiles = project->values("QMAKE_CLEAN"); - if (!cleanFiles.isEmpty()) { - QStringList absoluteCleanFiles; - foreach (QString cleanFile, cleanFiles) { - QFileInfo fi(cleanFile); - QString fileName = QLatin1String("\""); - fileName.append(fi.absoluteFilePath()); - fileName.append(QLatin1String("\"")); - absoluteCleanFiles << fileName; - } - t << "START EXTENSION qt/qmake_clean" << endl; - t << "OPTION CLEAN_FILES " << absoluteCleanFiles.join(" ") << endl; - t << "END" << endl; - } - t << endl; -} - -void SymbianSbsv2MakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) -{ - // We don't generate extension makefile in sbsb2 - Q_UNUSED(t); - Q_UNUSED(addDeploymentExtension); -} - -void SymbianSbsv2MakefileGenerator::appendAbldTempDirs(QStringList& sysincspaths, QString includepath) -{ - //Do nothing - Q_UNUSED(sysincspaths); - Q_UNUSED(includepath); -} diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h deleted file mode 100644 index fce25e1bdb..0000000000 --- a/qmake/generators/symbian/symmake_sbsv2.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SYMMAKE_SBSV2_H -#define SYMMAKE_SBSV2_H - -#include <symmake.h> - -QT_BEGIN_NAMESPACE - -class SymbianSbsv2MakefileGenerator : public SymbianMakefileGenerator -{ -protected: - - // Inherited from parent - virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile); - virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); - virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); - virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); - virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath); - virtual bool isForSymbianSbsv2() const { return true; } // FIXME: killme - i'm ugly! - -public: - - SymbianSbsv2MakefileGenerator(); - ~SymbianSbsv2MakefileGenerator(); - -private: - void exportFlm(); - void findGcceVersions(QStringList *gcceVersionList, QString *defaultVersion); - void findRvctVersions(QStringList *rvctVersionList, QString *defaultVersion); - void findInstalledCompilerVersions(const QString &matchExpression, - const QString &versionPrefix, - QStringList *versionList); - QString configClause(const QString &platform, - const QString &build, - const QString &compilerVersion, - const QString &clauseTemplate); - - void writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t); - - QString extraTargetsCache; - QString extraCompilersCache; -}; - -#endif // SYMMAKE_SBSV2_H |