[GTK] [CMake] Add support for building against GTK+ 2
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Jan 2014 05:37:15 +0000 (05:37 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Jan 2014 05:37:15 +0000 (05:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127959

Reviewed by Anders Carlsson.

.:

* Source/cmake/OptionsGTK.cmake: Add a new option to use GTK 2 and make a variable holding the
library API version. When using GTK 2 do not build WebKit 2.

Source/JavaScriptCore:

* PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.

Source/WebCore:

* PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.

Source/WebKit:

* PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.

Source/WebKit2:

* PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.

Tools:

* DumpRenderTree/PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.
* GtkLauncher/CMakeLists.txt: Ditto.
* ImageDiff/PlatformGTK.cmake: Ditto.
* TestWebKitAPI/Tests/WebKitGtk/CMakeLists.txt: Ditto.

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

15 files changed:
ChangeLog
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/PlatformGTK.cmake
Source/WebCore/ChangeLog
Source/WebCore/PlatformGTK.cmake
Source/WebKit/ChangeLog
Source/WebKit/PlatformGTK.cmake
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/cmake/OptionsGTK.cmake
Tools/ChangeLog
Tools/DumpRenderTree/PlatformGTK.cmake
Tools/GtkLauncher/CMakeLists.txt
Tools/ImageDiff/PlatformGTK.cmake
Tools/TestWebKitAPI/Tests/WebKitGtk/CMakeLists.txt

index 3e1c677..db281c8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2014-01-30  Martin Robinson  <mrobinson@igalia.com>
 
+        [GTK] [CMake] Add support for building against GTK+ 2
+        https://bugs.webkit.org/show_bug.cgi?id=127959
+
+        Reviewed by Anders Carlsson.
+
+        * Source/cmake/OptionsGTK.cmake: Add a new option to use GTK 2 and make a variable holding the
+        library API version. When using GTK 2 do not build WebKit 2.
+
+2014-01-30  Martin Robinson  <mrobinson@igalia.com>
+
         [GTK] [CMake] Add a "make dist" target
         https://bugs.webkit.org/show_bug.cgi?id=116378
 
index 21ee04f..902cba7 100644 (file)
@@ -1,3 +1,12 @@
+2014-01-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Add support for building against GTK+ 2
+        https://bugs.webkit.org/show_bug.cgi?id=127959
+
+        Reviewed by Anders Carlsson.
+
+        * PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.
+
 2014-01-30  Andreas Kling  <akling@apple.com>
 
         CodeBlock's cloned SymbolTables only need the captured names.
index 0f105e2..be016ec 100644 (file)
@@ -1,15 +1,15 @@
-configure_file(javascriptcoregtk.pc.in ${CMAKE_BINARY_DIR}/Source/JavaScriptCore/javascriptcoregtk-3.0.pc @ONLY)
-configure_file(JavaScriptCore.gir.in ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir @ONLY)
+configure_file(javascriptcoregtk.pc.in ${CMAKE_BINARY_DIR}/Source/JavaScriptCore/javascriptcoregtk-${WEBKITGTK_API_VERSION}.pc @ONLY)
+configure_file(JavaScriptCore.gir.in ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir @ONLY)
 
 add_custom_command(
-    OUTPUT ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.typelib
-    DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
-    COMMAND ${INTROSPECTION_COMPILER} ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir -o ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.typelib
+    OUTPUT ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.typelib
+    DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
+    COMMAND ${INTROSPECTION_COMPILER} ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir -o ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.typelib
 )
 
-ADD_TYPELIB(${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.typelib)
+ADD_TYPELIB(${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.typelib)
 
-install(FILES "${CMAKE_BINARY_DIR}/Source/JavaScriptCore/javascriptcoregtk-3.0.pc"
+install(FILES "${CMAKE_BINARY_DIR}/Source/JavaScriptCore/javascriptcoregtk-${WEBKITGTK_API_VERSION}.pc"
         DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
 )
 
@@ -23,9 +23,9 @@ install(FILES API/JavaScript.h
         DESTINATION "${WEBKITGTK_HEADER_INSTALL_DIR}/JavaScriptCore"
 )
 
-install(FILES ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
+install(FILES ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
         DESTINATION ${INTROSPECTION_INSTALL_GIRDIR}
 )
-install(FILES ${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.typelib
+install(FILES ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.typelib
         DESTINATION ${INTROSPECTION_INSTALL_TYPELIBDIR}
 )
index fabc7d8..6c969de 100644 (file)
@@ -1,3 +1,12 @@
+2014-01-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Add support for building against GTK+ 2
+        https://bugs.webkit.org/show_bug.cgi?id=127959
+
+        Reviewed by Anders Carlsson.
+
+        * PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.
+
 2014-01-30  Jessie Berlin  <jberlin@apple.com>
 
         Speculative build fix.
index bf0f32f..c847cc8 100644 (file)
@@ -451,13 +451,13 @@ set_property(
     APPEND
     PROPERTY INCLUDE_DIRECTORIES
         ${WebCore_INCLUDE_DIRECTORIES}
-        ${GTK3_INCLUDE_DIRS}
-        ${GDK3_INCLUDE_DIRS}
+        ${GTK_INCLUDE_DIRS}
+        ${GDK_INCLUDE_DIRS}
 )
 target_link_libraries(WebCorePlatformGTK
     ${WebCore_LIBRARIES}
-    ${GTK3_LIBRARIES}
-    ${GDK3_LIBRARIES}
+    ${GTK_LIBRARIES}
+    ${GDK_LIBRARIES}
 )
 
 if (ENABLE_WEBKIT2)
index d1ef82f..fb92551 100644 (file)
@@ -1,3 +1,12 @@
+2014-01-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Add support for building against GTK+ 2
+        https://bugs.webkit.org/show_bug.cgi?id=127959
+
+        Reviewed by Anders Carlsson.
+
+        * PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.
+
 2014-01-30  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r163052.
index cadca0f..1cb2184 100644 (file)
@@ -1,7 +1,7 @@
 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKITGTK_DIR})
 file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKITGTK_API_DIR})
 configure_file(gtk/webkit/webkitversion.h.in ${DERIVED_SOURCES_WEBKITGTK_API_DIR}/webkitversion.h)
-configure_file(gtk/webkit.pc.in ${CMAKE_BINARY_DIR}/Source/WebKit/gtk/webkitgtk-3.0.pc @ONLY)
+configure_file(gtk/webkit.pc.in ${CMAKE_BINARY_DIR}/Source/WebKit/gtk/webkitgtk-${WEBKITGTK_API_VERSION}.pc @ONLY)
 
 add_definitions(-DPACKAGE_LOCALE_DIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
 
@@ -31,7 +31,7 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
     ${WEBKIT_DIR}/gtk/WebCoreSupport
     ${ENCHANT_INCLUDE_DIRS}
     ${GEOCLUE_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
+    ${GTK_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
 )
 
@@ -169,9 +169,9 @@ add_custom_command(
 )
 
 add_custom_command(
-    OUTPUT ${CMAKE_BINARY_DIR}/WebKit-3.0.gir
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir
     DEPENDS WebKit
-    DEPENDS JavaScriptCore-3-gir
+    DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
     COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
         ${INTROSPECTION_SCANNER}
         --quiet
@@ -179,20 +179,20 @@ add_custom_command(
         --symbol-prefix=webkit
         --identifier-prefix=WebKit
         --namespace=WebKit
-        --nsversion=3.0
+        --nsversion=${WEBKITGTK_API_VERSION}
         --include=GObject-2.0
-        --include=Gtk-3.0
+        --include=Gtk-${WEBKITGTK_API_VERSION}
         --include=Soup-2.4
-        --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
-        --library=webkitgtk-3.0
-        --library=javascriptcoregtk-3.0
+        --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
+        --library=webkitgtk-${WEBKITGTK_API_VERSION}
+        --library=javascriptcoregtk-${WEBKITGTK_API_VERSION}
         -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
         --no-libtool
         --pkg=gobject-2.0
-        --pkg=gtk+-3.0
+        --pkg=gtk+-${WEBKITGTK_API_VERSION}
         --pkg=libsoup-2.4
-        --pkg-export=webkitgtk-3.0
-        --output=${CMAKE_BINARY_DIR}/WebKit-3.0.gir
+        --pkg-export=webkitgtk-${WEBKITGTK_API_VERSION}
+        --output=${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir
         --c-include="webkit/webkit.h"
         -DBUILDING_WEBKIT
         -I${CMAKE_SOURCE_DIR}/Source
@@ -207,14 +207,14 @@ add_custom_command(
 )
 
 add_custom_command(
-    OUTPUT ${CMAKE_BINARY_DIR}/WebKit-3.0.typelib
-    DEPENDS ${CMAKE_BINARY_DIR}/WebKit-3.0.gir
-    COMMAND ${INTROSPECTION_COMPILER} --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit-3.0.gir -o ${CMAKE_BINARY_DIR}/WebKit-3.0.typelib
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.typelib
+    DEPENDS ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir
+    COMMAND ${INTROSPECTION_COMPILER} --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir -o ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.typelib
 )
 
-ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit-3.0.typelib)
+ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.typelib)
 
-install(FILES "${CMAKE_BINARY_DIR}/Source/WebKit/gtk/webkitgtk-3.0.pc"
+install(FILES "${CMAKE_BINARY_DIR}/Source/WebKit/gtk/webkitgtk-${WEBKITGTK_API_VERSION}.pc"
         DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
 )
 install(FILES "${WEBKIT_DIR}/gtk/resources/error.html"
@@ -223,9 +223,9 @@ install(FILES "${WEBKIT_DIR}/gtk/resources/error.html"
 install(FILES ${WebKitGTK_INSTALLED_HEADERS}
         DESTINATION "${WEBKITGTK_HEADER_INSTALL_DIR}/webkit"
 )
-install(FILES ${CMAKE_BINARY_DIR}/WebKit-3.0.gir
+install(FILES ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.gir
         DESTINATION ${INTROSPECTION_INSTALL_GIRDIR}
 )
-install(FILES ${CMAKE_BINARY_DIR}/WebKit-3.0.typelib
+install(FILES ${CMAKE_BINARY_DIR}/WebKit-${WEBKITGTK_API_VERSION}.typelib
         DESTINATION ${INTROSPECTION_INSTALL_TYPELIBDIR}
 )
index b815f36..a514c0b 100644 (file)
@@ -1,3 +1,12 @@
+2014-01-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Add support for building against GTK+ 2
+        https://bugs.webkit.org/show_bug.cgi?id=127959
+
+        Reviewed by Anders Carlsson.
+
+        * PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.
+
 2014-01-30  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r163125.
index 5044ccc..4a84a92 100644 (file)
@@ -4,7 +4,7 @@ file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WEBKIT2GTK_DIR})
 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR})
 
 configure_file(UIProcess/API/gtk/WebKitVersion.h.in ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitVersion.h)
-configure_file(webkit2gtk.pc.in ${CMAKE_BINARY_DIR}/Source/WebKit2/webkit2gtk-3.0.pc @ONLY)
+configure_file(webkit2gtk.pc.in ${CMAKE_BINARY_DIR}/Source/WebKit2/webkit2gtk-${WEBKITGTK_API_VERSION}.pc @ONLY)
 
 add_definitions(-DWEBKIT2_COMPILATION)
 add_definitions(-DLIBEXECDIR="${CMAKE_INSTALL_FULL_LIBEXECDIR}")
@@ -425,7 +425,7 @@ set(WebKit2CommonIncludeDirectories ${WebKit2_INCLUDE_DIRECTORIES})
 
 list(APPEND WebKit2_INCLUDE_DIRECTORIES
     ${GLIB_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
+    ${GTK_INCLUDE_DIRS}
 )
 
 list(APPEND WebProcess_SOURCES
@@ -668,7 +668,7 @@ add_dependencies(webkit2gtkinjectedbundle GObjectDOMBindings)
 add_webkit2_prefix_header(webkit2gtkinjectedbundle)
 
 add_custom_command(
-    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir
     DEPENDS WebKit2
     DEPENDS JavaScriptCore-3-gir
     COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
@@ -678,20 +678,20 @@ add_custom_command(
         --symbol-prefix=webkit
         --identifier-prefix=WebKit
         --namespace=WebKit2
-        --nsversion=3.0
+        --nsversion=${WEBKITGTK_API_VERSION}
         --include=GObject-2.0
-        --include=Gtk-3.0
+        --include=Gtk-${WEBKITGTK_API_VERSION}
         --include=Soup-2.4
-        --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
-        --library=webkit2gtk-3.0
-        --library=javascriptcoregtk-3.0
+        --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
+        --library=webkit2gtk-${WEBKITGTK_API_VERSION}
+        --library=javascriptcoregtk-${WEBKITGTK_API_VERSION}
         -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
         --no-libtool
         --pkg=gobject-2.0
-        --pkg=gtk+-3.0
+        --pkg=gtk+-${WEBKITGTK_API_VERSION}
         --pkg=libsoup-2.4
-        --pkg-export=webkit2gtk-3.0
-        --output=${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
+        --pkg-export=webkit2gtk-${WEBKITGTK_API_VERSION}
+        --output=${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir
         --c-include="webkit2/webkit2.h"
         -DBUILDING_WEBKIT
         -DWEBKIT2_COMPILATION
@@ -706,9 +706,9 @@ add_custom_command(
 )
 
 add_custom_command(
-    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.gir
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.gir
     DEPENDS JavaScriptCore-3-gir
-    DEPENDS ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
+    DEPENDS ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir
     COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
         ${INTROSPECTION_SCANNER}
         --quiet
@@ -716,21 +716,21 @@ add_custom_command(
         --symbol-prefix=webkit
         --identifier-prefix=WebKit
         --namespace=WebKit2WebExtension
-        --nsversion=3.0
+        --nsversion=${WEBKITGTK_API_VERSION}
         --include=GObject-2.0
-        --include=Gtk-3.0
+        --include=Gtk-${WEBKITGTK_API_VERSION}
         --include=Soup-2.4
-        --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-3.0.gir
-        --include-uninstalled=${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
-        --library=webkit2gtk-3.0
-        --library=javascriptcoregtk-3.0
+        --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
+        --include-uninstalled=${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir
+        --library=webkit2gtk-${WEBKITGTK_API_VERSION}
+        --library=javascriptcoregtk-${WEBKITGTK_API_VERSION}
         -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
         --no-libtool
         --pkg=gobject-2.0
-        --pkg=gtk+-3.0
+        --pkg=gtk+-${WEBKITGTK_API_VERSION}
         --pkg=libsoup-2.4
-        --pkg-export=webkit2gtk-3.0
-        --output=${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.gir
+        --pkg-export=webkit2gtk-${WEBKITGTK_API_VERSION}
+        --output=${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.gir
         --c-include="webkit2/webkit-web-extension.h"
         -DBUILDING_WEBKIT
         -DWEBKIT2_COMPILATION
@@ -749,35 +749,35 @@ add_custom_command(
 )
 
 add_custom_command(
-    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2-3.0.typelib
-    DEPENDS ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
-    COMMAND ${INTROSPECTION_COMPILER} --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir -o ${CMAKE_BINARY_DIR}/WebKit2-3.0.typelib
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.typelib
+    DEPENDS ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir
+    COMMAND ${INTROSPECTION_COMPILER} --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir -o ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.typelib
 )
 
 add_custom_command(
-    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.typelib
-    DEPENDS ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.gir
-    COMMAND ${INTROSPECTION_COMPILER} --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.gir -o ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.typelib
+    OUTPUT ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.typelib
+    DEPENDS ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.gir
+    COMMAND ${INTROSPECTION_COMPILER} --includedir=${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.gir -o ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.typelib
 )
 
-ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit2-3.0.typelib)
-ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.typelib)
+ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.typelib)
+ADD_TYPELIB(${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.typelib)
 
 install(TARGETS webkit2gtkinjectedbundle
-        DESTINATION "${LIB_INSTALL_DIR}/webkit2gtk-3.0/injected-bundle"
+        DESTINATION "${LIB_INSTALL_DIR}/webkit2gtk-${WEBKITGTK_API_VERSION}/injected-bundle"
 )
-install(FILES "${CMAKE_BINARY_DIR}/Source/WebKit2/webkit2gtk-3.0.pc"
+install(FILES "${CMAKE_BINARY_DIR}/Source/WebKit2/webkit2gtk-${WEBKITGTK_API_VERSION}.pc"
         DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
 )
 install(FILES ${WebKit2GTK_INSTALLED_HEADERS}
               ${WebKit2WebExtension_INSTALLED_HEADERS}
         DESTINATION "${WEBKITGTK_HEADER_INSTALL_DIR}/webkit2"
 )
-install(FILES ${CMAKE_BINARY_DIR}/WebKit2-3.0.gir
-              ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.gir
+install(FILES ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir
+              ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.gir
         DESTINATION ${INTROSPECTION_INSTALL_GIRDIR}
 )
-install(FILES ${CMAKE_BINARY_DIR}/WebKit2-3.0.typelib
-              ${CMAKE_BINARY_DIR}/WebKit2WebExtension-3.0.typelib
+install(FILES ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.typelib
+              ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.typelib
         DESTINATION ${INTROSPECTION_INSTALL_TYPELIBDIR}
 )
index 246a62a..ca7e814 100644 (file)
@@ -25,6 +25,8 @@ set(WEBKIT_MICRO_VERSION ${PROJECT_VERSION_PATCH})
 set(WEBKIT_MINOR_VERSION ${PROJECT_VERSION_MINOR})
 set(WEBKIT_MAJOR_VERSION ${PROJECT_VERSION_MAJOR})
 
+set(USE_GTK2 OFF CACHE BOOL "Whether or not to use GTK+ 2. WebKit2 only supports GTK+ 3.")
+
 # FIXME: We want to expose fewer options to downstream, but for now everything is public.
 WEBKIT_OPTION_BEGIN()
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_RENDERING ON)
@@ -95,45 +97,51 @@ endif ()
 
 WEBKIT_OPTION_END()
 
-# These are used to generate the pkg-config files, note we only support GTK 3.0
-# builds with cmake.
-set(WEBKITGTK_API_VERSION 3.0)
-set(GTK_API_VERSION 3.0)
+set(ENABLE_WEBCORE ON)
+set(ENABLE_INSPECTOR ON)
+set(ENABLE_WEBKIT ON)
+if (NOT USE_GTK2)
+    set(WEBKITGTK_API_VERSION 3.0)
+    set(GTK_API_VERSION 3.0)
+    set(ENABLE_PLUGIN_PROCESS ON)
+    set(ENABLE_WEBKIT2 ON)
+else ()
+    set(WEBKITGTK_API_VERSION 2.0)
+    set(GTK_API_VERSION 2.0)
+    set(ENABLE_PLUGIN_PROCESS OFF)
+    set(ENABLE_WEBKIT2 OFF)
+endif ()
+
+# These are used to generate the pkg-config files.
 set(prefix ${CMAKE_INSTALL_PREFIX})
 set(exec_prefix ${CMAKE_INSTALL_PREFIX})
 set(libdir "${prefix}/${CMAKE_INSTALL_LIBDIR}")
 set(includedir "${prefix}/include")
 set(VERSION ${PROJECT_VERSION})
 
-set(ENABLE_WEBCORE ON)
-set(ENABLE_INSPECTOR ON)
-set(ENABLE_PLUGIN_PROCESS ON)
-set(ENABLE_WEBKIT ON)
-set(ENABLE_WEBKIT2 ON)
-
 set(WTF_USE_SOUP 1)
 
 set(WTF_OUTPUT_NAME WTFGTK)
-set(JavaScriptCore_OUTPUT_NAME javascriptcoregtk-3.0)
+set(JavaScriptCore_OUTPUT_NAME javascriptcoregtk-${WEBKITGTK_API_VERSION})
 set(WebCore_OUTPUT_NAME WebCoreGTK)
-set(WebKit_OUTPUT_NAME webkitgtk-3.0)
-set(WebKit2_OUTPUT_NAME webkit2gtk-3.0)
+set(WebKit_OUTPUT_NAME webkitgtk-${WEBKITGTK_API_VERSION})
+set(WebKit2_OUTPUT_NAME webkit2gtk-${WEBKITGTK_API_VERSION})
 set(WebKit2_WebProcess_OUTPUT_NAME WebKitWebProcess)
 set(WebKit2_NetworkProcess_OUTPUT_NAME WebKitNetworkProcess)
 
 set(DATA_BUILD_DIR "${CMAKE_BINARY_DIR}/share/${WebKit_OUTPUT_NAME}")
-set(DATA_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/webkitgtk-3.0")
+set(DATA_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/webkitgtk-${WEBKITGTK_API_VERSION}")
 set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Where to install libraries")
 set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH "Where to install executables")
 set(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_LIBEXECDIR}" CACHE PATH "Where to install executables executed by the library")
-set(WEBKITGTK_HEADER_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/webkitgtk-3.0")
+set(WEBKITGTK_HEADER_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/webkitgtk-${WEBKITGTK_API_VERSION}")
 
 add_definitions(-DBUILDING_GTK__=1)
-add_definitions(-DGETTEXT_PACKAGE="WebKitGTK-3.0")
+add_definitions(-DGETTEXT_PACKAGE="WebKitGTK-${WEBKITGTK_API_VERSION}")
 add_definitions(-DDATA_DIR="${CMAKE_INSTALL_DATADIR}")
-add_definitions(-DWEBKITGTK_API_VERSION_STRING="3.0")
 add_definitions(-DUSER_AGENT_GTK_MAJOR_VERSION=537)
 add_definitions(-DUSER_AGENT_GTK_MINOR_VERSION=30)
+add_definitions(-DWEBKITGTK_API_VERSION_STRING="${WEBKITGTK_API_VERSION}")
 
 if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
     add_definitions(-DWTF_USE_GSTREAMER)
@@ -157,8 +165,6 @@ endif ()
 find_package(Cairo 1.10.2 REQUIRED)
 find_package(Fontconfig 2.8.0 REQUIRED)
 find_package(Freetype 2.4.2 REQUIRED)
-find_package(GTK3 3.6.0 REQUIRED)
-find_package(GDK3 3.6.0 REQUIRED)
 find_package(GTK2 2.24.10 REQUIRED)
 find_package(GDK2 2.24.10 REQUIRED)
 find_package(HarfBuzz 0.9.2 REQUIRED)
@@ -178,6 +184,22 @@ find_package(GStreamer 1.0.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
 find_package(ATSPI 2.5.3)
 find_package(GObjectIntrospection)
 
+if (NOT USE_GTK2)
+    find_package(GTK3 3.6.0 REQUIRED)
+    find_package(GDK3 3.6.0 REQUIRED)
+    set(GTK_LIBRARIES ${GTK3_LIBRARIES})
+    set(GTK_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS})
+    set(GDK_LIBRARIES ${GDK3_LIBRARIES})
+    set(GDK_INCLUDE_DIRS ${GDK3_INCLUDE_DIRS})
+else ()
+    set(GTK_LIBRARIES ${GTK2_LIBRARIES})
+    set(GTK_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS})
+    set(GDK_LIBRARIES ${GDK2_LIBRARIES})
+    set(GDK_INCLUDE_DIRS ${GDK2_INCLUDE_DIRS})
+    add_definitions(-DGTK_API_VERSION_2)
+    add_definitions(-DWEBKITGTK_API_VERSION_STRING="2.0")
+endif ()
+
 set(glib_components gio gobject gthread gmodule)
 if (ENABLE_GAMEPAD)
     list(APPEND glib_components gio-unix)
index 4c78e49..1d0bb03 100644 (file)
@@ -1,3 +1,15 @@
+2014-01-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Add support for building against GTK+ 2
+        https://bugs.webkit.org/show_bug.cgi?id=127959
+
+        Reviewed by Anders Carlsson.
+
+        * DumpRenderTree/PlatformGTK.cmake: Use the new API version variable and don't use GTK3 directly.
+        * GtkLauncher/CMakeLists.txt: Ditto.
+        * ImageDiff/PlatformGTK.cmake: Ditto.
+        * TestWebKitAPI/Tests/WebKitGtk/CMakeLists.txt: Ditto.
+
 2014-01-30  Anders Carlsson  <andersca@apple.com>
 
         Add webView:didFinishLoadingNavigation: delegate method
index 8671aa4..be93d0f 100644 (file)
@@ -24,7 +24,7 @@ list(APPEND DumpRenderTree_LIBRARIES
     ${CAIRO_LIBRARIES}
     ${FONTCONFIG_LIBRARIES}
     ${GLIB_LIBRARIES}
-    ${GTK3_LIBRARIES}
+    ${GTK_LIBRARIES}
     ${LIBSOUP_LIBRARIES}
 )
 
@@ -40,7 +40,7 @@ list(APPEND DumpRenderTree_INCLUDE_DIRECTORIES
     ${CAIRO_INCLUDE_DIRS}
     ${FONTCONFIG_INCLUDE_DIR}
     ${GLIB_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
+    ${GTK_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
 )
 
index 71c94bf..0a20374 100644 (file)
@@ -9,7 +9,7 @@ include_directories(
     ${DERIVED_SOURCES_WEBKITGTK_DIR}
     ${GLIB_INCLUDE_DIRS}
     ${GSTREAMER_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
+    ${GTK_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
 )
 
@@ -24,7 +24,7 @@ target_link_libraries(GtkLauncher
     WebKit
     ${GLIB_LIBRARIES}
     ${GSTREAMER_LIBRARIES}
-    ${GTK3_LIBRARIES}
+    ${GTK_LIBRARIES}
     ${LIBSOUP_LIBRARIES}
 )
 
index fd94d52..d45b819 100644 (file)
@@ -3,9 +3,9 @@ set(IMAGE_DIFF_SOURCES
 )
 
 list(APPEND IMAGE_DIFF_INCLUDE_DIRECTORIES
-    ${GTK3_INCLUDE_DIRS}
+    ${GTK_INCLUDE_DIRS}
 )
 
 list(APPEND IMAGE_DIFF_LIBRARIES
-    ${GTK3_LIBRARIES}
+    ${GTK_LIBRARIES}
 )
index bfbfed8..7020d39 100644 (file)
@@ -10,8 +10,9 @@ include_directories(
     ${DERIVED_SOURCES_DIR}
     ${DERIVED_SOURCES_WEBKITGTK_DIR}
     ${GLIB_INCLUDE_DIRS}
-    ${GTK3_INCLUDE_DIRS}
+    ${GTK_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
+    ${X11_INCLUDE_DIR}
 )
 
 macro(ADD_WK1_TEST test_name)
@@ -20,8 +21,9 @@ macro(ADD_WK1_TEST test_name)
         JavaScriptCore
         WebKit
         ${GLIB_LIBRARIES}
-        ${GTK3_LIBRARIES}
+        ${GTK_LIBRARIES}
         ${LIBSOUP_LIBRARIES}
+        ${X11_X11_LIB}
     )
     set_target_properties(${test_name} PROPERTIES
         RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestWebKitAPI/WebKitGtk