[Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolMana...
[WebKit-https.git] / Source / WebKit / PlatformMac.cmake
index 0170c8c..19362b2 100644 (file)
@@ -1,4 +1,4 @@
-add_definitions("-ObjC++ -std=c++14")
+add_definitions("-ObjC++ -std=c++17")
 find_library(APPLICATIONSERVICES_LIBRARY ApplicationServices)
 find_library(CARBON_LIBRARY Carbon)
 find_library(QUARTZ_LIBRARY Quartz)
@@ -9,25 +9,29 @@ add_definitions(-iframework ${CARBON_LIBRARY}/Frameworks)
 add_definitions(-iframework ${APPLICATIONSERVICES_LIBRARY}/Versions/Current/Frameworks)
 add_definitions(-DWK_XPC_SERVICE_SUFFIX=".Development")
 
-list(APPEND WebKit2_LIBRARIES
-    PRIVATE WebKit
+list(APPEND WebKit_LIBRARIES
+    WebKitLegacy
     ${APPLICATIONSERVICES_LIBRARY}
 )
 
 if (NOT AVFAUDIO_LIBRARY-NOTFOUND)
-    list(APPEND WebKit2_LIBRARIES ${AVFAUDIO_LIBRARY})
+    list(APPEND WebKit_LIBRARIES ${AVFAUDIO_LIBRARY})
 endif ()
 
-list(APPEND WebKit2_SOURCES
+list(APPEND WebKit_SOURCES
+    NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
+    NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp
+
+    NetworkProcess/Cookies/mac/WebCookieManagerMac.mm
+
+    NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
+
     NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm
 
     NetworkProcess/Downloads/PendingDownload.cpp
 
     NetworkProcess/Downloads/cocoa/DownloadCocoa.mm
 
-    NetworkProcess/Downloads/mac/DownloadMac.mm
-
-    NetworkProcess/cache/NetworkCacheCodersCocoa.cpp
     NetworkProcess/cache/NetworkCacheDataCocoa.mm
     NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm
 
@@ -35,7 +39,6 @@ list(APPEND WebKit2_SOURCES
     NetworkProcess/cocoa/NetworkProcessCocoa.mm
     NetworkProcess/cocoa/NetworkSessionCocoa.mm
 
-    NetworkProcess/mac/NetworkLoadMac.mm
     NetworkProcess/mac/NetworkProcessMac.mm
     NetworkProcess/mac/RemoteNetworkingContext.mm
 
@@ -46,6 +49,8 @@ list(APPEND WebKit2_SOURCES
 
     Platform/cg/CGUtilities.cpp
 
+    Platform/cocoa/WKCrashReporter.mm
+
     Platform/classifier/ResourceLoadStatisticsClassifier.cpp
 
     Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp
@@ -68,8 +73,6 @@ list(APPEND WebKit2_SOURCES
     Shared/APIWebArchive.mm
     Shared/APIWebArchiveResource.mm
 
-    Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm
-
     Shared/API/Cocoa/RemoteObjectInvocation.mm
     Shared/API/Cocoa/RemoteObjectRegistry.mm
     Shared/API/Cocoa/WKBrowsingContextHandle.mm
@@ -95,11 +98,9 @@ list(APPEND WebKit2_SOURCES
     Shared/API/c/mac/WKWebArchive.cpp
     Shared/API/c/mac/WKWebArchiveResource.cpp
 
-    Shared/Authentication/mac/AuthenticationManager.mac.mm
-
     Shared/Cocoa/APIDataCocoa.mm
     Shared/Cocoa/APIObject.mm
-    Shared/Cocoa/ChildProcessCocoa.mm
+    Shared/Cocoa/AuxiliaryProcessCocoa.mm
     Shared/Cocoa/CompletionHandlerCallChecker.mm
     Shared/Cocoa/DataDetectionResult.mm
     Shared/Cocoa/LoadParametersCocoa.mm
@@ -128,16 +129,15 @@ list(APPEND WebKit2_SOURCES
     Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp
 
     Shared/cf/ArgumentCodersCF.cpp
+    Shared/cf/CookieStorageUtilsCF.mm
 
     Shared/cg/ShareableBitmapCG.cpp
 
     Shared/mac/ArgumentCodersMac.mm
     Shared/mac/AttributedString.mm
-    Shared/mac/ChildProcessMac.mm
+    Shared/mac/AuxiliaryProcessMac.mm
     Shared/mac/CodeSigning.mm
     Shared/mac/ColorSpaceData.mm
-    Shared/mac/CookieStorageShim.mm
-    Shared/mac/CookieStorageShimLibrary.cpp
     Shared/mac/HangDetectionDisablerMac.mm
     Shared/mac/NativeWebGestureEventMac.mm
     Shared/mac/NativeWebKeyboardEventMac.mm
@@ -159,13 +159,10 @@ list(APPEND WebKit2_SOURCES
     Shared/mac/WebHitTestResultData.mm
     Shared/mac/WebMemorySampler.mac.mm
 
-    StorageProcess/mac/StorageProcessMac.mm
-
     UIProcess/HighPerformanceGraphicsUsageSampler.cpp
     UIProcess/PerActivityStateCPUUsageSampler.cpp
-    UIProcess/WebContextMenuListenerProxy.cpp
-    UIProcess/WebResourceLoadStatisticsStore.cpp
-    UIProcess/WebResourceLoadStatisticsTelemetry.cpp
+    UIProcess/ViewGestureController.cpp
+    UIProcess/ViewSnapshotStore.cpp
 
     UIProcess/Automation/WebAutomationSession.cpp
 
@@ -219,7 +216,10 @@ list(APPEND WebKit2_SOURCES
     UIProcess/API/Cocoa/WKWebsiteDataStore.mm
     UIProcess/API/Cocoa/WKWindowFeatures.mm
     UIProcess/API/Cocoa/_WKActivatedElementInfo.mm
+    UIProcess/API/Cocoa/_WKApplicationManifest.mm
+    UIProcess/API/Cocoa/_WKAttachment.mm
     UIProcess/API/Cocoa/_WKAutomationSession.mm
+    UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.mm
     UIProcess/API/Cocoa/_WKContextMenuElementInfo.mm
     UIProcess/API/Cocoa/_WKDownload.mm
     UIProcess/API/Cocoa/_WKElementAction.mm
@@ -235,7 +235,6 @@ list(APPEND WebKit2_SOURCES
     UIProcess/API/Cocoa/_WKUserContentWorld.mm
     UIProcess/API/Cocoa/_WKUserInitiatedAction.mm
     UIProcess/API/Cocoa/_WKUserStyleSheet.mm
-    UIProcess/API/Cocoa/_WKVisitedLinkProvider.mm
     UIProcess/API/Cocoa/_WKVisitedLinkStore.mm
     UIProcess/API/Cocoa/_WKWebsiteDataSize.mm
     UIProcess/API/Cocoa/_WKWebsiteDataStore.mm
@@ -256,20 +255,19 @@ list(APPEND WebKit2_SOURCES
     UIProcess/Cocoa/SessionStateCoding.mm
     UIProcess/Cocoa/UIDelegate.mm
     UIProcess/Cocoa/VersionChecks.mm
-    UIProcess/Cocoa/ViewGestureController.cpp
+    UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm
     UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm
     UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm
     UIProcess/Cocoa/WebPageProxyCocoa.mm
     UIProcess/Cocoa/WebPasteboardProxyCocoa.mm
     UIProcess/Cocoa/WebProcessPoolCocoa.mm
     UIProcess/Cocoa/WebProcessProxyCocoa.mm
-    UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm
     UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm
     UIProcess/Cocoa/WebViewImpl.mm
 
     UIProcess/Launcher/mac/ProcessLauncherMac.mm
 
-    UIProcess/Network/mac/NetworkProcessProxyMac.mm
+    UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp
 
     UIProcess/Plugins/mac/PluginInfoStoreMac.mm
     UIProcess/Plugins/mac/PluginProcessManagerMac.mm
@@ -287,23 +285,23 @@ list(APPEND WebKit2_SOURCES
 
     UIProcess/mac/CorrectionPanel.mm
     UIProcess/mac/LegacySessionStateCoding.cpp
-    UIProcess/mac/PageClientImpl.mm
+    UIProcess/mac/PageClientImplMac.mm
     UIProcess/mac/RemoteWebInspectorProxyMac.mm
     UIProcess/mac/SecItemShimProxy.cpp
     UIProcess/mac/ServicesController.mm
     UIProcess/mac/TextCheckerMac.mm
     UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
     UIProcess/mac/ViewGestureControllerMac.mm
-    UIProcess/mac/ViewSnapshotStore.mm
-    UIProcess/mac/WKFullKeyboardAccessWatcher.mm
+    UIProcess/mac/ViewSnapshotStoreMac.mm
     UIProcess/mac/WKFullScreenWindowController.mm
     UIProcess/mac/WKImmediateActionController.mm
+    UIProcess/mac/WKInspectorViewController.mm
+    UIProcess/mac/WKInspectorWKWebView.mm
     UIProcess/mac/WKPrintingView.mm
     UIProcess/mac/WKSharingServicePickerDelegate.mm
     UIProcess/mac/WKTextFinderClient.mm
     UIProcess/mac/WKTextInputWindowController.mm
     UIProcess/mac/WKViewLayoutStrategy.mm
-    UIProcess/mac/WKWebInspectorWKWebView.mm
     UIProcess/mac/WebColorPickerMac.mm
     UIProcess/mac/WebContextMenuProxyMac.mm
     UIProcess/mac/WebCookieManagerProxyMac.mm
@@ -314,8 +312,6 @@ list(APPEND WebKit2_SOURCES
     UIProcess/mac/WebProcessProxyMac.mm
     UIProcess/mac/WindowServerConnection.mm
 
-    WebProcess/Cookies/mac/WebCookieManagerMac.mm
-
     WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm
     WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm
     WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm
@@ -366,7 +362,6 @@ list(APPEND WebKit2_SOURCES
     WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
     WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
     WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm
-    WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
 
     WebProcess/WebPage/ViewGestureGeometryCollector.cpp
 
@@ -384,49 +379,49 @@ list(APPEND WebKit2_SOURCES
     WebProcess/mac/SecItemShimLibrary.mm
 )
 
-list(APPEND WebKit2_INCLUDE_DIRECTORIES
-    "${PAL_DIR}"
-    "${WEBKIT2_DIR}/NetworkProcess/cocoa"
-    "${WEBKIT2_DIR}/NetworkProcess/mac"
-    "${WEBKIT2_DIR}/PluginProcess/mac"
-    "${WEBKIT2_DIR}/UIProcess/mac"
-    "${WEBKIT2_DIR}/UIProcess/API/C/mac"
-    "${WEBKIT2_DIR}/UIProcess/API/Cocoa"
-    "${WEBKIT2_DIR}/UIProcess/API/mac"
-    "${WEBKIT2_DIR}/UIProcess/Cocoa"
-    "${WEBKIT2_DIR}/UIProcess/Launcher/mac"
-    "${WEBKIT2_DIR}/UIProcess/RemoteLayerTree"
-    "${WEBKIT2_DIR}/UIProcess/RemoteLayerTree/ios"
-    "${WEBKIT2_DIR}/UIProcess/ios"
-    "${WEBKIT2_DIR}/Platform/cg"
-    "${WEBKIT2_DIR}/Platform/classifier"
-    "${WEBKIT2_DIR}/Platform/classifier/cocoa"
-    "${WEBKIT2_DIR}/Platform/mac"
-    "${WEBKIT2_DIR}/Platform/unix"
-    "${WEBKIT2_DIR}/Platform/spi/Cocoa"
-    "${WEBKIT2_DIR}/Platform/spi/mac"
-    "${WEBKIT2_DIR}/Platform/IPC/mac"
-    "${WEBKIT2_DIR}/Platform/spi/Cocoa"
-    "${WEBKIT2_DIR}/Shared/API/Cocoa"
-    "${WEBKIT2_DIR}/Shared/API/c/cf"
-    "${WEBKIT2_DIR}/Shared/API/c/cg"
-    "${WEBKIT2_DIR}/Shared/API/c/mac"
-    "${WEBKIT2_DIR}/Shared/cf"
-    "${WEBKIT2_DIR}/Shared/Cocoa"
-    "${WEBKIT2_DIR}/Shared/EntryPointUtilities/mac/XPCService"
-    "${WEBKIT2_DIR}/Shared/mac"
-    "${WEBKIT2_DIR}/Shared/Plugins/mac"
-    "${WEBKIT2_DIR}/Shared/Scrolling"
-    "${WEBKIT2_DIR}/WebProcess/cocoa"
-    "${WEBKIT2_DIR}/WebProcess/mac"
-    "${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/Cocoa"
-    "${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/mac"
-    "${WEBKIT2_DIR}/WebProcess/Plugins/PDF"
-    "${WEBKIT2_DIR}/WebProcess/Plugins/Netscape/mac"
-    "${WEBKIT2_DIR}/WebProcess/WebPage/Cocoa"
-    "${WEBKIT2_DIR}/WebProcess/WebPage/RemoteLayerTree"
-    "${WEBKIT2_DIR}/WebProcess/WebPage/mac"
-    "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/mac"
+list(APPEND WebKit_INCLUDE_DIRECTORIES
+    "${WEBKIT_DIR}/NetworkProcess/cocoa"
+    "${WEBKIT_DIR}/NetworkProcess/mac"
+    "${WEBKIT_DIR}/PluginProcess/mac"
+    "${WEBKIT_DIR}/UIProcess/mac"
+    "${WEBKIT_DIR}/UIProcess/API/C/mac"
+    "${WEBKIT_DIR}/UIProcess/API/Cocoa"
+    "${WEBKIT_DIR}/UIProcess/API/mac"
+    "${WEBKIT_DIR}/UIProcess/Cocoa"
+    "${WEBKIT_DIR}/UIProcess/Launcher/mac"
+    "${WEBKIT_DIR}/UIProcess/RemoteLayerTree"
+    "${WEBKIT_DIR}/UIProcess/RemoteLayerTree/ios"
+    "${WEBKIT_DIR}/UIProcess/ios"
+    "${WEBKIT_DIR}/Platform/cg"
+    "${WEBKIT_DIR}/Platform/classifier"
+    "${WEBKIT_DIR}/Platform/classifier/cocoa"
+    "${WEBKIT_DIR}/Platform/cocoa"
+    "${WEBKIT_DIR}/Platform/mac"
+    "${WEBKIT_DIR}/Platform/unix"
+    "${WEBKIT_DIR}/Platform/spi/Cocoa"
+    "${WEBKIT_DIR}/Platform/spi/mac"
+    "${WEBKIT_DIR}/Platform/IPC/mac"
+    "${WEBKIT_DIR}/Platform/spi/Cocoa"
+    "${WEBKIT_DIR}/Shared/API/Cocoa"
+    "${WEBKIT_DIR}/Shared/API/c/cf"
+    "${WEBKIT_DIR}/Shared/API/c/cg"
+    "${WEBKIT_DIR}/Shared/API/c/mac"
+    "${WEBKIT_DIR}/Shared/cf"
+    "${WEBKIT_DIR}/Shared/Cocoa"
+    "${WEBKIT_DIR}/Shared/EntryPointUtilities/mac/XPCService"
+    "${WEBKIT_DIR}/Shared/mac"
+    "${WEBKIT_DIR}/Shared/Plugins/mac"
+    "${WEBKIT_DIR}/Shared/Scrolling"
+    "${WEBKIT_DIR}/WebProcess/cocoa"
+    "${WEBKIT_DIR}/WebProcess/mac"
+    "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/Cocoa"
+    "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/mac"
+    "${WEBKIT_DIR}/WebProcess/Plugins/PDF"
+    "${WEBKIT_DIR}/WebProcess/Plugins/Netscape/mac"
+    "${WEBKIT_DIR}/WebProcess/WebPage/Cocoa"
+    "${WEBKIT_DIR}/WebProcess/WebPage/RemoteLayerTree"
+    "${WEBKIT_DIR}/WebProcess/WebPage/mac"
+    "${WEBKIT_DIR}/WebProcess/WebCoreSupport/mac"
     "${FORWARDING_HEADERS_DIR}/WebCore"
     "${DERIVED_SOURCES_WEBCORE_DIR}"
 )
@@ -451,18 +446,15 @@ list(APPEND NetworkProcess_SOURCES
     ${XPCService_SOURCES}
 )
 
-list(APPEND StorageProcess_SOURCES
-    DatabaseProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm
-    ${XPCService_SOURCES}
-)
-
 # FIXME: These should not have Development in production builds.
-set(WebKit2_WebProcess_OUTPUT_NAME com.apple.WebKit.WebContent.Development)
-set(WebKit2_NetworkProcess_OUTPUT_NAME com.apple.WebKit.Networking.Development)
+set(WebKit_WebProcess_OUTPUT_NAME com.apple.WebKit.WebContent.Development)
+set(WebKit_NetworkProcess_OUTPUT_NAME com.apple.WebKit.Networking.Development)
 
 add_definitions("-include WebKit2Prefix.h")
 
-set(WebKit2_FORWARDING_HEADERS_FILES
+set(WebKit_FORWARDING_HEADERS_FILES
+    Platform/cocoa/WKCrashReporter.h
+
     Shared/API/c/WKDiagnosticLoggingResultType.h
 
     UIProcess/API/C/WKPageDiagnosticLoggingClient.h
@@ -470,11 +462,16 @@ set(WebKit2_FORWARDING_HEADERS_FILES
     UIProcess/API/C/WKPageRenderingProgressEvents.h
 )
 
-list(APPEND WebKit2_MESSAGES_IN_FILES
+list(APPEND WebKit_MESSAGES_IN_FILES
+    NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in
+
     Shared/API/Cocoa/RemoteObjectRegistry.messages.in
 
-    UIProcess/Cocoa/ViewGestureController.messages.in
-    UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in
+    UIProcess/ViewGestureController.messages.in
+
+    UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in
+
+    UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in
 
     UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in
 
@@ -484,7 +481,7 @@ list(APPEND WebKit2_MESSAGES_IN_FILES
     WebProcess/WebPage/ViewGestureGeometryCollector.messages.in
 )
 
-set(WebKit2_FORWARDING_HEADERS_DIRECTORIES
+set(WebKit_FORWARDING_HEADERS_DIRECTORIES
     Platform
     Shared
 
@@ -501,6 +498,7 @@ set(WebKit2_FORWARDING_HEADERS_DIRECTORIES
     Shared/API/c/cf
     Shared/API/c/mac
 
+    UIProcess
     UIProcess/Cocoa
 
     UIProcess/API/C
@@ -516,7 +514,7 @@ set(WebKit2_FORWARDING_HEADERS_DIRECTORIES
     WebProcess/InjectedBundle/API/mac
 )
 
-WEBKIT_CREATE_FORWARDING_HEADERS(WebKit FILES ${WebKit2_FORWARDING_HEADERS_FILES} DIRECTORIES ${WebKit2_FORWARDING_HEADERS_DIRECTORIES})
+WEBKIT_CREATE_FORWARDING_HEADERS(WebKit FILES ${WebKit_FORWARDING_HEADERS_FILES} DIRECTORIES ${WebKit_FORWARDING_HEADERS_DIRECTORIES})
 
 # This is needed right now to import ObjC headers instead of including them.
 # FIXME: Forwarding headers should be copies of actual headers.
@@ -524,7 +522,7 @@ file(GLOB ObjCHeaders UIProcess/API/Cocoa/*.h)
 foreach (_file ${ObjCHeaders})
     get_filename_component(_name ${_file} NAME)
     if (NOT EXISTS ${FORWARDING_HEADERS_DIR}/WebKit/${_name})
-        file(WRITE ${FORWARDING_HEADERS_DIR}/WebKit/${_name} "#import <WebKit2/UIProcess/API/Cocoa/${_name}>")
+        file(WRITE ${FORWARDING_HEADERS_DIR}/WebKit/${_name} "#import <WebKit/UIProcess/API/Cocoa/${_name}>")
     endif ()
 endforeach ()
 
@@ -541,6 +539,7 @@ set(WebKitLegacyForwardingHeaders
     WebCoreStatistics.h
     WebDOMOperations.h
     WebDOMOperationsPrivate.h
+    WebDatabaseManagerPrivate.h
     WebDataSource.h
     WebDataSourcePrivate.h
     WebDefaultPolicyDelegate.h
@@ -576,6 +575,7 @@ set(WebKitLegacyForwardingHeaders
     WebQuotaManager.h
     WebScriptWorld.h
     WebSecurityOriginPrivate.h
+    WebStorageManagerPrivate.h
     WebTypesInternal.h
     WebUIDelegate.h
     WebUIDelegatePrivate.h
@@ -731,15 +731,53 @@ foreach (_file ${ObjCForwardingHeaders})
     file(WRITE ${FORWARDING_HEADERS_DIR}/WebKit/${_file} "#import <WebKitLegacy/${_file}>")
 endforeach ()
 
-list(APPEND WebKit2_AUTOMATION_PROTOCOL_GENERATOR_EXTRA_FLAGS
+list(APPEND WebKit_AUTOMATION_PROTOCOL_GENERATOR_EXTRA_FLAGS
     --platform=macOS
 )
 
 # FIXME: These should not be necessary.
-file(WRITE ${FORWARDING_HEADERS_DIR}/WebKit/WKImageCG.h "#import <WebKit2/Shared/API/c/cg/WKImageCG.h>")
-file(WRITE ${FORWARDING_HEADERS_DIR}/WebKit/WebStorageManagerPrivate.h "#import <WebKit/mac/Storage/WebStorageManagerPrivate.h>")
-file(WRITE ${FORWARDING_HEADERS_DIR}/WebKit/WebDatabaseManagerPrivate.h "#import <WebKit/mac/Storage/WebDatabaseManagerPrivate.h>")
+file(WRITE ${FORWARDING_HEADERS_DIR}/WebKit/WKImageCG.h "#import <WebKit/Shared/API/c/cg/WKImageCG.h>")
 
 set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-compatibility_version 1 -current_version ${WEBKIT_MAC_VERSION}")
 
-set(WebKit2_OUTPUT_NAME WebKit)
+set(WebKit_OUTPUT_NAME WebKit)
+
+# XPC Services
+
+function(WEBKIT_DEFINE_XPC_SERVICES)
+    set(WebKit_XPC_SERVICE_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/WebKit.framework/Versions/A/XPCServices)
+    WEBKIT_CREATE_SYMLINK(WebProcess ${WebKit_XPC_SERVICE_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/WebKit.framework/XPCServices)
+
+    function(WEBKIT_XPC_SERVICE _target _bundle_identifier _info_plist _executable_name)
+        set(_service_dir ${WebKit_XPC_SERVICE_DIR}/${_bundle_identifier}.xpc/Contents)
+        make_directory(${_service_dir}/MacOS)
+        make_directory(${_service_dir}/_CodeSignature)
+        make_directory(${_service_dir}/Resources)
+
+        # FIXME: These version strings don't match Xcode's.
+        set(BUNDLE_VERSION ${WEBKIT_VERSION})
+        set(SHORT_VERSION_STRING ${WEBKIT_VERSION_MAJOR})
+        set(BUNDLE_VERSION ${WEBKIT_VERSION})
+        set(EXECUTABLE_NAME ${_executable_name})
+        set(PRODUCT_BUNDLE_IDENTIFIER ${_bundle_identifier})
+        set(PRODUCT_NAME ${_bundle_identifier})
+        configure_file(${_info_plist} ${_service_dir}/Info.plist)
+
+        set_target_properties(${_target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${_service_dir}/MacOS")
+    endfunction()
+
+    WEBKIT_XPC_SERVICE(WebProcess
+        "com.apple.WebKit.WebContent"
+        ${WEBKIT_DIR}/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist
+        ${WebKit_WebProcess_OUTPUT_NAME})
+
+    WEBKIT_XPC_SERVICE(NetworkProcess
+        "com.apple.WebKit.Networking"
+        ${WEBKIT_DIR}/NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist
+        ${WebKit_NetworkProcess_OUTPUT_NAME})
+
+    add_custom_target(WebContentProcessNib COMMAND
+        ibtool --compile ${WebKit_XPC_SERVICE_DIR}/com.apple.WebKit.WebContent.xpc/Contents/Resources/WebContentProcess.nib ${WEBKIT_DIR}/Resources/WebContentProcess.xib
+        VERBATIM)
+    add_dependencies(WebKit WebContentProcessNib)
+endfunction()