[WPE] Use GNU install directories
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Apr 2018 15:45:48 +0000 (15:45 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Apr 2018 15:45:48 +0000 (15:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184377

Reviewed by Carlos Garcia Campos.

.:

Notably, this means all the CMake arguments that distributors use to customize install
directories (-DCMAKE_INSTALL_*DIR) will no longer be ignored.

* Source/cmake/OptionsCommon.cmake:
* Source/cmake/OptionsWPE.cmake:

Source/WebKit:

Merge ProcessExecutablePathGtk and ProcessExecutablePathWPE into ProcessExecutablePathGLib.
WPE will now load its secondary processes from PKGLIBEXECDIR, like WebKitGTK+.

* PlatformWPE.cmake:
* Shared/glib/ProcessExecutablePathGLib.cpp: Renamed from Source/WebKit/Shared/gtk/ProcessExecutablePathGtk.cpp.
(WebKit::getExecutablePath):
(WebKit::findWebKitProcess):
(WebKit::executablePathOfWebProcess):
(WebKit::executablePathOfPluginProcess):
(WebKit::executablePathOfNetworkProcess):
(WebKit::executablePathOfStorageProcess):
* Shared/wpe/ProcessExecutablePathWPE.cpp: Removed.
* SourcesGTK.txt:
* SourcesWPE.txt:

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

ChangeLog
Source/WebKit/ChangeLog
Source/WebKit/PlatformGTK.cmake
Source/WebKit/PlatformWPE.cmake
Source/WebKit/Shared/glib/ProcessExecutablePathGLib.cpp [moved from Source/WebKit/Shared/gtk/ProcessExecutablePathGtk.cpp with 90% similarity]
Source/WebKit/Shared/wpe/ProcessExecutablePathWPE.cpp [deleted file]
Source/WebKit/SourcesGTK.txt
Source/WebKit/SourcesWPE.txt
Source/cmake/OptionsCommon.cmake
Source/cmake/OptionsWPE.cmake

index 9af0aec..e3c16b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        [WPE] Use GNU install directories
+        https://bugs.webkit.org/show_bug.cgi?id=184377
+
+        Reviewed by Carlos Garcia Campos.
+
+        Notably, this means all the CMake arguments that distributors use to customize install
+        directories (-DCMAKE_INSTALL_*DIR) will no longer be ignored.
+
+        * Source/cmake/OptionsCommon.cmake:
+        * Source/cmake/OptionsWPE.cmake:
+
 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
index e21564a..d0ee5de 100644 (file)
@@ -1,5 +1,27 @@
 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
 
+        [WPE] Use GNU install directories
+        https://bugs.webkit.org/show_bug.cgi?id=184377
+
+        Reviewed by Carlos Garcia Campos.
+
+        Merge ProcessExecutablePathGtk and ProcessExecutablePathWPE into ProcessExecutablePathGLib.
+        WPE will now load its secondary processes from PKGLIBEXECDIR, like WebKitGTK+.
+
+        * PlatformWPE.cmake:
+        * Shared/glib/ProcessExecutablePathGLib.cpp: Renamed from Source/WebKit/Shared/gtk/ProcessExecutablePathGtk.cpp.
+        (WebKit::getExecutablePath):
+        (WebKit::findWebKitProcess):
+        (WebKit::executablePathOfWebProcess):
+        (WebKit::executablePathOfPluginProcess):
+        (WebKit::executablePathOfNetworkProcess):
+        (WebKit::executablePathOfStorageProcess):
+        * Shared/wpe/ProcessExecutablePathWPE.cpp: Removed.
+        * SourcesGTK.txt:
+        * SourcesWPE.txt:
+
+2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
+
         [GTK] WaylandCompositorDisplay leaks its wl_display
         https://bugs.webkit.org/show_bug.cgi?id=184406
 
index e39525a..140d8f7 100644 (file)
@@ -620,11 +620,12 @@ if (ENABLE_PLUGIN_PROCESS_GTK2)
 
         Shared/cairo/ShareableBitmapCairo.cpp
 
+        Shared/glib/ProcessExecutablePathGLib.cpp
+
         Shared/gtk/NativeWebKeyboardEventGtk.cpp
         Shared/gtk/NativeWebMouseEventGtk.cpp
         Shared/gtk/NativeWebTouchEventGtk.cpp
         Shared/gtk/NativeWebWheelEventGtk.cpp
-        Shared/gtk/ProcessExecutablePathGtk.cpp
         Shared/gtk/WebEventFactory.cpp
 
         Shared/soup/WebCoreArgumentCodersSoup.cpp
index dfb7b46..5c11364 100644 (file)
@@ -14,7 +14,7 @@ configure_file(wpe/wpe-webkit.pc.in ${CMAKE_BINARY_DIR}/wpe-webkit.pc @ONLY)
 
 add_definitions(-DWEBKIT2_COMPILATION)
 
-add_definitions(-DLIBEXECDIR="${LIBEXEC_INSTALL_DIR}")
+add_definitions(-DPKGLIBEXECDIR="${LIBEXEC_INSTALL_DIR}")
 add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
 
 if (NOT DEVELOPER_MODE AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
 
 #include <WebCore/FileSystem.h>
 #include <glib.h>
-
-#if ENABLE(DEVELOPER_MODE)
 #include <wtf/glib/GLibUtilities.h>
-#endif
 
-namespace WebKit {
 using namespace WebCore;
 
+namespace WebKit {
+
 #if ENABLE(DEVELOPER_MODE)
 static String getExecutablePath()
 {
     CString executablePath = getCurrentExecutablePath();
     if (!executablePath.isNull())
         return FileSystem::directoryName(FileSystem::stringFromFileSystemRepresentation(executablePath.data()));
-    return String();
+    return { };
 }
 #endif
 
@@ -70,22 +68,38 @@ static String findWebKitProcess(const char* processName)
 
 String executablePathOfWebProcess()
 {
+#if PLATFORM(WPE)
+    return findWebKitProcess("WPEWebProcess");
+#else
     return findWebKitProcess("WebKitWebProcess");
+#endif
 }
 
 String executablePathOfPluginProcess()
 {
+#if PLATFORM(WPE)
+    return findWebKitProcess("WPEPluginProcess");
+#else
     return findWebKitProcess("WebKitPluginProcess");
+#endif
 }
 
 String executablePathOfNetworkProcess()
 {
+#if PLATFORM(WPE)
+    return findWebKitProcess("WPENetworkProcess");
+#else
     return findWebKitProcess("WebKitNetworkProcess");
+#endif
 }
 
 String executablePathOfStorageProcess()
 {
+#if PLATFORM(WPE)
+    return findWebKitProcess("WPEStorageProcess");
+#else
     return findWebKitProcess("WebKitStorageProcess");
+#endif
 }
 
 } // namespace WebKit
diff --git a/Source/WebKit/Shared/wpe/ProcessExecutablePathWPE.cpp b/Source/WebKit/Shared/wpe/ProcessExecutablePathWPE.cpp
deleted file mode 100644 (file)
index 5ed56d3..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY MOTOROLA INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ProcessExecutablePath.h"
-
-#include <WebCore/FileSystem.h>
-#include <glib.h>
-#include <wtf/glib/GLibUtilities.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-static String getExecutablePath()
-{
-    CString executablePath = getCurrentExecutablePath();
-    if (!executablePath.isNull())
-        return FileSystem::directoryName(FileSystem::stringFromFileSystemRepresentation(executablePath.data()));
-    return String();
-}
-
-static String findWebKitProcess(const char* processName)
-{
-    static const char* execDirectory = g_getenv("WEBKIT_EXEC_PATH");
-    if (execDirectory) {
-        String processPath = FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(execDirectory), processName);
-        if (FileSystem::fileExists(processPath))
-            return processPath;
-    }
-
-    static String executablePath = getExecutablePath();
-    if (!executablePath.isNull()) {
-        String processPath = FileSystem::pathByAppendingComponent(executablePath, processName);
-        if (FileSystem::fileExists(processPath))
-            return processPath;
-    }
-
-    return FileSystem::pathByAppendingComponent(FileSystem::stringFromFileSystemRepresentation(LIBEXECDIR), processName);
-}
-
-String executablePathOfWebProcess()
-{
-    return findWebKitProcess("WPEWebProcess");
-}
-
-String executablePathOfPluginProcess()
-{
-    return findWebKitProcess("WPEPluginProcess");
-}
-
-String executablePathOfNetworkProcess()
-{
-    return findWebKitProcess("WPENetworkProcess");
-}
-
-String executablePathOfStorageProcess()
-{
-    return findWebKitProcess("WPEStorageProcess");
-}
-
-} // namespace WebKit
index e3ce356..b7ab0dd 100644 (file)
@@ -84,6 +84,7 @@ Shared/Plugins/unix/PluginSearchPath.cpp
 
 Shared/cairo/ShareableBitmapCairo.cpp @no-unify
 
+Shared/glib/ProcessExecutablePathGLib.cpp @no-unify
 Shared/glib/WebContextMenuItemGlib.cpp
 
 Shared/gtk/ArgumentCodersGtk.cpp
@@ -92,7 +93,6 @@ Shared/gtk/NativeWebMouseEventGtk.cpp
 Shared/gtk/NativeWebTouchEventGtk.cpp
 Shared/gtk/NativeWebWheelEventGtk.cpp
 Shared/gtk/PrintInfoGtk.cpp
-Shared/gtk/ProcessExecutablePathGtk.cpp @no-unify
 Shared/gtk/WebErrorsGtk.cpp
 Shared/gtk/WebEventFactory.cpp
 Shared/gtk/WebSelectionData.cpp
index bab9b06..d3f886f 100644 (file)
@@ -74,6 +74,7 @@ Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp
 
 Shared/cairo/ShareableBitmapCairo.cpp
 
+Shared/glib/ProcessExecutablePathGLib.cpp
 Shared/glib/WebContextMenuItemGlib.cpp
 
 Shared/linux/WebMemorySamplerLinux.cpp
@@ -87,7 +88,6 @@ Shared/wpe/NativeWebKeyboardEventWPE.cpp
 Shared/wpe/NativeWebMouseEventWPE.cpp
 Shared/wpe/NativeWebTouchEventWPE.cpp
 Shared/wpe/NativeWebWheelEventWPE.cpp
-Shared/wpe/ProcessExecutablePathWPE.cpp
 Shared/wpe/WebEventFactory.cpp
 
 StorageProcess/glib/StorageProcessMainGLib.cpp
index 530bed1..af799e9 100644 (file)
@@ -107,8 +107,8 @@ if (USE_OPENMP)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
 endif ()
 
-# GTK uses the GNU installation directories as defaults.
-if (NOT PORT STREQUAL "GTK")
+# GTK and WPE use the GNU installation directories as defaults.
+if (NOT PORT STREQUAL "GTK" AND NOT PORT STREQUAL "WPE")
     set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Absolute path to library installation directory")
     set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Absolute path to executable installation directory")
     set(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Absolute path to install executables executed by the library")
index 32c5788..c5dc4df 100644 (file)
@@ -6,6 +6,12 @@ set(WPE_API_VERSION 0.1)
 
 CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 1 0 0)
 
+# These are shared variables, but we special case their definition so that we can use the
+# CMAKE_INSTALL_* variables that are populated by the GNUInstallDirs macro.
+set(LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE PATH "Absolute path to library installation directory")
+set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}" CACHE PATH "Absolute path to executable installation directory")
+set(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/wpe-webkit-${WPE_API_VERSION}" CACHE PATH "Absolute path to install executables executed by the library")
+
 WEBKIT_OPTION_BEGIN()
 
 include(GStreamerDefinitions)