[geary/wip/728002-webkit2: 27/46] Depend on javascriptcore, generate webkit2 VAPI that uses it.



commit 73b269d81951e31bdcb47db69debebf83f0c59d3
Author: Michael James Gratton <mike vee net>
Date:   Wed Nov 23 22:56:45 2016 +1100

    Depend on javascriptcore, generate webkit2 VAPI that uses it.
    
    This gives us a means of using JS objects returned by UserContentManager
    script messages directly from Vala.
    
    * bindings/metadata/WebKit2-4.0.metadata: Tweak standard webkit2 VAPI to
      re-include methods that return javascriptcore objects.
    
    * bindings/vapi/javascriptcore-4.0.vapi: Copy generated VAPI file into
      the tree, customise it so that it actually works.
    
    * src/CMakeLists.txt: Generate the custom webkit2 VAPI, depend on
      javascriptcore and include in-tree javascriptcore VAPI in the client
      build.
    
    * bindings/metadata/JSCore-3.0.metadata: Remove obsolete file.

 bindings/metadata/JSCore-3.0.metadata  |    3 ---
 bindings/metadata/WebKit2-4.0.metadata |   14 ++++++++++++++
 bindings/vapi/javascriptcore-4.0.vapi  |   15 +++++++++++++++
 src/CMakeLists.txt                     |   23 +++++++++++++++++++----
 4 files changed, 48 insertions(+), 7 deletions(-)
---
diff --git a/bindings/metadata/WebKit2-4.0.metadata b/bindings/metadata/WebKit2-4.0.metadata
new file mode 100644
index 0000000..ad053ee
--- /dev/null
+++ b/bindings/metadata/WebKit2-4.0.metadata
@@ -0,0 +1,14 @@
+
+JavascriptResult
+    .get_global_context nullable=false unowned=true
+    .get_value nullable=false unowned=true
+
+//Forward upstream
+Download
+  .failed#signal.error type="WebKit.DownloadError"
+PrintOperation
+  .failed#signal.error type="WebKit.PrintError"
+WebResource
+  .failed#signal.error type="GLib.Error"
+WebView
+  .load_failed#signal.error type="GLib.Error"
diff --git a/bindings/vapi/javascriptcore-4.0.vapi b/bindings/vapi/javascriptcore-4.0.vapi
new file mode 100644
index 0000000..5d535a3
--- /dev/null
+++ b/bindings/vapi/javascriptcore-4.0.vapi
@@ -0,0 +1,15 @@
+/* javascriptcore-4.0.vapi. */
+
+[CCode (cprefix = "JS", gir_namespace = "JavaScriptCore", gir_version = "4.0", lower_case_cprefix = "JS_", 
cheader_filename = "JavaScriptCore/JavaScript.h")]
+namespace JS {
+
+       [CCode (cname = "JSGlobalContextRef")]
+    [SimpleType]
+       public struct GlobalContext {
+       }
+
+       [CCode (cname = "JSValueRef")]
+    [SimpleType]
+       public struct Value {
+       }
+}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a8efdd7..eecee92 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -506,6 +506,7 @@ pkg_check_modules(DEPS REQUIRED
     gobject-introspection-1.0
     webkit2gtk-4.0>=${TARGET_WEBKIT}
     webkit2gtk-web-extension-4.0>=${TARGET_WEBKIT}
+    javascriptcoregtk-4.0>=${TARGET_WEBKIT}
     enchant>=1.6
     ${EXTRA_CLIENT_PKG_CONFIG}
 )
@@ -523,9 +524,10 @@ set(ENGINE_PACKAGES
     glib-2.0 gee-0.8 gio-2.0 gmime-2.6 posix sqlite3 libxml-2.0
 )
 
+# webkit2gtk-4.0 is included as custom VAPI below
 set(CLIENT_PACKAGES
-    gtk+-3.0 libsecret-1 webkit2gtk-4.0 libsoup-2.4 libnotify
-    libcanberra gcr-3 enchant ${EXTRA_CLIENT_PACKAGES}
+  gtk+-3.0 javascriptcore-4.0 libsecret-1 libsoup-2.4 libnotify libcanberra
+  gcr-3 enchant ${EXTRA_CLIENT_PACKAGES}
 )
 
 set(WEB_PROCESS_PACKAGES
@@ -585,7 +587,6 @@ add_definitions(${CFLAGS})
 
 set(VALAC_OPTIONS
     --vapidir=${CMAKE_SOURCE_DIR}/bindings/vapi
-    --vapidir=/home/mjg/Projects/GNOME/vala/vapi
     --metadatadir=${CMAKE_SOURCE_DIR}/bindings/metadata
     --target-glib=${TARGET_GLIB}
     --thread
@@ -619,6 +620,20 @@ set_property(
 add_dependencies(geary-static git-version)
 target_link_libraries(geary-static ${DEPS_LIBRARIES} sqlite3-unicodesn gthread-2.0)
 
+# WebKit2GTK VAPI generation
+#################################################
+add_custom_command(
+    OUTPUT
+        ${CMAKE_BINARY_DIR}/src/webkit2gtk-4.0.vapi
+    DEPENDS
+        ${CMAKE_SOURCE_DIR}/bindings/metadata/WebKit2-4.0.metadata
+        ${CMAKE_SOURCE_DIR}/bindings/vapi/javascriptcore-4.0.vapi
+    WORKING_DIRECTORY
+        ${CMAKE_SOURCE_DIR}/bindings/metadata
+    COMMAND
+        vapigen --library=webkit2gtk-4.0 --pkg gtk+-3.0 --pkg libsoup-2.4 --pkg javascriptcore-4.0 
--vapidir=${CMAKE_SOURCE_DIR}/bindings/vapi --metadatadir=${CMAKE_SOURCE_DIR}/bindings/metadata 
--directory=${CMAKE_BINARY_DIR}/src `${PKG_CONFIG_EXECUTABLE} --variable=girdir 
gobject-introspection-1.0`/WebKit2-4.0.gir
+)
+
 # Geary client app
 #################################################
 set_property(SOURCE ${RESOURCES_C} PROPERTY GENERATED TRUE)
@@ -631,9 +646,9 @@ PACKAGES
     ${ENGINE_PACKAGES}
 CUSTOM_VAPIS
     "${CMAKE_BINARY_DIR}/src/geary-static.vapi"
+    "${CMAKE_BINARY_DIR}/src/webkit2gtk-4.0.vapi"
 OPTIONS
     ${VALAC_OPTIONS}
-    --vapidir=${CMAKE_BINARY_DIR}/src
     --gresources=${RESOURCES_XML}
 )
 


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