Title: [222927] trunk
Revision
222927
Author
[email protected]
Date
2017-10-05 12:09:53 -0700 (Thu, 05 Oct 2017)

Log Message

Make progress toward properly-formed XPC services in the Mac CMake build
https://bugs.webkit.org/show_bug.cgi?id=177918

Reviewed by Alex Christensen.

.:

* Source/cmake/WebKitMacros.cmake:
Add a macro wrapper around 'ln'.

Source/WebKit:

* CMakeLists.txt:
* PlatformMac.cmake:
Turn on the storage process on Mac, and fix its build.
Move XPC services to Versions/A/XPCServices and add the toplevel
XPCServices as a symlink of that.
Run the XPC services' Info.plists through configure_file, and substitute
the important variables (most critically the bundle identifier).
Factor out the service setup so we don't keep duplicating it as it
gets more complicated.

Modified Paths

Diff

Modified: trunk/ChangeLog (222926 => 222927)


--- trunk/ChangeLog	2017-10-05 19:02:03 UTC (rev 222926)
+++ trunk/ChangeLog	2017-10-05 19:09:53 UTC (rev 222927)
@@ -1,3 +1,13 @@
+2017-10-05  Tim Horton  <[email protected]>
+
+        Make progress toward properly-formed XPC services in the Mac CMake build
+        https://bugs.webkit.org/show_bug.cgi?id=177918
+
+        Reviewed by Alex Christensen.
+
+        * Source/cmake/WebKitMacros.cmake:
+        Add a macro wrapper around 'ln'.
+
 2017-10-03  Frederic Wang  <[email protected]>
 
         Remove Brotli from Source/ThirdParty

Modified: trunk/Source/WebKit/CMakeLists.txt (222926 => 222927)


--- trunk/Source/WebKit/CMakeLists.txt	2017-10-05 19:02:03 UTC (rev 222926)
+++ trunk/Source/WebKit/CMakeLists.txt	2017-10-05 19:09:53 UTC (rev 222927)
@@ -927,19 +927,13 @@
     set_target_properties(NetworkProcess PROPERTIES OUTPUT_NAME ${WebKit_NetworkProcess_OUTPUT_NAME})
 endif ()
 
-if (NOT "${PORT}" STREQUAL "Mac")
-    add_executable(StorageProcess ${StorageProcess_SOURCES})
-    ADD_WEBKIT_PREFIX_HEADER(StorageProcess)
-    target_link_libraries(StorageProcess ${StorageProcess_LIBRARIES})
-    install(TARGETS StorageProcess DESTINATION "${LIBEXEC_INSTALL_DIR}")
+add_executable(StorageProcess ${StorageProcess_SOURCES})
+ADD_WEBKIT_PREFIX_HEADER(StorageProcess)
+target_link_libraries(StorageProcess ${StorageProcess_LIBRARIES})
+install(TARGETS StorageProcess DESTINATION "${LIBEXEC_INSTALL_DIR}")
 
-    if (COMPILER_IS_GCC_OR_CLANG)
-        WEBKIT_ADD_TARGET_CXX_FLAGS(StorageProcess -Wno-unused-parameter)
-    endif ()
-
-    if (WebKit_StorageProcess_OUTPUT_NAME)
-        set_target_properties(StorageProcess PROPERTIES OUTPUT_NAME ${WebKit_StorageProcess_OUTPUT_NAME})
-    endif ()
+if (WebKit_StorageProcess_OUTPUT_NAME)
+    set_target_properties(StorageProcess PROPERTIES OUTPUT_NAME ${WebKit_StorageProcess_OUTPUT_NAME})
 endif ()
 
 if (COMPILER_IS_GCC_OR_CLANG)
@@ -946,8 +940,10 @@
     WEBKIT_ADD_TARGET_CXX_FLAGS(WebKit -Wno-unused-parameter)
     WEBKIT_ADD_TARGET_CXX_FLAGS(WebProcess -Wno-unused-parameter)
     WEBKIT_ADD_TARGET_CXX_FLAGS(NetworkProcess -Wno-unused-parameter)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(StorageProcess -Wno-unused-parameter)
 endif ()
 
+# FIXME: Mac should build a plugin process.
 if (ENABLE_PLUGIN_PROCESS AND NOT "${PORT}" STREQUAL "Mac")
     add_definitions(-DENABLE_PLUGIN_PROCESS=1)
     add_executable(PluginProcess ${PluginProcess_SOURCES})
@@ -965,34 +961,10 @@
 endif ()
 
 if ("${PORT}" STREQUAL "Mac")
