2d670be
From 9e5a1b618ea7bf579c7b2d66a8844d606405bc6d Mon Sep 17 00:00:00 2001
2d670be
From: Anders Bakken <agbakken@gmail.com>
2d670be
Date: Mon, 20 Sep 2010 19:14:10 +0200
2d670be
Subject: [PATCH] Enable building Qt/Webkit with debug symbols
2d670be
2d670be
With this patch one can configure with -webkit-debug to build Webkit
2d670be
with debug symbols without having to manually edit WebCore.pro.
2d670be
2d670be
Merge-request: 816
2d670be
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2d670be
---
2d670be
 configure                               |   50 +++++++++++++++++++------------
2d670be
 src/3rdparty/webkit/WebCore/WebCore.pro |    2 +-
2d670be
 tools/configure/configureapp.cpp        |   16 ++++++++--
2d670be
 3 files changed, 45 insertions(+), 23 deletions(-)
2d670be
2d670be
diff --git a/configure b/configure
2d670be
index da6fb0a..4316cc8 100755
2d670be
--- a/configure
2d670be
+++ b/configure
2d670be
@@ -686,7 +686,7 @@ CFG_AUDIO_BACKEND=auto
2d670be
 CFG_SVG=auto
2d670be
 CFG_DECLARATIVE=auto
2d670be
 CFG_DECLARATIVE_DEBUG=yes
2d670be
-CFG_WEBKIT=auto # (yes|no|auto)
2d670be
+CFG_WEBKIT=auto # (yes|no|auto|debug)
2d670be
 CFG_JAVASCRIPTCORE_JIT=auto
2d670be
 
2d670be
 CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen directfb"
2d670be
@@ -939,13 +939,26 @@ while [ "$#" -gt 0 ]; do
2d670be
         VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
2d670be
         VAL=`echo $1 | sed "s,^-\([^-]*\).*,\1,"`
2d670be
         ;;
2d670be
+    #WebKit options
2d670be
+    -webkit)
2d670be
+        VAR="webkit"
2d670be
+        VAL="yes"
2d670be
+        ;;
2d670be
+    -webkit-debug)
2d670be
+        VAR="webkit"
2d670be
+        VAL="debug"
2d670be
+        ;;
2d670be
+    -no-webkit)
2d670be
+        VAR="webkit"
2d670be
+        VAL="no"
2d670be
+        ;;
2d670be
     #Qt style no options
2d670be
     -no-*)
2d670be
         VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
2d670be
         VAL=no
2d670be
         ;;
2d670be
     #Qt style yes options
2d670be
-        -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles)
2d670be
+        -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles)
2d670be
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
2d670be
         VAL=yes
2d670be
         ;;
2d670be
@@ -2010,15 +2023,8 @@ while [ "$#" -gt 0 ]; do
2d670be
         fi
2d670be
         ;;
2d670be
     webkit)
2d670be
-        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
2d670be
-            CFG_WEBKIT="yes"
2d670be
-        else
2d670be
-            if [ "$VAL" = "no" ]; then
2d670be
-                CFG_WEBKIT="no"
2d670be
-            else
2d670be
-                UNKNOWN_OPT=yes
2d670be
-            fi
2d670be
-        fi
2d670be
+        [ "$VAL" = "auto" ] && VAL="yes"
2d670be
+        CFG_WEBKIT="$VAL"
2d670be
         ;;
2d670be
     javascript-jit)
2d670be
         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then 
