[geary] Compile with WebKitGTK 2.3.x: Closes bgno#720315



commit 26982f9bc4e36ae0e13fe40e4059eeb9e0ee3d27
Author: Jim Nelson <jim yorba org>
Date:   Tue Dec 17 19:00:11 2013 -0800

    Compile with WebKitGTK 2.3.x: Closes bgno#720315
    
    WebKitGTK 2.4 will introduce using GClosure to register
    DOM.EventTarget listeners, but old API still available, so using
    that for now.
    
    This also introduces compiling WebKit-3.0.gir to a VAPI and using
    that during compilation.  This means that .gir warnings won't
    cause compilation errors (--fatal-warnings) and that we have a bit
    more control over binding generation.  Closes bgno#720442.

 CMakeLists.txt                                     |    9 +++-
 .../metadata/webkitgtk-2.2/WebKit-3.0.metadata     |    2 +
 .../metadata/webkitgtk-2.4/WebKit-3.0-custom.vala  |   10 ++++
 .../metadata/webkitgtk-2.4/WebKit-3.0.metadata     |   14 +++++
 src/CMakeLists.txt                                 |   53 +++++++++++++++++---
 5 files changed, 79 insertions(+), 9 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a991c61..7b4f4e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,8 +52,13 @@ endif ()
 find_package(PkgConfig)
 pkg_check_modules(LIBUNITY QUIET unity>=5.12.0)
 pkg_check_modules(LIBMESSAGINGMENU QUIET messaging-menu>=12.10.2)
-pkg_check_modules(WEBKITGTK110X QUIET webkitgtk-3.0<=1.10.2)
-pkg_check_modules(WEBKITGTK22X QUIET webkitgtk-3.0>=2.2.0)
+
+# CMake's range-checking syntax doesn't allow for a bare less-than, so using
+# improbably high version numbers to indicate maximum
+pkg_check_modules(WEBKITGTK24X QUIET webkitgtk-3.0>=2.3.0)
+pkg_check_modules(WEBKITGTK22X QUIET webkitgtk-3.0>=2.2.0 webkitgtk-3.0<=2.2.100)
+pkg_check_modules(WEBKITGTK20X QUIET webkitgtk-3.0>=2.0.0 webkitgtk-3.0<=2.0.100)
+pkg_check_modules(WEBKITGTK110X QUIET webkitgtk-3.0>=1.10.0 webkitgtk-3.0<=1.10.2)
 
 # intl
 include(Gettext)
diff --git a/bindings/metadata/webkitgtk-2.2/WebKit-3.0.metadata 
b/bindings/metadata/webkitgtk-2.2/WebKit-3.0.metadata
index c19e0c5..d7e39f7 100644
--- a/bindings/metadata/webkitgtk-2.2/WebKit-3.0.metadata
+++ b/bindings/metadata/webkitgtk-2.2/WebKit-3.0.metadata
@@ -22,3 +22,5 @@ DOMWebKitNamedFlow.dispatch_event type="void"
 DOMDOMApplicationCache.dispatch_event type="void"
 DOMDOMWindow.dispatch_event type="void"
 
+WebFrame.get_global_context skip
+
diff --git a/bindings/metadata/webkitgtk-2.4/WebKit-3.0-custom.vala 
b/bindings/metadata/webkitgtk-2.4/WebKit-3.0-custom.vala
new file mode 100644
index 0000000..e1eb544
--- /dev/null
+++ b/bindings/metadata/webkitgtk-2.4/WebKit-3.0-custom.vala
@@ -0,0 +1,10 @@
+namespace WebKit {
+    namespace DOM {
+        [CCode (cheader_filename="webkit/webkit.h", type_id="webkit_dom_event_target_get_type()")]
+        public interface EventTarget {
+            public abstract bool add_event_listener(string event_name, GLib.Callback handler, bool 
use_capture, GLib.Object? object);
+            public abstract bool remove_event_listener(string event_name, GLib.Callback handler, bool 
use_capture);
+        }
+    }
+}
+
diff --git a/bindings/metadata/webkitgtk-2.4/WebKit-3.0.metadata 
b/bindings/metadata/webkitgtk-2.4/WebKit-3.0.metadata
new file mode 100644
index 0000000..4ea60ae
--- /dev/null
+++ b/bindings/metadata/webkitgtk-2.4/WebKit-3.0.metadata
@@ -0,0 +1,14 @@
+DOM* parent="WebKit.DOM" name="DOM(.+)"
+
+DOMEventTarget.add_event_listener skip=true
+DOMEventTarget.add_event_listener_with_closure skip=true
+DOMEventTarget.remove_event_listener skip=true
+DOMEventTarget.remove_event_listener_with_closure skip=true
+
+WebView.entering_fullscreen#signal name="entering_fullscreen_signal"
+WebView.leaving_fullscreen#signal name="leaving_fullscreen_signal"
+
+WebView.move_cursor#virtual_method name="leaving_fullscreen_method"
+WebSettings.enable_default_context_menu#property deprecated=false
+
+WebFrame.get_global_context skip
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d9e96a4..6115f71 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -398,6 +398,14 @@ include(ValaVersion)
 ensure_vala_version("0.22.1" MINIMUM)
 include(ValaPrecompile)
 
