From cb59e56bc9f34c50dc4a2d01d2ea506c5d735225 Mon Sep 17 00:00:00 2001
From: axis <qt-info@nokia.com>
Date: Fri, 4 Jun 2010 11:32:40 +0200
Subject: Fixed def file usage for Qt plugins under the makefile build system.

Previously it would not use the autogenerated def files.

RevBy:    Thomas Zander
---
 .gitignore                                    |  2 +-
 mkspecs/features/symbian/def_files.prf        |  2 +-
 mkspecs/features/symbian/symbian_building.prf |  3 +++
 qmake/generators/symbian/symbian_makefile.h   |  2 ++
 qmake/generators/symbian/symbiancommon.cpp    | 36 +++++++++++++++++++++++++++
 qmake/generators/symbian/symbiancommon.h      |  2 ++
 qmake/generators/symbian/symmake.cpp          | 35 --------------------------
 qmake/generators/symbian/symmake.h            |  2 --
 8 files changed, 45 insertions(+), 39 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4e3b130..d88e69a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -205,7 +205,7 @@ bld.inf
 *.loc
 !s60main.rss
 *.pkg
-plugin_commonU.def
+plugin_commonu.def
 *.qtplugin
 *.sis
 *.sisx
diff --git a/mkspecs/features/symbian/def_files.prf b/mkspecs/features/symbian/def_files.prf
index eb17402..6a95763 100644
--- a/mkspecs/features/symbian/def_files.prf
+++ b/mkspecs/features/symbian/def_files.prf
@@ -41,7 +41,7 @@ symbian-abld|symbian-sbsv2 {
         }
     }
 
-} else:contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) {
+} else:contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib):!contains(CONFIG, plugin) {
     !isEmpty(DEF_FILE) {
         defFile = $$DEF_FILE
     } else {
diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf
index c230272..92988aa 100644
--- a/mkspecs/features/symbian/symbian_building.prf
+++ b/mkspecs/features/symbian/symbian_building.prf
@@ -96,6 +96,9 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) {
         QMAKE_POST_LINK = $$replace(QMAKE_POST_LINK, "^@", "")
         QMAKE_POST_LINK = && $$QMAKE_POST_LINK
     }
+
+    contains(CONFIG, plugin):QMAKE_ELF2E32_FLAGS += --definput=plugin_commonu.def
+
     # The tee and grep at the end work around the issue that elf2e32 doesn't return non-null on error.
     # The comparison of dso files is to avoid extra building of modules that depend on this dso, in
     # case it has not changed.
diff --git a/qmake/generators/symbian/symbian_makefile.h b/qmake/generators/symbian/symbian_makefile.h
index 061866a..94f0145 100644
--- a/qmake/generators/symbian/symbian_makefile.h
+++ b/qmake/generators/symbian/symbian_makefile.h
@@ -94,6 +94,8 @@ public:
             }
         }
 
+        writeCustomDefFile();
+
         return T::writeMakefile(t);
     }
 };
diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp
index aa44afc..f8b3aa5 100644
--- a/qmake/generators/symbian/symbiancommon.cpp
+++ b/qmake/generators/symbian/symbiancommon.cpp
@@ -58,6 +58,8 @@
 #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 " \
@@ -775,6 +777,40 @@ void SymbianCommonGenerator::readRssRules(QString &numberOfIcons,
     }
 }
 
+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))
+        }
+    }
+}
+
 QStringList SymbianCommonGenerator::symbianLangCodesFromTsFiles()
 {
     QStringList tsfiles;
diff --git a/qmake/generators/symbian/symbiancommon.h b/qmake/generators/symbian/symbiancommon.h
index 3efe5a4..dae1e4a 100644
--- a/qmake/generators/symbian/symbiancommon.h
+++ b/qmake/generators/symbian/symbiancommon.h
@@ -81,6 +81,8 @@ protected:
                       QString &iconFile,
                       QMap<QString, QStringList> &userRssRules);
 
+    void writeCustomDefFile();
+
     QStringList symbianLangCodesFromTsFiles();
     void fillQt2S60LangMapTable();
 
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index 1006e39..6082aeb 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -55,7 +55,6 @@
 #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 PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonu.def"
 #define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1)
 
 #define BLD_INF_RULES_BASE "BLD_INF_RULES."
@@ -264,40 +263,6 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t)
     return true;
 }
 
-void SymbianMakefileGenerator::writeCustomDefFile()
-{
-    if (targetType == TypePlugin && !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     : " << 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 SymbianMakefileGenerator::init()
 {
     MakefileGenerator::init();
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
index a584a9a..c5b6907 100644
--- a/qmake/generators/symbian/symmake.h
+++ b/qmake/generators/symbian/symmake.h
@@ -117,8 +117,6 @@ protected:
     void writeMmpFileBinaryVersionPart(QTextStream& t);
     void writeMmpFileRulesPart(QTextStream& t);
 
-    void writeCustomDefFile();
-
     void appendIfnotExist(QStringList &list, QString value);
     void appendIfnotExist(QStringList &list, QStringList values);
 
-- 
cgit v0.12