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.
This commit is contained in:
Michael James Gratton 2016-11-23 22:56:45 +11:00
parent 330dc10f71
commit f51f55cd78
5 changed files with 52 additions and 5 deletions

View file

@ -1,3 +0,0 @@
GlobalContextRef skip
ObjectRef skip

View file

@ -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"

View file

@ -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 {
}
}

View file

@ -505,6 +505,7 @@ pkg_check_modules(DEPS REQUIRED
gobject-introspection-1.0 gobject-introspection-1.0
webkit2gtk-4.0>=${TARGET_WEBKIT} webkit2gtk-4.0>=${TARGET_WEBKIT}
webkit2gtk-web-extension-4.0>=${TARGET_WEBKIT} webkit2gtk-web-extension-4.0>=${TARGET_WEBKIT}
javascriptcoregtk-4.0>=${TARGET_WEBKIT}
enchant>=1.6 enchant>=1.6
${EXTRA_CLIENT_PKG_CONFIG} ${EXTRA_CLIENT_PKG_CONFIG}
) )
@ -534,6 +535,7 @@ set(CLIENT_PACKAGES
geary-engine geary-engine
gio-2.0 gio-2.0
gtk+-3.0 gtk+-3.0
javascriptcore-4.0
libcanberra libcanberra
libnotify libnotify
libsecret-1 libsecret-1
@ -602,8 +604,8 @@ link_directories(${LIB_PATHS})
add_definitions(${CFLAGS}) add_definitions(${CFLAGS})
set(VALAC_OPTIONS set(VALAC_OPTIONS
--vapidir=${CMAKE_SOURCE_DIR}/bindings/vapi
--vapidir=${CMAKE_BINARY_DIR}/src --vapidir=${CMAKE_BINARY_DIR}/src
--vapidir=${CMAKE_SOURCE_DIR}/bindings/vapi
--metadatadir=${CMAKE_SOURCE_DIR}/bindings/metadata --metadatadir=${CMAKE_SOURCE_DIR}/bindings/metadata
--target-glib=${TARGET_GLIB} --target-glib=${TARGET_GLIB}
--thread --thread
@ -636,6 +638,23 @@ set_property(
) )
target_link_libraries(geary-engine m ${DEPS_LIBRARIES} sqlite3-unicodesn) target_link_libraries(geary-engine m ${DEPS_LIBRARIES} sqlite3-unicodesn)
# WebKit2GTK VAPI generation
#################################################
add_custom_target(webkit2gtk-vapi
DEPENDS "${CMAKE_BINARY_DIR}/src/webkit2gtk-4.0.vapi"
)
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
)
# Client library (static lib used for building client and unit tests) # Client library (static lib used for building client and unit tests)
################################################# #################################################
@ -652,7 +671,7 @@ OPTIONS
) )
add_library(geary-client STATIC ${CLIENT_VALA_C}) add_library(geary-client STATIC ${CLIENT_VALA_C})
add_dependencies(geary-client resource_copy webkitgtk-vapi) add_dependencies(geary-client resource_copy webkit2gtk-vapi)
target_link_libraries(geary-client m ${DEPS_LIBRARIES} geary-engine) target_link_libraries(geary-client m ${DEPS_LIBRARIES} geary-engine)
# Main client application binary # Main client application binary

View file

@ -27,6 +27,7 @@ pkg_check_modules(DEPS REQUIRED
gmime-2.6 gmime-2.6
gthread-2.0 gthread-2.0
gtk+-3.0 gtk+-3.0
javascriptcoregtk-4.0
libsoup-2.4 libsoup-2.4
webkit2gtk-4.0 webkit2gtk-4.0
) )
@ -39,6 +40,7 @@ set(TEST_PACKAGES
glib-2.0 glib-2.0
gmime-2.6 gmime-2.6
gtk+-3.0 gtk+-3.0
javascriptcore-4.0
libsoup-2.4 libsoup-2.4
webkit2gtk-4.0 webkit2gtk-4.0
) )