2d670be
@@ -3535,10 +3541,10 @@ Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir
2d670be
         [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
2d670be
         [-no-media-backend] [-media-backend] [-no-audio-backend] [-audio-backend] 
2d670be
         [-no-openssl] [-openssl] [-openssl-linked]
2d670be
-        [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit]
2d670be
+        [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-webkit-debug]
2d670be
+        [-no-javascript-jit] [-javascript-jit]
2d670be
         [-no-script] [-script] [-no-scripttools] [-scripttools] 
2d670be
 	[-no-declarative] [-declarative][-no-declarative-debug] [-declarative-debug]
2d670be
-
2d670be
         [additional platform specific options (see below)]
2d670be
 
2d670be
 
2d670be
@@ -3690,6 +3696,7 @@ fi
2d670be
     -no-webkit ......... Do not build the WebKit module.
2d670be
  +  -webkit ............ Build the WebKit module.
2d670be
                          WebKit is built if a decent C++ compiler is used.
2d670be
+    -webkit-debug ...... Build the WebKit module with debug symbols.
2d670be
 
2d670be
     -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
2d670be
  +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
2d670be
@@ -7191,14 +7198,15 @@ if [ "$CFG_WEBKIT" = "auto" ]; then
2d670be
     CFG_WEBKIT="$canBuildWebKit"
2d670be
 fi
2d670be
 
2d670be
-if [ "$CFG_WEBKIT" = "yes" ]; then
2d670be
+if [ "$CFG_WEBKIT" != "no" ]; then
2d670be
     # This include takes care of adding "webkit" to QT_CONFIG.
2d670be
     cp -f "$relpath/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri" "$outpath/mkspecs/modules/qt_webkit_version.pri"
2d670be
     # The reason we set CFG_WEBKIT, is such that the printed overview of what will be enabled, shows correctly.
2d670be
-    CFG_WEBKIT="yes"
2d670be
+    if [ "$CFG_WEBKIT" = "debug" ]; then
2d670be
+        QMAKE_CONFIG="$QMAKE_CONFIG webkit-debug"
2d670be
+    fi
2d670be
 else
2d670be
     rm -f "$outpath/mkspecs/modules/qt_webkit_version.pri"
2d670be
-    CFG_WEBKIT="no"
2d670be
     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WEBKIT"
2d670be
 fi
2d670be
 
2d670be
@@ -8130,7 +8138,7 @@ EOF
2d670be
 *) ;;
2d670be
 esac
2d670be
 
2d670be
-if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "no" ]  && [ "$CFG_WEBKIT" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2d670be
+if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "no" ]  && [ "$CFG_WEBKIT" != "no" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
2d670be
     cat <
2d670be
         WARNING: DWARF2 debug symbols are not enabled. Linking webkit
2d670be
         in debug mode will run out of memory on systems with 2GB or less.
2d670be
@@ -8207,8 +8215,12 @@ echo "QtXmlPatterns module ... $CFG_XMLPATTERNS"
2d670be
 echo "Phonon module .......... $CFG_PHONON"
2d670be
 echo "Multimedia module ...... $CFG_MULTIMEDIA"
2d670be
 echo "SVG module ............. $CFG_SVG"
2d670be
-echo "WebKit module .......... $CFG_WEBKIT"
2d670be
-if [ "$CFG_WEBKIT" = "yes" ]; then 
2d670be
+case "$CFG_WEBKIT" in
2d670be
+    yes)   echo "WebKit module .......... yes" ;;
2d670be
+    debug) echo "WebKit module .......... yes (debug)" ;;
2d670be
+    no)    echo "WebKit module .......... no" ;;
2d670be
+esac
2d670be
+if [ "$CFG_WEBKIT" != "no" ]; then
2d670be
     if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
2d670be
         echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
2d670be
     else
2d670be
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
2d670be
index 5f688f3..6b21d8a 100644
2d670be
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
2d670be
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
2d670be
@@ -2952,7 +2952,7 @@ HEADERS += $$WEBKIT_API_HEADERS
2d670be
     }
2d670be
 }
2d670be
 
