From 70770a2e4fc7581f56a39f7b8b89dd5782cd29c0 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 5 Nov 2010 16:45:39 +0200 Subject: Make default application deployment removable Default application deployment was hard coded in qmake, so it was impossible to replace with custom deployment. Now the default deployment is generated via .prf files and is removable. Cherry picked to 4.7 branch from master branch as part of QTBUG-15068, original commit: 494ce0dac35c7ade0ce78589878597a7ca912864 Task-number: QTBUG-15068 Task-number: QTBUG-13367 Reviewed-by: axis Conflicts: qmake/generators/symbian/symbiancommon.cpp --- doc/src/development/qmake-manual.qdoc | 16 +++++ doc/src/snippets/code/doc_src_qmake-manual.qdoc | 4 ++ mkspecs/common/symbian/symbian.conf | 2 +- mkspecs/features/symbian/application_icon.prf | 49 ++++++++++----- mkspecs/features/symbian/default_post.prf | 9 +-- qmake/generators/symbian/symbiancommon.cpp | 82 +------------------------ 6 files changed, 61 insertions(+), 101 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index a520838..278822e 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1458,6 +1458,22 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 141 + On the Symbian platform, a default deployment is generated for all + application projects. You can modify the autogenerated default + deployment via following \c DEPLOYMENT variable values: + + \list + \o default_bin_deployment - Application executable + \o default_resource_deployment - Application resources, including icon + \o default_reg_deployment - Application registration file + \endlist + + For example: + + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 154 + + This will entirely remove the default application deployment. + On the Symbian platform, you can use \c{DEPLOYMENT.installer_header} variable to generate smart installer wrapper for your application. If you specify just UID of the installer package as the value, then diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index 379d081..20d8d45 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -1014,3 +1014,7 @@ BLD_INF_RULES.prj_exports += my_exports my_note.pkg_postrules.installer = "\"myinstallnote.txt\" - \"\", FILETEXT, TEXTCONTINUE" DEPLOYMENT += my_note //! [153] + +//! [154] +DEPLOYMENT -= default_bin_deployment default_resource_deployment default_reg_deployment +//! [154] diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index decec14..2fb799d 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -202,7 +202,7 @@ pkg_platform_dependencies = \ "[0x20032DE7],0,0,0,{\"S60ProductID\"}" \ " " -DEPLOYMENT += default_deployment +DEPLOYMENT += default_deployment default_bin_deployment default_resource_deployment default_reg_deployment defineReplace(symbianRemoveSpecialCharacters) { # Produce identical string to what SymbianCommonGenerator::removeSpecialCharacters and diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index 9a9395a..39f10fb 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -1,21 +1,39 @@ load(data_caging_paths) -# If no_icon keyword exist, the S60 UI app is just made hidden. This because S60 app FW -# requires the registration resource file to exist always -contains( CONFIG, no_icon ) { - symbian:RSS_RULES += "hidden = KAppIsHidden;" - CONFIG -= no_icon -} else { -# There is no point in compiling the MIF icon if no_icon CONFIGS is set - !isEmpty(ICON) { +contains(CONFIG, no_icon) { + # If no_icon keyword exist, the S60 UI app is just made hidden. This because S60 app FW + # requires the registration resource file to exist always + contains(QT, gui):contains(CONFIG, qt) { + symbian:RSS_RULES += "hidden = KAppIsHidden;" + CONFIG -= no_icon + } +} + +!contains(CONFIG, no_icon) { + baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET)) + symbian-abld|symbian-sbsv2 { + resourceZDir = $$EPOCROOT$$HW_ZDIR$$APP_RESOURCE_DIR + regZDir = $$EPOCROOT$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR + } else { + isEmpty(DESTDIR) { + resourceZDir = . + } else { + resourceZDir = $$DESTDIR + } + regZDir = $$resourceZDir + } + default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.rsc + default_resource_deployment.path = $$APP_RESOURCE_DIR + default_reg_deployment.sources += $$regZDir/$${baseTarget}_reg.rsc + default_reg_deployment.path = $$REG_RESOURCE_IMPORT_DIR + + !isEmpty(ICON) { !count(ICON, 1) { ICON = $$first(ICON) warning("Only first icon specified in ICON variable is used: $$ICON") } - baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET)) - # Note: symbian-sbsv2 builds can't utilize extra compiler for mifconv, so ICON handling is done in code !symbian-sbsv2 { # Absolute path required for shadow builds. @@ -27,13 +45,10 @@ contains( CONFIG, no_icon ) { ICON_backslashed = $$ICON symbian-abld { + # ${ZDIR} is defined in Makefile mifIconZDir = ${ZDIR}$$APP_RESOURCE_DIR } else { - isEmpty(DESTDIR) { - mifIconZDir = . - } else { - mifIconZDir = $$DESTDIR - } + mifIconZDir = $$resourceZDir } # Extra compiler rules for mifconv @@ -54,5 +69,9 @@ contains( CONFIG, no_icon ) { # Rules to use generated MIF file from symbian resources RSS_RULES.number_of_icons = $$size(ICON_backslashed) RSS_RULES.icon_file = $$APP_RESOURCE_DIR/$${baseTarget}.mif + + default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.mif } } + + diff --git a/mkspecs/features/symbian/default_post.prf b/mkspecs/features/symbian/default_post.prf index 0564e9b..362bd6c 100644 --- a/mkspecs/features/symbian/default_post.prf +++ b/mkspecs/features/symbian/default_post.prf @@ -9,6 +9,11 @@ contains(TEMPLATE, ".*app") { } else { QMAKE_LIBS += $$QMAKE_LIBS_QT_ENTRY } + + default_bin_deployment.sources += $$symbianRemoveSpecialCharacters($$basename(TARGET)).exe + default_bin_deployment.path += /sys/bin + + load(application_icon.prf) } contains(TEMPLATE, lib): { contains(CONFIG, staticlib)|contains(CONFIG, static): { @@ -26,10 +31,6 @@ contains(TEMPLATE, lib): { MMP_RULES -= EXPORTUNFROZEN } -contains(TEMPLATE, ".*app"):contains(QT, gui):contains(CONFIG,qt) { - load(application_icon.prf) -} - isEmpty(TARGET.UID3):TARGET.UID3 = $$generate_uid("$${OUT_PWD}/$${TARGET}") isEmpty(TARGET.UID2) { contains(CONFIG, stdbinary) { diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 3183e27..c0a6626 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -383,87 +383,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB t << manufacturerStr << endl; } - // Install paths on the phone *** should be dynamic at some point - QString installPathBin = "!:\\sys\\bin"; - QString installPathResource = "!:\\resource\\apps"; - QString installPathRegResource = "!:\\private\\10003a3f\\import\\apps"; - - // Find location of builds - QString destDirBin; - QString destDirResource; - QString destDirRegResource; - if (epocBuild) { - destDirBin = QString("%1epoc32/release/$(PLATFORM)/$(TARGET)").arg(epocRoot()); - destDirResource = QString("%1epoc32/data/z/resource/apps").arg(epocRoot()); - destDirRegResource = QString("%1epoc32/data/z/private/10003a3f/import/apps").arg(epocRoot()); - } else { - destDirBin = project->first("DESTDIR"); - if (destDirBin.isEmpty()) - destDirBin = "."; - else if (destDirBin.endsWith('/') || destDirBin.endsWith('\\')) - destDirBin.chop(1); - destDirResource = destDirBin; - destDirRegResource = destDirBin; - } - - if (targetType == TypeExe) { - // deploy .exe file - t << "; Executable and default resource files" << endl; - QString exeFile = fixedTarget + ".exe"; - t << QString("\"%1/%2\" - \"%3\\%4\"") - .arg(destDirBin) - .arg(exeFile) - .arg(installPathBin) - .arg(exeFile) << endl; - ts << QString("\"\" - \"%1\\%2\"") - .arg(romPath(installPathBin)) - .arg(exeFile) << endl; - - // deploy rsc & reg_rsc file - if (!project->isActiveConfig("no_icon")) { - t << QString("\"%1/%2\" - \"%3\\%4\"") - .arg(destDirResource) - .arg(fixedTarget + ".rsc") - .arg(installPathResource) - .arg(fixedTarget + ".rsc") << endl; - ts << QString("\"\" - \"%1\\%2\"") - .arg(romPath(installPathResource)) - .arg(fixedTarget + ".rsc") << endl; - - t << QString("\"%1/%2\" - \"%3\\%4\"") - .arg(destDirRegResource) - .arg(fixedTarget + "_reg.rsc") - .arg(installPathRegResource) - .arg(fixedTarget + "_reg.rsc") << endl; - ts << QString("\"\" - \"%1\\%2\"") - .arg(romPath(installPathRegResource)) - .arg(fixedTarget + "_reg.rsc") << endl; - - if (!iconFile.isEmpty()) { - if (epocBuild) { - t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") - .arg(epocRoot()) - .arg(iconFile) - .arg(QString(iconFile).replace('/', '\\')) << endl << endl; - ts << QString("\"\" - \"%1\"") - .arg(romPath(QString(iconFile).replace('/', '\\'))) << endl << endl; - } else { - QDir mifIconDir(project->first("DESTDIR")); - QFileInfo mifIcon(mifIconDir.relativeFilePath(project->first("TARGET"))); - QString mifIconFileName = mifIcon.fileName(); - mifIconFileName.append(".mif"); - t << QString("\"%1/%2\" - \"!:%3\"") - .arg(mifIcon.path()) - .arg(mifIconFileName) - .arg(QString(iconFile).replace('/', '\\')) << endl << endl; - ts << QString("\"\" - \"%1\"") - .arg(romPath(QString(iconFile).replace('/', '\\'))) << endl << endl; - } - } - } - } - - // deploy any additional DEPLOYMENT files + // deploy files specified by DEPLOYMENT variable QString remoteTestPath; QString zDir; remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); -- cgit v0.12