[GTK] Add support for building WebCore to the cmake build
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 May 2013 18:16:56 +0000 (18:16 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 May 2013 18:16:56 +0000 (18:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116128

Reviewed by Gustavo Noronha Silva.

.:

* Source/PlatformGTK.cmake: Added.
* Source/cmake/OptionsGTK.cmake: Added more logic and variables to support WebCore and properly
defined some existing variables.

Source/WebCore:

* PlatformGTK.cmake: Added.
* platform/gtk/GtkVersioning.c: Include "config.h" because we removed
the autotoolsconfig.h include from the header.
* platform/gtk/GtkVersioning.h: Remove autotoolsconfig.h include to support for
non-autotools build systems.

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

ChangeLog
Source/PlatformGTK.cmake [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/PlatformGTK.cmake [new file with mode: 0644]
Source/WebCore/platform/gtk/GtkVersioning.c
Source/WebCore/platform/gtk/GtkVersioning.h
Source/cmake/OptionsGTK.cmake

index 9d943e3..f81b9f7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-05-14  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] Add support for building WebCore to the cmake build
+        https://bugs.webkit.org/show_bug.cgi?id=116128
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * Source/PlatformGTK.cmake: Added.
+        * Source/cmake/OptionsGTK.cmake: Added more logic and variables to support WebCore and properly
+        defined some existing variables.
+
 2013-05-15  Alexey Proskuryakov  <ap@apple.com>
 
         More fixing after WebProcessShim renaming in r149074.
diff --git a/Source/PlatformGTK.cmake b/Source/PlatformGTK.cmake
new file mode 100644 (file)
index 0000000..e12e2eb
--- /dev/null
@@ -0,0 +1,18 @@
+if (ENABLE_INSPECTOR)
+    add_custom_target(
+        web-inspector-resources ALL
+        COMMAND ${CMAKE_COMMAND} -E copy_directory ${WEBCORE_DIR}/inspector/front-end ${DATA_BUILD_DIR}/webinspector
+        COMMAND ${CMAKE_COMMAND} -E copy ${WEBCORE_DIR}/English.lproj/localizedStrings.js ${DATA_BUILD_DIR}/webinspector
+        COMMAND ${CMAKE_COMMAND} -E copy ${WEBKIT2_DIR}/UIProcess/InspectorServer/front-end/inspectorPageIndex.html ${DATA_BUILD_DIR}/webinspector
+        COMMAND ${CMAKE_COMMAND} -E copy ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendCommands.js ${DATA_BUILD_DIR}/webinspector
+        DEPENDS ${WebCore_LIBRARY_NAME}
+        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+    )
+    install(DIRECTORY "${DATA_BUILD_DIR}/webinspector"
+        DESTINATION "${DATA_INSTALL_DIR}/webinspector"
+        FILES_MATCHING PATTERN "*.js"
+                       PATTERN "*.html"
+                       PATTERN "*.css"
+                       PATTERN "*.gif"
+                       PATTERN "*.png")
+endif ()
index 0120ef5..d723a10 100644 (file)
@@ -1,3 +1,16 @@
+2013-05-14  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] Add support for building WebCore to the cmake build
+        https://bugs.webkit.org/show_bug.cgi?id=116128
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * PlatformGTK.cmake: Added.
+        * platform/gtk/GtkVersioning.c: Include "config.h" because we removed
+        the autotoolsconfig.h include from the header.
+        * platform/gtk/GtkVersioning.h: Remove autotoolsconfig.h include to support for
+        non-autotools build systems.
+
 2013-05-15  Ryosuke Niwa  <rniwa@webkit.org>
 
         DocumentOrderedMap doesn't need to have two HashMaps
diff --git a/Source/WebCore/PlatformGTK.cmake b/Source/WebCore/PlatformGTK.cmake
new file mode 100644 (file)
index 0000000..91ef747
--- /dev/null
@@ -0,0 +1,348 @@
+list(APPEND WebCore_INCLUDE_DIRECTORIES
+    "${WEBCORE_DIR}/accessibility/atk"
+    "${WEBCORE_DIR}/editing/atk"
+    "${WEBCORE_DIR}/page/gtk"
+    "${WEBCORE_DIR}/platform/cairo"
+    "${WEBCORE_DIR}/platform/gtk"
+    "${WEBCORE_DIR}/platform/graphics/cairo"
+    "${WEBCORE_DIR}/platform/graphics/gtk"
+    "${WEBCORE_DIR}/platform/graphics/freetype"
+    "${WEBCORE_DIR}/platform/graphics/harfbuzz/"
+    "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng"
+    "${WEBCORE_DIR}/platform/graphics/opengl"
+    "${WEBCORE_DIR}/platform/linux"
+    "${WEBCORE_DIR}/platform/mediastream/gstreamer"
+    "${WEBCORE_DIR}/platform/network/gtk"
+    "${WEBCORE_DIR}/platform/network/soup"
+    "${WEBCORE_DIR}/platform/text/gtk"
+    "${WEBCORE_DIR}/plugins/gtk"
+)
+
+list(APPEND WebCore_SOURCES
+    accessibility/atk/AccessibilityObjectAtk.cpp
+    accessibility/atk/AXObjectCacheAtk.cpp
+    accessibility/atk/WebKitAccessibleHyperlink.cpp
+    accessibility/atk/WebKitAccessibleInterfaceAction.cpp
+    accessibility/atk/WebKitAccessibleInterfaceComponent.cpp
+    accessibility/atk/WebKitAccessibleInterfaceDocument.cpp
+    accessibility/atk/WebKitAccessibleInterfaceEditableText.cpp
+    accessibility/atk/WebKitAccessibleInterfaceHyperlinkImpl.cpp
+    accessibility/atk/WebKitAccessibleInterfaceHypertext.cpp
+    accessibility/atk/WebKitAccessibleInterfaceImage.cpp
+    accessibility/atk/WebKitAccessibleInterfaceSelection.cpp
+    accessibility/atk/WebKitAccessibleInterfaceTable.cpp
+    accessibility/atk/WebKitAccessibleInterfaceText.cpp
+    accessibility/atk/WebKitAccessibleInterfaceValue.cpp
+    accessibility/atk/WebKitAccessibleUtil.cpp
+    accessibility/atk/WebKitAccessibleWrapperAtk.cpp
+
+    editing/SmartReplaceICU.cpp
+
+    editing/atk/FrameSelectionAtk.cpp
+
+    page/gtk/DragControllerGtk.cpp
+    page/gtk/EventHandlerGtk.cpp
+
+    platform/cairo/WidgetBackingStoreCairo.cpp
+
+    platform/Cursor.cpp
+
+    platform/audio/gtk/AudioBusGtk.cpp
+    platform/audio/gstreamer/AudioDestinationGStreamer.cpp
+    platform/audio/gstreamer/AudioFileReaderGStreamer.cpp
+    platform/audio/gstreamer/FFTFrameGStreamer.cpp
+    platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp
+
+    platform/gtk/AsyncFileSystemGtk.cpp
+    platform/gtk/ClipboardGtk.cpp
+    platform/gtk/ClipboardUtilitiesGtk.cpp
+    platform/gtk/ContextMenuGtk.cpp
+    platform/gtk/ContextMenuItemGtk.cpp
+    platform/gtk/CursorGtk.cpp
+    platform/gtk/DataObjectGtk.cpp
+    platform/gtk/DragDataGtk.cpp
+    platform/gtk/DragIcon.cpp
+    platform/gtk/DragImageGtk.cpp
+    platform/gtk/ErrorsGtk.cpp
+    platform/gtk/EventLoopGtk.cpp
+    platform/gtk/FileSystemGtk.cpp
+    platform/gtk/GamepadsGtk.cpp
+    platform/gtk/GOwnPtrGtk.cpp
+    platform/gtk/GRefPtrGtk.cpp
+    platform/gtk/GtkClickCounter.cpp
+    platform/gtk/GtkDragAndDropHelper.cpp
+    platform/gtk/GtkInputMethodFilter.cpp
+    platform/gtk/GtkPluginWidget.cpp
+    platform/gtk/GtkPopupMenu.cpp
+    platform/gtk/GtkUtilities.cpp
+    platform/gtk/GtkVersioning.c
+    platform/gtk/GtkWidgetBackingStoreX11.cpp
+    platform/gtk/KeyBindingTranslator.cpp
+    platform/gtk/LanguageGtk.cpp
+    platform/gtk/LocalizedStringsGtk.cpp
+    platform/gtk/LoggingGtk.cpp
+    platform/gtk/MainFrameScrollbarGtk.cpp
+    platform/gtk/MIMETypeRegistryGtk.cpp
+    platform/gtk/PasteboardGtk.cpp
+    platform/gtk/PasteboardHelper.cpp
+    platform/gtk/PlatformKeyboardEventGtk.cpp
+    platform/gtk/PlatformMouseEventGtk.cpp
+    platform/gtk/PlatformScreenGtk.cpp
+    platform/gtk/PlatformWheelEventGtk.cpp
+    platform/gtk/PopupMenuGtk.cpp
+    platform/gtk/RedirectedXCompositeWindow.cpp
+    platform/gtk/RenderThemeGtk2.cpp
+    platform/gtk/RenderThemeGtk3.cpp
+    platform/gtk/RenderThemeGtk.cpp
+    platform/gtk/RunLoopGtk.cpp
+    platform/gtk/ScrollbarThemeGtk2.cpp
+    platform/gtk/ScrollbarThemeGtk3.cpp
+    platform/gtk/ScrollbarThemeGtk.cpp
+    platform/gtk/ScrollViewGtk.cpp
+    platform/gtk/SearchPopupMenuGtk.cpp
+    platform/gtk/SharedBufferGtk.cpp
+    platform/gtk/SharedTimerGtk.cpp
+    platform/gtk/SoundGtk.cpp
+    platform/gtk/TemporaryLinkStubs.cpp
+    platform/gtk/UserAgentGtk.cpp
+    platform/gtk/WebKitAuthenticationWidget.cpp
+    platform/gtk/WidgetGtk.cpp
+    platform/gtk/WidgetRenderingContext.cpp
+
+    platform/graphics/cairo/BitmapImageCairo.cpp
+    platform/graphics/cairo/CairoUtilities.cpp
+    platform/graphics/cairo/DrawingBufferCairo.cpp
+    platform/graphics/cairo/FontCairo.cpp
+    platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
+    platform/graphics/cairo/GradientCairo.cpp
+    platform/graphics/cairo/GraphicsContext3DCairo.cpp
+    platform/graphics/cairo/GraphicsContext3DPrivate.cpp
+    platform/graphics/cairo/GraphicsContextCairo.cpp
+    platform/graphics/cairo/ImageBufferCairo.cpp
+    platform/graphics/cairo/ImageCairo.cpp
+    platform/graphics/cairo/IntRectCairo.cpp
+    platform/graphics/cairo/OwnPtrCairo.cpp
+    platform/graphics/cairo/PathCairo.cpp
+    platform/graphics/cairo/PatternCairo.cpp
+    platform/graphics/cairo/PlatformContextCairo.cpp
+    platform/graphics/cairo/PlatformPathCairo.cpp
+    platform/graphics/cairo/RefPtrCairo.cpp
+    platform/graphics/cairo/TileCairo.cpp
+    platform/graphics/cairo/TiledBackingStoreBackendCairo.cpp
+    platform/graphics/cairo/TransformationMatrixCairo.cpp
+
+    platform/graphics/gtk/ColorGtk.cpp
+    platform/graphics/gtk/FullscreenVideoControllerGtk.cpp
+    platform/graphics/gtk/GdkCairoUtilities.cpp
+    platform/graphics/gtk/IconGtk.cpp
+    platform/graphics/gtk/ImageBufferGtk.cpp
+    platform/graphics/gtk/ImageGtk.cpp
+    platform/graphics/gtk/IntPointGtk.cpp
+    platform/graphics/gtk/IntRectGtk.cpp
+
+    platform/graphics/freetype/FontCacheFreeType.cpp
+    platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
+    platform/graphics/freetype/FontPlatformDataFreeType.cpp
+    platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
+    platform/graphics/freetype/SimpleFontDataFreeType.cpp
+
+    platform/graphics/gstreamer/GRefPtrGStreamer.cpp
+    platform/graphics/gstreamer/GStreamerGWorld.cpp
+    platform/graphics/gstreamer/GStreamerUtilities.cpp
+    platform/graphics/gstreamer/GStreamerVersioning.cpp
+    platform/graphics/gstreamer/ImageGStreamerCairo.cpp
+    platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
+    platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+    platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp
+    platform/graphics/gstreamer/VideoSinkGStreamer.cpp
+    platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
+
+    platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp
+    platform/graphics/harfbuzz/HarfBuzzFace.cpp
+    platform/graphics/harfbuzz/HarfBuzzShaper.cpp
+
+    platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
+    platform/graphics/opengl/Extensions3DOpenGL.cpp
+    platform/graphics/opengl/Extensions3DOpenGLES.cpp
+    platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
+    platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
+
+    platform/graphics/OpenGLShims.cpp
+    platform/graphics/WOFFFileFormat.cpp
+
+    platform/image-decoders/cairo/ImageDecoderCairo.cpp
+
+    platform/linux/GamepadDeviceLinux.cpp
+
+    platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp
+
+    platform/network/gtk/CredentialBackingStore.cpp
+
+    platform/network/soup/AuthenticationChallengeSoup.cpp
+    platform/network/soup/CookieJarSoup.cpp
+    platform/network/soup/CookieStorageSoup.cpp
+    platform/network/soup/CredentialStorageSoup.cpp
+    platform/network/soup/DNSSoup.cpp
+    platform/network/soup/GOwnPtrSoup.cpp
+    platform/network/soup/NetworkStorageSessionSoup.cpp
+    platform/network/soup/ProxyResolverSoup.cpp
+    platform/network/soup/ProxyServerSoup.cpp
+    platform/network/soup/ResourceErrorSoup.cpp
+    platform/network/soup/ResourceHandleSoup.cpp
+    platform/network/soup/ResourceRequestSoup.cpp
+    platform/network/soup/ResourceResponseSoup.cpp
+    platform/network/soup/SocketStreamHandleSoup.cpp
+    platform/network/soup/SoupURIUtils.cpp
+
+    platform/PlatformStrategies.cpp
+
+    platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp
+    platform/text/enchant/TextCheckerEnchant.cpp
+    platform/text/LocaleICU.cpp
+    platform/text/TextBreakIteratorICU.cpp
+    platform/text/TextCodecICU.cpp
+    platform/text/TextEncodingDetectorICU.cpp
+)
+
+if (ENABLE_NETSCAPE_PLUGIN_API)
+    list(APPEND WebCore_SOURCES
+        plugins/PluginDatabase.cpp
+        plugins/PluginDebug.cpp
+        plugins/PluginPackage.cpp plugins/PluginStream.cpp
+        plugins/PluginView.cpp
+
+        plugins/gtk/PluginPackageGtk.cpp
+        plugins/gtk/PluginViewGtk.cpp
+        plugins/gtk/gtk2xtbin.c
+    )
+else ()
+    list(APPEND WebCore_SOURCES
+        plugins/PluginPackageNone.cpp
+        plugins/PluginViewNone.cpp
+    )
+endif ()
+
+list(APPEND WebCore_USER_AGENT_STYLE_SHEETS
+    ${WEBCORE_DIR}/css/mediaControlsGtk.css
+)
+
+list(APPEND WebCore_LIBRARIES
+    ${ATK_LIBRARIES}
+    ${ENCHANT_LIBRARIES}
+    ${CAIRO_LIBRARIES}
+    ${FONTCONFIG_LIBRARIES}
+    ${FREETYPE_LIBRARIES}
+    ${ICU_LIBRARIES}
+    ${JPEG_LIBRARIES}
+    ${LIBXML2_LIBRARIES}
+    ${LIBXSLT_LIBRARIES}
+    ${PNG_LIBRARIES}
+    ${SQLITE_LIBRARIES}
+    ${GLIB_LIBRARIES}
+    ${GLIB_GIO_LIBRARIES}
+    ${GLIB_GOBJECT_LIBRARIES}
+    ${GLIB_GMODULE_LIBRARIES}
+    ${GAIL3_LIBRARIES}
+    ${GTK3_LIBRARIES}
+    ${LIBSOUP_LIBRARIES}
+    ${ZLIB_LIBRARIES}
+    ${HARFBUZZ_LIBRARIES}
+    ${XT_LIBRARIES}
+    ${X11_X11_LIB}
+    ${X11_Xcomposite_LIB}
+    ${X11_Xrender_LIB}
+    ${X11_Xdamage_LIB}
+)
+
+list(APPEND WebCore_INCLUDE_DIRECTORIES
+    ${ATK_INCLUDE_DIRS}
+    ${ENCHANT_INCLUDE_DIRS}
+    ${CAIRO_INCLUDE_DIRS}
+    ${FREETYPE_INCLUDE_DIRS}
+    ${ICU_INCLUDE_DIRS}
+    ${LIBXML2_INCLUDE_DIR}
+    ${LIBXSLT_INCLUDE_DIR}
+    ${SQLITE_INCLUDE_DIR}
+    ${GAIL3_INCLUDE_DIRS}
+    ${GLIB_INCLUDE_DIRS}
+    ${GTK3_INCLUDE_DIRS}
+    ${LIBSOUP_INCLUDE_DIRS}
+    ${ZLIB_INCLUDE_DIRS}
+    ${HARFBUZZ_INCLUDE_DIRS}
+    ${XT_INCLUDE_DIRS}
+)
+
+if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
+    list(APPEND WebCore_INCLUDE_DIRECTORIES
+        ${WEBCORE_DIR}/platform/graphics/gstreamer
+        ${GSTREAMER_INCLUDE_DIRS}
+        ${GSTREAMER_BASE_INCLUDE_DIRS}
+        ${GSTREAMER_APP_INCLUDE_DIRS}
+        ${GSTREAMER_PBUTILS_INCLUDE_DIRS}
+    )
+
+    list(APPEND WebCore_LIBRARIES
+        ${GSTREAMER_LIBRARIES}
+        ${GSTREAMER_BASE_LIBRARIES}
+        ${GSTREAMER_APP_LIBRARIES}
+        ${GSTREAMER_PBUTILS_LIBRARIES}
+    )
+    # Avoiding a GLib deprecation warning due to GStreamer API using deprecated classes.
+    set_source_files_properties(platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp PROPERTIES COMPILE_DEFINITIONS "GLIB_DISABLE_DEPRECATION_WARNINGS=1")
+endif ()
+
+if (ENABLE_VIDEO)
+    list(APPEND WebCore_INCLUDE_DIRECTORIES
+        ${GSTREAMER_VIDEO_INCLUDE_DIRS}
+    )
+    list(APPEND WebCore_LIBRARIES
+        ${GSTREAMER_VIDEO_LIBRARIES}
+    )
+endif ()
+
+if (ENABLE_WEB_AUDIO)
+    list(APPEND WebCore_INCLUDE_DIRECTORIES
+        ${WEBCORE_DIR}/platform/audio/gstreamer
+        ${GSTREAMER_AUDIO_INCLUDE_DIRS}
+        ${GSTREAMER_FFT_INCLUDE_DIRS}
+    )
+    list(APPEND WebCore_LIBRARIES
+        ${GSTREAMER_AUDIO_LIBRARIES}
+        ${GSTREAMER_FFT_LIBRARIES}
+    )
+endif ()
+
+if (ENABLE_TEXTURE_MAPPER)
+    list(APPEND WebCore_INCLUDE_DIRECTORIES
+        "${WEBCORE_DIR}/platform/graphics/texmap"
+    )
+    list(APPEND WebCore_SOURCES
+        platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
+        platform/graphics/texmap/TextureMapperGL.cpp
+        platform/graphics/texmap/TextureMapperShaderProgram.cpp
+    )
+endif ()
+
+if (WTF_USE_EGL)
+    list(APPEND WebCore_LIBRARIES
+        ${EGL_LIBRARY}
+    )
+endif ()
+
+install(FILES
+            "${WEBCORE_DIR}/Resources/textAreaResizeCorner.png"
+            "${WEBCORE_DIR}/Resources/nullPlugin.png"
+            "${WEBCORE_DIR}/Resources/urlIcon.png"
+            "${WEBCORE_DIR}/Resources/missingImage.png"
+            "${WEBCORE_DIR}/Resources/panIcon.png"
+            "${WEBCORE_DIR}/Resources/deleteButton.png"
+            "${WEBCORE_DIR}/Resources/inputSpeech.png"
+        DESTINATION
+            "${DATA_INSTALL_DIR}/images")
+
+if (ENABLE_WEB_AUDIO)
+    install(FILES
+                "${WEBCORE_DIR}/platform/audio/resources/Composite.wav"
+            DESTINATION
+                "${DATA_INSTALL_DIR}/resources/audio")
+endif ()
index 679a432..8deef26 100644 (file)
@@ -18,6 +18,7 @@
  *  Boston, MA 02110-1301, USA.
  */
 
+#include "config.h"
 #include "GtkVersioning.h"
 
 #include <gtk/gtk.h>
index e0cd1ad..f03afe9 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef GtkVersioning_h
 #define GtkVersioning_h
 
-#include "autotoolsconfig.h"
 #include <gtk/gtk.h>
 
 #ifndef GTK_API_VERSION_2
index 738cac2..a667784 100644 (file)
@@ -69,23 +69,38 @@ set(WEBKIT_MICRO_VERSION ${PROJECT_VERSION_PATCH})
 set(WEBKIT_MINOR_VERSION ${PROJECT_VERSION_MINOR})
 set(WEBKIT_MAJOR_VERSION ${PROJECT_VERSION_MAJOR})
 
+set(ENABLE_WEBCORE ON)
+set(ENABLE_INSPECTOR ON)
+set(ENABLE_PLUGIN_PROCESS OFF)
 set(ENABLE_WEBKIT OFF)
 set(ENABLE_WEBKIT2 OFF)
-set(ENABLE_WEBCORE OFF)
-set(ENABLE_INSPECTOR OFF)
-set(ENABLE_PLUGIN_PROCESS OFF)
 
 set(WTF_USE_ICU_UNICODE 1)
 set(WTF_USE_SOUP 1)
+set(WTF_USE_ICU_UNICODE 1)
+
 set(JSC_EXECUTABLE_NAME jsc)
 set(WTF_LIBRARY_NAME WTFGTK)
 set(JavaScriptCore_LIBRARY_NAME javascriptcoregtk)
 set(WebCore_LIBRARY_NAME WebCoreGTK)
 set(WebKit_LIBRARY_NAME webkitgtk-3.0)
 set(WebKit2_LIBRARY_NAME webkit2gtk-3.0)
-set(DATA_INSTALL_DIR "share/${WebKit_LIBRARY_NAME}" CACHE PATH "Shared data path")
 set(VERSION_SCRIPT "-Wl,--version-script,${CMAKE_MODULE_PATH}/gtksymbols.filter")
 
+set(DATA_BUILD_DIR "${CMAKE_BINARY_DIR}/share/${WebKit_LIBRARY_NAME}")
+set(DATA_INSTALL_DIR "${DATADIR}/webkitgtk-3.0")
+
+add_definitions(-DBUILDING_GTK__=1)
+add_definitions(-DGETTEXT_PACKAGE="WebKitGTK-3.0")
+add_definitions(-DDATA_DIR="${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)
+
+# FIXME: These need to be configurable.
+add_definitions(-DWTF_PLATFORM_X11=1)
+add_definitions(-DMOZ_X11)
+
 find_package(Cairo 1.10.2 REQUIRED)
 find_package(Fontconfig 2.8.0 REQUIRED)
 find_package(Freetype 2.4.2 REQUIRED)
@@ -107,20 +122,18 @@ find_package(Xt REQUIRED)
 find_package(ATK REQUIRED)
 find_package(GStreamer 1.0.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
 
+# We don't use find_package for GLX because it is part of -lGL, unlike EGL.
+find_package(OpenGL)
+check_include_files("GL/glx.h" GLX_FOUND)
+find_package(EGL)
+
 if (ENABLE_SPELLCHECK)
     find_package(Enchant REQUIRED)
 endif ()
 
-add_definitions(-DBUILDING_GTK__=1)
-add_definitions(-DGETTEXT_PACKAGE="WebKitGTK-3.0")
-add_definitions(-DDATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}")
-add_definitions(-DWEBKITGTK_API_VERSION_STRING="3.0")
-add_definitions(-DUSER_AGENT_GTK_MAJOR_VERSION=537)
-add_definitions(-DUSER_AGENT_GTK_MINOR_VERSION=30)
-
-# FIXME: These need to be configurable.
-add_definitions(-DWTF_PLATFORM_X11=1)
-add_definitions(-DMOZ_X11)
+if (NOT ENABLE_SVG)
+    set(ENABLE_SVG_FONTS 0)
+endif ()
 
 # Optimize binary size for release builds by removing dead sections on unix/gcc
 if (CMAKE_COMPILER_IS_GNUCC AND UNIX AND NOT APPLE)
@@ -129,4 +142,30 @@ if (CMAKE_COMPILER_IS_GNUCC AND UNIX AND NOT APPLE)
     set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "-Wl,--gc-sections ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
 endif ()
 
+if (${OPENGL_FOUND} AND (${GLX_FOUND} OR ${EGL_FOUND}))
+    set(ENABLE_WEBGL 1)
+    set(WTF_USE_TEXTURE_MAPPER 1)
+    set(WTF_USE_3D_GRAPHICS 1)
+
+    add_definitions(-DWTF_USE_OPENGL=1)
+    add_definitions(-DWTF_USE_ACCELERATED_COMPOSITING=1)
+    add_definitions(-DWTF_USE_3D_GRAPHICS=1)
+    add_definitions(-DWTF_USE_TEXTURE_MAPPER=1)
+    add_definitions(-DWTF_USE_TEXTURE_MAPPER_GL=1)
+    add_definitions(-DENABLE_3D_RENDERING=1)
+
+    if (${EGL_FOUND})
+        add_definitions(-DWTF_USE_EGL=1)
+    endif ()
+
+    if (${GLX_FOUND})
+        add_definitions(-DWTF_USE_GLX=1)
+    endif ()
+endif ()
+
+if (ENABLE_INDEXED_DATABASE)
+    set(WTF_USE_LEVELDB 1)
+    add_definitions(-DWTF_USE_LEVELDB=1)
+endif ()
+
 set(CPACK_SOURCE_GENERATOR TBZ2)