2d670be
-CONFIG(QTDIR_build) {
2d670be
+!CONFIG(webkit-debug):CONFIG(QTDIR_build) {
2d670be
     # Remove the following 2 lines if you want debug information in WebCore
2d670be
     CONFIG -= separate_debug_info
2d670be
     CONFIG += no_debug_info
2d670be
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
2d670be
index a2c7fe9..17bbadf 100644
2d670be
--- a/tools/configure/configureapp.cpp
2d670be
+++ b/tools/configure/configureapp.cpp
2d670be
@@ -958,6 +958,8 @@ void Configure::parseCmdLine()
2d670be
             dictionary[ "WEBKIT" ] = "no";
2d670be
         } else if (configCmdLine.at(i) == "-webkit") {
2d670be
             dictionary[ "WEBKIT" ] = "yes";
2d670be
+        } else if (configCmdLine.at(i) == "-webkit-debug") {
2d670be
+            dictionary[ "WEBKIT" ] = "debug";
2d670be
         } else if (configCmdLine.at(i) == "-no-declarative") {
2d670be
             dictionary[ "DECLARATIVE" ] = "no";
2d670be
         } else if (configCmdLine.at(i) == "-declarative") {
2d670be
@@ -1651,7 +1653,7 @@ bool Configure::displayHelp()
2d670be
                     "[-phonon] [-no-phonon-backend] [-phonon-backend]\n"
2d670be
                     "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n"
2d670be
                     "[-no-script] [-script] [-no-scripttools] [-scripttools]\n"
2d670be
-                    "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7);
2d670be
+                    "[-no-webkit] [-webkit] [-webkit-debug] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7);
2d670be
 
2d670be
         desc("Installation options:\n\n");
2d670be
 
2d670be
@@ -1835,6 +1837,7 @@ bool Configure::displayHelp()
2d670be
         desc("AUDIO_BACKEND", "yes","-audio-backend",   "Compile in the platform audio backend into QtMultimedia");
2d670be
         desc("WEBKIT", "no",    "-no-webkit",           "Do not compile in the WebKit module");
2d670be
         desc("WEBKIT", "yes",   "-webkit",              "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)");
2d670be
+        desc("WEBKIT", "debug", "-webkit-debug",        "Compile in the WebKit module with debug symbols.");
2d670be
         desc("SCRIPT", "no",    "-no-script",           "Do not build the QtScript module.");
2d670be
         desc("SCRIPT", "yes",   "-script",              "Build the QtScript module.");
2d670be
         desc("SCRIPTTOOLS", "no", "-no-scripttools",    "Do not build the QtScriptTools module.");
2d670be
@@ -2692,10 +2695,12 @@ void Configure::generateOutputVars()
2d670be
 
2d670be
     QString dst = buildPath + "/mkspecs/modules/qt_webkit_version.pri";
2d670be
     QFile::remove(dst);
2d670be
-    if (dictionary["WEBKIT"] == "yes") {
2d670be
+    if (dictionary["WEBKIT"] != "no") {
2d670be
         // This include takes care of adding "webkit" to QT_CONFIG.
2d670be
         QString src = sourcePath + "/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri";
2d670be
         QFile::copy(src, dst);
2d670be
+        if (dictionary["WEBKIT"] == "debug")
2d670be
+            qtConfig += "webkit-debug";
2d670be
     }
2d670be
 
2d670be
     if (dictionary["DECLARATIVE"] == "yes") {
2d670be
@@ -3406,7 +3411,12 @@ void Configure::displayConfig()
2d670be
     cout << "QtXmlPatterns support......." << dictionary[ "XMLPATTERNS" ] << endl;
2d670be
     cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl;
2d670be
     cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl;
2d670be
-    cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl;
2d670be
+    {
2d670be
+        QString webkit = dictionary[ "WEBKIT" ];
2d670be
+        if (webkit == "debug")
2d670be
+            webkit = "yes (debug)";
2d670be
+        cout << "WebKit support.............." << webkit;
2d670be
+    }
2d670be
     cout << "Declarative support........." << dictionary[ "DECLARATIVE" ] << endl;
2d670be
     cout << "Declarative debugging......." << dictionary[ "DECLARATIVE_DEBUG" ] << endl;
2d670be
     cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl;
2d670be
-- 
2d670be
1.6.1
2d670be