+# Vapigen
+find_program(VAPIGEN vapigen)
+if (VAPIGEN STREQUAL "VAPIGEN-NOTFOUND")
+    message(FATAL_ERROR "vapigen must be installed to build Geary.")
+else ()
+    message(STATUS "Found vapigen: " ${VAPIGEN})
+endif ()
+
 # Packages
 if (LIBMESSAGINGMENU_FOUND)
     message(STATUS "Unity messaging menu support: ON")
@@ -439,28 +447,32 @@ else ()
     message(STATUS "Unity launcher support: OFF")
 endif ()
 
-if (WEBKITGTK110X_FOUND)
-    message(STATUS "Targeting WebKitGTK 1.10")
+if (WEBKITGTK24X_FOUND)
+    message(STATUS "Targeting WebKitGTK 2.4")
     SET(EXTRA_CLIENT_PKG_CONFIG
         ${EXTRA_CLIENT_PKG_CONFIG}
-        webkitgtk-3.0>=1.10.0
-        webkitgtk-3.0<=1.10.2
+        webkitgtk-3.0>=2.3.0
     )
     
     SET(WEBKITGTK_METADATA_DIR
-        webkitgtk-1.10
+        webkitgtk-2.4
     )
+       
+       SET(WEBKITGTK_CUSTOM_VALA
+               webkitgtk-2.4/WebKit-3.0-custom.vala
+       )
 elseif (WEBKITGTK22X_FOUND)
     message(STATUS "Targeting WebKitGTK 2.2")
     SET(EXTRA_CLIENT_PKG_CONFIG
         ${EXTRA_CLIENT_PKG_CONFIG}
         webkitgtk-3.0>=2.2.0
+        webkitgtk-3.0<=2.2.100
     )
     
     SET(WEBKITGTK_METADATA_DIR
         webkitgtk-2.2
     )
-else ()
+elseif (WEBKITGTK20X_FOUND)
     message(STATUS "Targeting WebKitGTK 2.0")
     SET(EXTRA_CLIENT_PKG_CONFIG
         ${EXTRA_CLIENT_PKG_CONFIG}
@@ -471,6 +483,19 @@ else ()
     SET(WEBKITGTK_METADATA_DIR
         webkitgtk-2.0
     )
+elseif (WEBKITGTK110X_FOUND)
+    message(STATUS "Targeting WebKitGTK 1.10")
+    SET(EXTRA_CLIENT_PKG_CONFIG
+        ${EXTRA_CLIENT_PKG_CONFIG}
+        webkitgtk-3.0>=1.10.0
+        webkitgtk-3.0<=1.10.2
+    )
+    
+    SET(WEBKITGTK_METADATA_DIR
+        webkitgtk-1.10
+    )
+else ()
+    message(FATAL_ERROR "WebKitGTK not installed / unknown version detected")
 endif ()
 
 if (NO_FATAL_WARNINGS)
@@ -505,8 +530,10 @@ set(ENGINE_PACKAGES
     glib-2.0 gee-0.8 gio-2.0 gmime-2.6 posix sqlite3 libxml-2.0
 )
 
+# webkitgtk-3.0 is listed as a custom VAPI (below) to ensure it's treated as a dependency and
+# built before compilation
 set(CLIENT_PACKAGES
-    gtk+-3.0 libsecret-1 WebKit-3.0 libnotify libcanberra ${EXTRA_CLIENT_PACKAGES}
+    gtk+-3.0 libsecret-1 libsoup-2.4 libnotify libcanberra ${EXTRA_CLIENT_PACKAGES}
 )
 
 set(CONSOLE_PACKAGES
@@ -580,6 +607,17 @@ OPTIONS
 add_library(geary-static STATIC ${ENGINE_VALA_C})
 target_link_libraries(geary-static ${DEPS_LIBRARIES} sqlite3-unicodesn gthread-2.0)
 
+# WebKitGTK VAPI generation
+#################################################
+add_custom_command(
+    OUTPUT
+        ${CMAKE_BINARY_DIR}/src/webkitgtk-3.0.vapi
+    WORKING_DIRECTORY
+        ${CMAKE_SOURCE_DIR}/bindings/metadata
+    COMMAND
+        vapigen --pkg=gio-2.0 --pkg=gtk+-3.0 --pkg=libsoup-2.4 --metadatadir=. 
--metadatadir=${WEBKITGTK_METADATA_DIR} --library=webkitgtk-3.0 --directory=${CMAKE_BINARY_DIR}/src 
${WEBKITGTK_CUSTOM_VALA} `pkg-config --variable=girdir gobject-introspection-1.0`/WebKit-3.0.gir
+)
+
 # Geary client app
 #################################################
 vala_precompile(GEARY_VALA_C geary
@@ -589,6 +627,7 @@ PACKAGES
     ${ENGINE_PACKAGES}
 CUSTOM_VAPIS
     "${CMAKE_BINARY_DIR}/src/geary-static.vapi"
+    "${CMAKE_BINARY_DIR}/src/webkitgtk-3.0.vapi"
 OPTIONS
     ${VALAC_OPTIONS}
     --vapidir=${CMAKE_BINARY_DIR}/src


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]