[Qt] Generate convenience headers (QWebView, etc) using qmake
authorvestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Feb 2010 13:23:15 +0000 (13:23 +0000)
committervestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Feb 2010 13:23:15 +0000 (13:23 +0000)
Reviewed by Simon Hausmann.

In Qt this is done using syncqt, but we use a pro-file instead
that generates makefile-rules for each of the extra headers.

These extra headers are installed alongside the normal headers.

WebCore:

* WebCore.pro: Use headers.pri based on DerivedSources instead
of the one previously checked in in the source tree.

WebKit/qt:

* Api/DerivedSources.pro: Added. List of headers + pro file magic
* Api/headers.pri: Removed, list of headers is now in the above file

WebKitTools:

* Scripts/webkitdirs.pm: Run qmake and make on new API-DerivedSources

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@54420 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
DerivedSources.pro
WebCore/ChangeLog
WebCore/WebCore.pro
WebKit/qt/Api/DerivedSources.pro [new file with mode: 0644]
WebKit/qt/Api/headers.pri [deleted file]
WebKit/qt/ChangeLog
WebKitTools/ChangeLog
WebKitTools/Scripts/webkitdirs.pm

index f8d081d7e7e4cf5befb8fdc8f4d68476b658ea72..998e1931c403a8f56fa245292626f2454c770b54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-02-05  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] Generate convenience headers (QWebView, etc) using qmake
+
+        In Qt this is done using syncqt, but we use a pro-file instead
+        that generates makefile-rules for each of the extra headers.
+
+        These extra headers are installed alongside the normal headers.
+
+        * DerivedSources.pro: Include API-DerivedSources
+
 2010-02-04  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
 
         Reviewed by Lars Knoll.
index adb17eb81df47eb683323031e77b4253b184e862..d1a4802686d3fec1ae1b4a71bf0ce6a870163cad 100644 (file)
@@ -3,7 +3,8 @@ CONFIG += ordered
 
 SUBDIRS += \
         JavaScriptCore/DerivedSources.pro \
-        WebCore/DerivedSources.pro
+        WebCore/DerivedSources.pro \
+        WebKit/qt/Api/DerivedSources.pro
 
 for(subpro, SUBDIRS) {
     subdir = $${dirname(subpro)}
index f52c9c5f172843b8256f2f1e2ec9591ca7ba2cf2..95a80b949da36eb8d36c79c91d9c01d14302d44e 100644 (file)
@@ -1,3 +1,17 @@
+2010-02-05  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] Generate convenience headers (QWebView, etc) using qmake
+
+        In Qt this is done using syncqt, but we use a pro-file instead
+        that generates makefile-rules for each of the extra headers.
+
+        These extra headers are installed alongside the normal headers.
+
+        * WebCore.pro: Use headers.pri based on DerivedSources instead
+        of the one previously checked in in the source tree.
+
 2010-02-05  Mikhail Naganov  <mnaganov@chromium.org>
 
         Reviewed by Pavel Feldman.
index be4244d2f044c2cd192449a638aca53b8ae2e9a8..4d2c597341aa94ff4c99ee854afbf7b87fe9c9a2 100644 (file)
@@ -2662,24 +2662,24 @@ SOURCES += \
 }
 }
 
-include($$PWD/../WebKit/qt/Api/headers.pri)
-HEADERS += $$WEBKIT_API_HEADERS
 CONFIG(standalone_package) {
+    include($$PWD/../include/headers.pri)
+} else {
+    include($$OUTPUT_DIR/include/headers.pri)
+}
 
-    !symbian {
-        target.path = $$[QT_INSTALL_LIBS]
-        INSTALLS += target
-    }
-
-    include($$PWD/../include/QtWebKit/headers.pri)
-    headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
-    headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit
-    INSTALLS += headers
+HEADERS += $$WEBKIT_API_HEADERS $$WEBKIT_CLASS_HEADERS
 
