From 0d8f6a417d1ffb649787f5b67107fe99a876da1f Mon Sep 17 00:00:00 2001
From: Thomas Zander <t.zander@nokia.com>
Date: Wed, 7 Apr 2010 14:19:38 +0200
Subject: Various fixes for symbian/gcce building.

---
 mkspecs/common/symbian/symbian.conf           |  7 +++++-
 mkspecs/features/symbian/symbian_building.prf | 32 +++++++++++++++++----------
 mkspecs/symbian/linux-gcce/qmake.conf         | 11 +++++----
 3 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
index bd5768b..1865ff3 100644
--- a/mkspecs/common/symbian/symbian.conf
+++ b/mkspecs/common/symbian/symbian.conf
@@ -74,7 +74,12 @@ QMAKE_LIBS_OPENGL       =
 QMAKE_LIBS_OPENVG       = -llibOpenVG -lfbscli -lbitgdi -lgdi
 QMAKE_LIBS_THREAD       = -llibpthread
 QMAKE_LIBS_COMPAT       = 
-QMAKE_LIBS_QT_ENTRY     = -llibcrt0.lib
+linux-gcce {
+    QMAKE_LIBS_QT_ENTRY     = -llibcrt0_gcce.lib
+    contains(TEMPLATE, ".*app"):QMAKE_LIBS_QT_ENTRY += -leexe.lib
+} else {
+    QMAKE_LIBS_QT_ENTRY     = -llibcrt0.lib
+}
 QMAKE_LIBS_S60          = -lavkon
 
 exists($${EPOCROOT}epoc32/include/platform/sgresource/sgimage.h) {
diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf
index ef03b0a..e5444a1 100644
--- a/mkspecs/features/symbian/symbian_building.prf
+++ b/mkspecs/features/symbian/symbian_building.prf
@@ -45,15 +45,6 @@ for(libraries, QMAKE_LIBS) {
 }
 QMAKE_LIBS = $$newLIBS
 
-linux-gcce {
-    QMAKE_LIBS	+= -l:usrt2_2.lib \
-                   -l:dfpaeabi.dso \
-                   -l:drtaeabi.dso \
-                   -l:scppnwdl.dso \
-                   -lsupc++ \
-                   -lgcc
-}
-
 elf2e32_LIBPATH =
 for(libPath, QMAKE_LIBDIR) {
     elf2e32_LIBPATH += "--libpath=$$libPath"
@@ -131,7 +122,13 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) {
     linux-armcc: {
         QMAKE_LIBS += -ledllstub.lib -ledll.lib\\(uc_dll_.o\\)
     } else :linux-gcce {
-        #QMAKE_LIBS += -l:edllstub.lib -l:edll.lib
+        QMAKE_LIBS += \
+            -l:usrt2_2.lib \
+            -l:dfpaeabi.dso \
+            -l:drtaeabi.dso \
+            -l:scppnwdl.dso \
+            -lsupc++ \
+            -lgcc
     }
 
     QMAKE_LFLAGS += --soname $${TARGET}\\{$${hexVersion}\\}\\[$${intUid3}\\].dll
@@ -163,11 +160,22 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@.*") {
     linux-armcc: {
         QMAKE_LIBS += -leexe.lib\\(uc_exe_.o\\)
     } else :linux-gcce {
-        #QMAKE_LIBS += -l:eexe.lib
+        QMAKE_LIBS += \
+            -l:eexe.lib \
+            -l:usrt2_2.lib \
+            -l:qtmain.lib \
+            -l:dfpaeabi.dso \
+            -l:drtaeabi.dso \
+            -l:scppnwdl.dso \
+            -lsupc++ \
+            -lgcc
+        QMAKE_LFLAGS += --shared
+        isEmpty(QT) { # we need QtCore for this.
+            QMAKE_LIBS -= -l:qtmain.lib
+        }
     }
 
     QMAKE_LFLAGS += --soname $${TARGET}\\{$${hexVersion}\\}\\[$${intUid3}\\].exe
-# TODO gcce added --shared here...
     DEFINES += __EXE__
 }
 
diff --git a/mkspecs/symbian/linux-gcce/qmake.conf b/mkspecs/symbian/linux-gcce/qmake.conf
index de3791c..c75e46e 100644
--- a/mkspecs/symbian/linux-gcce/qmake.conf
+++ b/mkspecs/symbian/linux-gcce/qmake.conf
@@ -53,17 +53,20 @@ DEFINES		+= __GCCE__ \
                    UNICODE \
                    _STLP_NO_EXCEPTION_HEADER
 
-QMAKE_LFLAGS_APP        += --entry _E32Startup
+QMAKE_LFLAGS_APP        += --entry=_E32Startup -u _E32Startup
 QMAKE_LFLAGS_SHLIB      += --default-symver --entry _E32Dll
 QMAKE_LFLAGS_PLUGIN     += $$QMAKE_LFLAGS_SHLIB
 
-gcceExtraFlags = --include=${EPOCROOT}epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -fvisibility-inlines-hidden -msoft-float -T script
+gcceExtraFlags = --include=${EPOCROOT}/epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script
 QMAKE_CFLAGS += $${gcceExtraFlags}
-QMAKE_CXXFLAGS += $${gcceExtraFlags} -x c++ -fexceptions -fno-unit-at-a-time
+QMAKE_CXXFLAGS += $${gcceExtraFlags} -x c++ -fexceptions -fno-unit-at-a-time -fvisibility-inlines-hidden
+#If we are not going to link to Qt or qtmain.lib, we need to include this at least once.
+isEmpty(QT):contains(TEMPLATE, app) {
+    QMAKE_CXXFLAGS += --include=${EPOCROOT}/epoc32/include/stdapis/staticlibinit_gcce.h
+}
 
 QMAKE_LFLAGS += --target1-abs \
                 --no-undefined \
-                --strip-debug \
                 --nostdlib
 
 QMAKE_LIBDIR	+= ${EPOCROOT}/epoc32/release/armv5/udeb/
-- 
cgit v0.12