-    set(_web_xpc_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/WebKit.framework/XPCServices/com.apple.WebKit.WebContent.Development.xpc/Contents)
-    make_directory(${_web_xpc_dir}/MacOS)
-    make_directory(${_web_xpc_dir}/Resources)
-    make_directory(${_web_xpc_dir}/_CodeSignature)
-
-    add_custom_target(WebContentProcessNib COMMAND
-        ibtool --compile ${_web_xpc_dir}/Resources/WebContentProcess.nib ${WEBKIT_DIR}/Resources/WebContentProcess.xib
-        VERBATIM)
-    add_dependencies(WebKit WebContentProcessNib)
-
-    # FIXME: This shouldn't be two operations.
-    file(COPY ${WEBKIT_DIR}/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist DESTINATION ${_web_xpc_dir})
-    file(RENAME ${_web_xpc_dir}/Info-OSX.plist ${_web_xpc_dir}/Info.plist)
-
-    set_target_properties(WebProcess PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${_web_xpc_dir}/MacOS")
-
-
-    set(_net_xpc_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/WebKit.framework/XPCServices/com.apple.WebKit.Networking.Development.xpc/Contents)
-    make_directory(${_net_xpc_dir}/MacOS)
-    make_directory(${_net_xpc_dir}/_CodeSignature)
-
-    # FIXME: This shouldn't be two operations.
-    file(COPY ${WEBKIT_DIR}/NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist DESTINATION ${_net_xpc_dir})
-    file(RENAME ${_net_xpc_dir}/Info-OSX.plist ${_net_xpc_dir}/Info.plist)
-
-    set_target_properties(NetworkProcess PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${_net_xpc_dir}/MacOS")
+    WEBKIT_DEFINE_XPC_SERVICES()
 else ()
     WEBKIT_POPULATE_LIBRARY_VERSION(WEBKIT)
+
     set_target_properties(WebKit PROPERTIES VERSION ${WEBKIT_VERSION} SOVERSION ${WEBKIT_VERSION_MAJOR})
 
     install(TARGETS WebKit WebProcess NetworkProcess

Modified: trunk/Source/WebKit/ChangeLog (222926 => 222927)


--- trunk/Source/WebKit/ChangeLog	2017-10-05 19:02:03 UTC (rev 222926)
+++ trunk/Source/WebKit/ChangeLog	2017-10-05 19:09:53 UTC (rev 222927)
@@ -1,3 +1,20 @@
+2017-10-05  Tim Horton  <[email protected]>
+
+        Make progress toward properly-formed XPC services in the Mac CMake build
+        https://bugs.webkit.org/show_bug.cgi?id=177918
+
+        Reviewed by Alex Christensen.
+
+        * CMakeLists.txt:
+        * PlatformMac.cmake:
+        Turn on the storage process on Mac, and fix its build.
+        Move XPC services to Versions/A/XPCServices and add the toplevel
+        XPCServices as a symlink of that.
+        Run the XPC services' Info.plists through configure_file, and substitute
+        the important variables (most critically the bundle identifier).
+        Factor out the service setup so we don't keep duplicating it as it
+        gets more complicated.
+
 2017-10-05  Andy Estes  <[email protected]>
 
         [Payment Request] Add a payment method that supports Apple Pay

Modified: trunk/Source/WebKit/PlatformMac.cmake (222926 => 222927)


--- trunk/Source/WebKit/PlatformMac.cmake	2017-10-05 19:02:03 UTC (rev 222926)
+++ trunk/Source/WebKit/PlatformMac.cmake	2017-10-05 19:09:53 UTC (rev 222927)
@@ -457,7 +457,7 @@
 )
 
 list(APPEND StorageProcess_SOURCES
-    DatabaseProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm
+    StorageProcess/EntryPoint/mac/XPCService/StorageServiceEntryPoint.mm
     ${XPCService_SOURCES}
 )
 
@@ -464,6 +464,7 @@
 # FIXME: These should not have Development in production builds.
 set(WebKit_WebProcess_OUTPUT_NAME com.apple.WebKit.WebContent.Development)
 set(WebKit_NetworkProcess_OUTPUT_NAME com.apple.WebKit.Networking.Development)
+set(WebKit_StorageProcess_OUTPUT_NAME com.apple.WebKit.Storage.Development)
 
 add_definitions("-include WebKit2Prefix.h")
 
@@ -750,3 +751,48 @@
 set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-compatibility_version 1 -current_version ${WEBKIT_MAC_VERSION}")
 
 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})
+
+    WEBKIT_XPC_SERVICE(StorageProcess
+        "com.apple.WebKit.Storage"
+        ${WEBKIT_DIR}/StorageProcess/EntryPoint/mac/XPCService/StorageService/Info.plist
+        ${WebKit_StorageProcess_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()
\ No newline at end of file

Modified: trunk/Source/cmake/WebKitMacros.cmake (222926 => 222927)


--- trunk/Source/cmake/WebKitMacros.cmake	2017-10-05 19:02:03 UTC (rev 222926)
+++ trunk/Source/cmake/WebKitMacros.cmake	2017-10-05 19:09:53 UTC (rev 222927)
@@ -259,3 +259,10 @@
         set(${library_name}_VERSION ${PROJECT_VERSION})
     endif ()
 endmacro()
+
+macro(WEBKIT_CREATE_SYMLINK target src dest)
+    add_custom_command(TARGET ${target} POST_BUILD
+        COMMAND ln -sf ${src} ${dest}
+        DEPENDS ${dest}
+        COMMENT "Create symlink from ${src} to ${dest}")
+endmacro()
\ No newline at end of file
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to