-} else {
+!symbian {
     target.path = $$[QT_INSTALL_LIBS]
-    headers.files = $$WEBKIT_API_HEADERS
-    headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit
+    INSTALLS += target
+}
+
+headers.files = $$WEBKIT_API_HEADERS $$WEBKIT_CLASS_HEADERS $$OUTPUT_DIR/include/headers.pri
+headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit
+INSTALLS += headers
+
+!CONFIG(standalone_package) {
 
     VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
 
@@ -2692,9 +2692,6 @@ CONFIG(standalone_package) {
         INSTALLS += dlltarget
     }
 
-
-    INSTALLS += target headers
-
     unix {
         CONFIG += create_pc create_prl
         QMAKE_PKGCONFIG_LIBDIR = $$target.path
@@ -2718,7 +2715,7 @@ CONFIG(standalone_package) {
 
             CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework
             FRAMEWORK_HEADERS.version = Versions
-            FRAMEWORK_HEADERS.files = $$WEBKIT_API_HEADERS
+            FRAMEWORK_HEADERS.files = $${headers.files}
             FRAMEWORK_HEADERS.path = Headers
             QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
         }
diff --git a/WebKit/qt/Api/DerivedSources.pro b/WebKit/qt/Api/DerivedSources.pro
new file mode 100644 (file)
index 0000000..529c20b
--- /dev/null
@@ -0,0 +1,105 @@
+TEMPLATE = lib
+TARGET = dummy
+
+WEBKIT_API_HEADERS = $$PWD/qwebframe.h \
+                     $$PWD/qgraphicswebview.h \
+                     $$PWD/qwebkitglobal.h \
+                     $$PWD/qwebpage.h \
+                     $$PWD/qwebview.h \
+                     $$PWD/qwebsettings.h \
+                     $$PWD/qwebhistoryinterface.h \
+                     $$PWD/qwebdatabase.h \
+                     $$PWD/qwebsecurityorigin.h \
+                     $$PWD/qwebelement.h \
+                     $$PWD/qwebpluginfactory.h \
+                     $$PWD/qwebhistory.h \
+                     $$PWD/qwebinspector.h \
+                     $$PWD/qwebkitversion.h
+
+WEBKIT_PRIVATE_HEADERS = $$PWD/qwebdatabase_p.h \
+                         $$PWD/qwebframe_p.h \
+                         $$PWD/qwebhistory_p.h \
+                         $$PWD/qwebinspector_p.h \
+                         $$PWD/qwebpage_p.h \
+                         $$PWD/qwebplugindatabase_p.h \
+                         $$PWD/qwebsecurityorigin_p.h
+
+
+CONFIG -= debug_and_release
+
+DESTDIR = ../../../include
+
+qtheader_module.target = $${DESTDIR}/QtWebKit
+qtheader_module.depends = $${_PRO_FILE_}
+eval(qtheader_module.commands = echo \\\'\$${LITERAL_HASH}ifndef QT_QTWEBKIT_MODULE_H\\\' > $${qtheader_module.target};)
+eval(qtheader_module.commands += echo \\\'\$${LITERAL_HASH}define QT_QTWEBKIT_MODULE_H\\\' >> $${qtheader_module.target};)
+eval(qtheader_module.commands += echo \\\'\$${LITERAL_HASH}include <QtNetwork/QtNetwork>\\\' >> $${qtheader_module.target};)
+WEBKIT_CLASS_HEADERS = ../include/QtWebKit
+
+regex = ".*\sclass\sQWEBKIT_EXPORT\s(\w+)\s(.*)"
+
+for(HEADER, WEBKIT_API_HEADERS) {
+    qtheader_module.depends += $$HEADER
+    eval(qtheader_module.commands += echo \\\'\$${LITERAL_HASH}include \\\"$$basename(HEADER)\\\"\\\' >> $${qtheader_module.target};)
+
+    HEADER_NAME = $$basename(HEADER)
+    HEADER_TARGET = $$replace(HEADER_NAME, [^a-zA-Z0-9_], -)
+    HEADER_TARGET = "qtheader-$${HEADER_TARGET}"
+
+    eval($${HEADER_TARGET}.target = $${DESTDIR}/$${HEADER_NAME})
+    eval($${HEADER_TARGET}.depends = $$HEADER)
+    eval($${HEADER_TARGET}.commands = echo \\\'\$${LITERAL_HASH}include \\\"$$HEADER\\\"\\\' > $$eval($${HEADER_TARGET}.target))
+
+    QMAKE_EXTRA_TARGETS += $$HEADER_TARGET
+
+    src_words = $$cat($$HEADER)
+    # Really make sure we're dealing with words
+    src_words = $$split(src_words, " ")
+
+    src = $$join(src_words, $${LITERAL_WHITESPACE})
+    for(ever) {
+        # Looking up by line is faster, so we try that first
+        res = $$find(src_words, "QWEBKIT_EXPORT")
+        isEmpty(res):break()
+
+        # Then do a slow lookup to ensure we're dealing with an exported class
+        res = $$find(src, $$regex)
+        isEmpty(res):break()
+
+        exp = $$replace(src, $$regex, "EXPORTED_CLASS = \1")
+        eval($$exp)
+
+        CLASS_TARGET = "qtheader_$${EXPORTED_CLASS}"
+
+        eval($${CLASS_TARGET}.target = $${DESTDIR}/$${EXPORTED_CLASS})
+        eval($${CLASS_TARGET}.depends = $$eval($${HEADER_TARGET}.target))
+        eval($${CLASS_TARGET}.commands = echo \\\'\$${LITERAL_HASH}include \\\"$$basename(HEADER)\\\"\\\' > $$eval($${CLASS_TARGET}.target))
+
+        QMAKE_EXTRA_TARGETS += $$CLASS_TARGET
+        WEBKIT_CLASS_HEADERS += ../include/$${EXPORTED_CLASS}
+
+        generated_files.depends += $$eval($${CLASS_TARGET}.target)
+        qtheader_pri.depends += $$eval($${CLASS_TARGET}.target)
+
+        # Qt's QRegExp does not support inline non-greedy matching,
+        # so we'll have to work around it by updating the haystack
+        src = $$replace(src, $$regex, "\2")
+        src_words = $$join(src, $${LITERAL_WHITESPACE})
+    }
+}
+
+eval(qtheader_module.commands += echo \\\'\$${LITERAL_HASH}endif // QT_QTWEBKIT_MODULE_H\\\' >> $${qtheader_module.target})
+QMAKE_EXTRA_TARGETS += qtheader_module
+
+qtheader_pri.target = $${DESTDIR}/headers.pri
+qtheader_pri.depends = $${WEBKIT_API_HEADERS} $${WEBKIT_PRIVATE_HEADERS} $${_PRO_FILE_}
+eval(qtheader_pri.commands = echo \\\'WEBKIT_API_HEADERS = $${WEBKIT_API_HEADERS}\\\' > $${qtheader_pri.target};)
+eval(qtheader_pri.commands += echo \\\'WEBKIT_CLASS_HEADERS = $${WEBKIT_CLASS_HEADERS}\\\' >> $${qtheader_pri.target};)
+eval(qtheader_pri.commands += echo \\\'WEBKIT_PRIVATE_HEADERS = $${WEBKIT_PRIVATE_HEADERS}\\\' >> $${qtheader_pri.target};)
+QMAKE_EXTRA_TARGETS += qtheader_pri
+
+generated_files.depends += $${qtheader_module.target} $${qtheader_pri.target}
+QMAKE_EXTRA_TARGETS += generated_files
+
+
+
diff --git a/WebKit/qt/Api/headers.pri b/WebKit/qt/Api/headers.pri
deleted file mode 100644 (file)
index 1a42597..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-WEBKIT_API_HEADERS = $$PWD/qwebframe.h \
-                     $$PWD/qgraphicswebview.h \
-                     $$PWD/qwebkitglobal.h \
-                     $$PWD/qwebpage.h \
-                     $$PWD/qwebview.h \
-                     $$PWD/qwebsettings.h \
-                     $$PWD/qwebhistoryinterface.h \
-                     $$PWD/qwebdatabase.h \
-                     $$PWD/qwebsecurityorigin.h \
-                     $$PWD/qwebelement.h \
-                     $$PWD/qwebpluginfactory.h \
-                     $$PWD/qwebhistory.h \
-                     $$PWD/qwebinspector.h \
-                     $$PWD/qwebkitversion.h
index dbc841eb4971c77dffad436720291222e75ab97b..5f6293e87d8921a83f1ebe6d23a1a8bbcc99c597 100644 (file)
@@ -1,3 +1,17 @@
+2010-02-05  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] Generate convenience headers (QWebView, etc) using qmake
+
+        In Qt this is done using syncqt, but we use a pro-file instead
+        that generates makefile-rules for each of the extra headers.
+
+        These extra headers are installed alongside the normal headers.
+
+        * Api/DerivedSources.pro: Added. List of headers + pro file magic
+        * Api/headers.pri: Removed, list of headers is now in the above file
+
 2010-02-04  No'am Rosenthal  <noam.rosenthal@nokia.com>
 
         Reviewed by Ariya Hidayat.
index e25c0c18fe08804781890311749f9c4b27f89774..40d19d2b9a722bc42312f22abf7fcc74a743a69d 100644 (file)
@@ -1,3 +1,16 @@
+2010-02-05  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] Generate convenience headers (QWebView, etc) using qmake
+
+        In Qt this is done using syncqt, but we use a pro-file instead
+        that generates makefile-rules for each of the extra headers.
+
+        These extra headers are installed alongside the normal headers.
+
+        * Scripts/webkitdirs.pm: Run qmake and make on new API-DerivedSources
+
 2010-02-05  Andras Becsi  <abecsi@webkit.org>
 
         Unreviewed typo fix.
index 8b2ecc13e5b07277df04993470bd9cf165536358..5ae4dce73f7ddf2f7a66a4202c16165aedc1907d 100644 (file)
@@ -1491,27 +1491,21 @@ sub buildQMakeProject($@)
 
     my $dsMakefile = "Makefile.DerivedSources";
 
-    print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/JavaScriptCore\n\n";
-    if ($make eq "nmake") {
-        $result = system "pushd JavaScriptCore && $make $makeargs -f $dsMakefile generated_files && popd";
-    } else {
-        $result = system "$make $makeargs -C JavaScriptCore -f $dsMakefile generated_files";
-    }
-    if ($result ne 0) {
-        die "Failed to generate JavaScriptCore's derived sources!\n";
-    }
-
-    print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/WebCore\n\n";
-    if ($make eq "nmake") {
-        $result = system "pushd WebCore && $make $makeargs -f $dsMakefile generated_files && popd";
-    } else {
-        $result = system "$make $makeargs -C WebCore -f $dsMakefile generated_files";
-    }
-    if ($result ne 0) {
-        die "Failed to generate WebCore's derived sources!\n";
+    # Iterate over different source directories manually to workaround a problem with qmake+extraTargets+s60
+    for my $subdir ("JavaScriptCore", "WebCore", "WebKit/qt/Api") {
+        print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/$subdir\n\n";
+        if ($make eq "nmake") {
+            my $subdirWindows = $subdir;
+            $subdirWindows =~ s:/:\\:g;
+            $result = system "pushd $subdirWindows && $make $makeargs -f $dsMakefile generated_files && popd";
+        } else {
+            $result = system "$make $makeargs -C $subdir -f $dsMakefile generated_files";
+        }
+        if ($result ne 0) {
+            die "Failed to generate ${subdir}'s derived sources!\n";
+        }
     }
 
-
     push @buildArgs, "OUTPUT_DIR=" . baseProductDir() . "/$config";
     push @buildArgs, sourceDir() . "/WebKit.pro";
     if ($config =~ m/debug/i) {