[PlayStation] Enable JavaScriptCore
authordon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2018 04:00:45 +0000 (04:00 +0000)
committerdon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2018 04:00:45 +0000 (04:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191072

Reviewed by Brent Fulgham.

.:

Add support for building the PlayStation port through JavaScriptCore.

* CMakeLists.txt:
* Source/cmake/OptionsPlayStation.cmake: Added.

Source/JavaScriptCore:

Add platform files for the PlayStation port.

* PlatformPlayStation.cmake: Added.

Source/ThirdParty:

Add platform files for the PlayStation port.

* gtest/PlatformPlayStation.cmake: Added.

Source/WTF:

Add platform files for the PlayStation port.

* wtf/PlatformPlayStation.cmake: Added.

Tools:

Add platform scripts for building the PlayStation port.
perl Tools/Scripts/build-webkit --playstation

* Scripts/build-webkit:
* Scripts/build-webkittestrunner:
* Scripts/webkitdirs.pm:
(argumentsForConfiguration):
(determineConfigurationProductDir):
(isPlayStation): Added.
(getMSBuildPlatformArgument): Added.
(buildVisualStudioProject):
(wrapperPrefixIfNeeded):
(generateBuildSystemFromCMakeProject):
* TestWebKitAPI/PlatformPlayStation.cmake: Added.

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

14 files changed:
CMakeLists.txt
ChangeLog
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/PlatformPlayStation.cmake [new file with mode: 0644]
Source/ThirdParty/ChangeLog
Source/ThirdParty/gtest/PlatformPlayStation.cmake [new file with mode: 0644]
Source/WTF/ChangeLog
Source/WTF/wtf/PlatformPlayStation.cmake [new file with mode: 0644]
Source/cmake/OptionsPlayStation.cmake [new file with mode: 0644]
Tools/ChangeLog
Tools/Scripts/build-webkit
Tools/Scripts/build-webkittestrunner
Tools/Scripts/webkitdirs.pm
Tools/TestWebKitAPI/PlatformPlayStation.cmake [new file with mode: 0644]

index ae5c7b7..8e180d4 100644 (file)
@@ -40,6 +40,7 @@ set(ALL_PORTS
     GTK
     JSCOnly
     Mac
+    PlayStation
     WPE
     WinCairo
 )
index a62563c..fd211c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2018-10-30  Don Olmstead  <don.olmstead@sony.com>
+
+        [PlayStation] Enable JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=191072
+
+        Reviewed by Brent Fulgham.
+
+        Add support for building the PlayStation port through JavaScriptCore.
+
+        * CMakeLists.txt:
+        * Source/cmake/OptionsPlayStation.cmake: Added.
+
 2018-10-29  Tadeu Zagallo  <tzagallo@apple.com>
 
         New bytecode format for JSC
index 3962f54..9cb8486 100644 (file)
@@ -1,3 +1,14 @@
+2018-10-30  Don Olmstead  <don.olmstead@sony.com>
+
+        [PlayStation] Enable JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=191072
+
+        Reviewed by Brent Fulgham.
+
+        Add platform files for the PlayStation port.
+
+        * PlatformPlayStation.cmake: Added.
+
 2018-10-30  Alexey Proskuryakov  <ap@apple.com>
 
         Clean up some obsolete MAX_ALLOWED macros
diff --git a/Source/JavaScriptCore/PlatformPlayStation.cmake b/Source/JavaScriptCore/PlatformPlayStation.cmake
new file mode 100644 (file)
index 0000000..02fcb4e
--- /dev/null
@@ -0,0 +1,6 @@
+if (${WTF_LIBRARY_TYPE} STREQUAL "STATIC")
+    add_definitions(-DSTATICALLY_LINKED_WITH_WTF)
+endif ()
+
+# This overrides the default x64 value of 1GB for the memory pool size
+add_definitions(-DFIXED_EXECUTABLE_MEMORY_POOL_SIZE_IN_MB=64)
index 2a582aa..224f979 100644 (file)
@@ -1,3 +1,14 @@
+2018-10-30  Don Olmstead  <don.olmstead@sony.com>
+
+        [PlayStation] Enable JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=191072
+
+        Reviewed by Brent Fulgham.
+
+        Add platform files for the PlayStation port.
+
+        * gtest/PlatformPlayStation.cmake: Added.
+
 2018-10-08  Dan Bernstein  <mitz@apple.com>
 
         gtest part of [Xcode] Update some build settings as recommended by Xcode 10
diff --git a/Source/ThirdParty/gtest/PlatformPlayStation.cmake b/Source/ThirdParty/gtest/PlatformPlayStation.cmake
new file mode 100644 (file)
index 0000000..d5f4d14
--- /dev/null
@@ -0,0 +1,9 @@
+set(gtest_LIBRARY_TYPE STATIC)
+
+list(APPEND gtest_DEFINITIONS
+    -DGTEST_HAS_POSIX_RE=0
+    -DGTEST_HAS_TR1_TUPLE=0
+)
+
+# localtime_r isn't available so map to localtime_s
+add_definitions(-Dlocaltime_r=localtime_s)
index 3f19302..881b51e 100644 (file)
@@ -1,3 +1,14 @@
+2018-10-30  Don Olmstead  <don.olmstead@sony.com>
+
+        [PlayStation] Enable JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=191072
+
+        Reviewed by Brent Fulgham.
+
+        Add platform files for the PlayStation port.
+
+        * wtf/PlatformPlayStation.cmake: Added.
+
 2018-10-30  David Kilzer  <ddkilzer@apple.com>
 
         XSLTProcessor should limit max transform depth
diff --git a/Source/WTF/wtf/PlatformPlayStation.cmake b/Source/WTF/wtf/PlatformPlayStation.cmake
new file mode 100644 (file)
index 0000000..b97fec4
--- /dev/null
@@ -0,0 +1,21 @@
+list(APPEND WTF_SOURCES
+    generic/MainThreadGeneric.cpp
+    generic/MemoryFootprintGeneric.cpp
+    generic/MemoryPressureHandlerGeneric.cpp
+    generic/RunLoopGeneric.cpp
+    generic/WorkQueueGeneric.cpp
+
+    text/unix/TextBreakIteratorInternalICUUnix.cpp
+
+    unix/CPUTimeUnix.cpp
+    unix/LanguageUnix.cpp
+)
+
+list(APPEND WTF_LIBRARIES
+    ${CMAKE_THREAD_LIBS_INIT}
+    ${ICU_LIBRARIES}
+
+    ${C_STD_LIBRARY}
+    ${KERNEL_LIBRARY}
+    ${POSIX_COMPATABILITY_LIBRARY}
+)
diff --git a/Source/cmake/OptionsPlayStation.cmake b/Source/cmake/OptionsPlayStation.cmake
new file mode 100644 (file)
index 0000000..85194a2
--- /dev/null
@@ -0,0 +1,58 @@
+set(PORT PlayStation)
+
+add_definitions(-DWTF_PLATFORM_PLAYSTATION=1)
+
+WEBKIT_OPTION_BEGIN()
+
+# Turn off JIT
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTL_JIT PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DFG_JIT PRIVATE OFF)
+
+# Disable Remote Inspector until implementation lands
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE OFF)
+
+WEBKIT_OPTION_END()
+
+# Do not use a separate directory based on configuration when building
+# with the Visual Studio generator
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
+
+# Specify third party library directory
+if (NOT WEBKIT_LIBRARIES_DIR)
+    if (DEFINED ENV{WEBKIT_LIBRARIES})
+        set(WEBKIT_LIBRARIES_DIR "$ENV{WEBKIT_LIBRARIES}" CACHE PATH "Path to PlayStationRequirements")
+    else ()
+        set(WEBKIT_LIBRARIES_DIR "${CMAKE_SOURCE_DIR}/WebKitLibraries/playstation" CACHE PATH "Path to PlayStationRequirements")
+    endif ()
+endif ()
+
+list(APPEND CMAKE_PREFIX_PATH ${WEBKIT_LIBRARIES_DIR})
+
+find_library(C_STD_LIBRARY c)
+find_library(KERNEL_LIBRARY kernel)
+find_library(POSIX_COMPATABILITY_LIBRARY posixex)
+
+find_package(Threads REQUIRED)
+find_package(ICU REQUIRED)
+
+SET_AND_EXPOSE_TO_BUILD(USE_EXPORT_MACROS ON)
+SET_AND_EXPOSE_TO_BUILD(HAVE_PTHREAD_SETNAME_NP ON)
+
+set(WTF_LIBRARY_TYPE STATIC)
+set(JavaScriptCore_LIBRARY_TYPE SHARED)
+
+set(ENABLE_API_TESTS ON)
+set(ENABLE_WEBCORE OFF)
+set(ENABLE_WEBKIT OFF)
+set(ENABLE_WEBKIT_LEGACY OFF)
+
+# Enable multi process builds for Visual Studio
+if (NOT ${CMAKE_GENERATOR} MATCHES "Ninja")
+    add_definitions(/MP)
+endif ()
index a1b05f9..fa1b70c 100644 (file)
@@ -1,3 +1,25 @@
+2018-10-30  Don Olmstead  <don.olmstead@sony.com>
+
+        [PlayStation] Enable JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=191072
+
+        Reviewed by Brent Fulgham.
+
+        Add platform scripts for building the PlayStation port.
+        perl Tools/Scripts/build-webkit --playstation
+
+        * Scripts/build-webkit:
+        * Scripts/build-webkittestrunner:
+        * Scripts/webkitdirs.pm:
+        (argumentsForConfiguration):
+        (determineConfigurationProductDir):
+        (isPlayStation): Added.
+        (getMSBuildPlatformArgument): Added.
+        (buildVisualStudioProject):
+        (wrapperPrefixIfNeeded):
+        (generateBuildSystemFromCMakeProject):
+        * TestWebKitAPI/PlatformPlayStation.cmake: Added.
+
 2018-10-30  Brent Fulgham  <bfulgham@apple.com>
 
         [Win][Direct2D] Support building DumpRenderTree for Direct2D
index e008a2c..8560c16 100755 (executable)
@@ -119,6 +119,7 @@ Usage: $programName [options] [options to pass to build system]
   --gtk                             Build the GTK+ port
   --wpe                             Build the WPE port
   --wincairo                        Build using Cairo (rather than CoreGraphics) on Windows
+  --playstation                     Build the PlayStation port
 
   --inspector-frontend              Copy Web Inspector user interface resources to the build directory
 
@@ -198,7 +199,7 @@ if (!isCMakeBuild()) {
     }
 }
 
-if ((isAppleWebKit() || isWinCairo()) && !-d "WebKitLibraries") {
+if ((isAppleWebKit() || isWinCairo() || isPlayStation()) && !-d "WebKitLibraries") {
     die "Error: No WebKitLibraries directory found. Please do a fresh checkout.\n";
 }
 
@@ -294,7 +295,7 @@ if (isCMakeBuild() && !isAnyWindows()) {
 }
 
 my $baseProductDir = baseProductDir();
-if (isAppleWinWebKit() || isWinCairo()) {
+if (isAppleWinWebKit() || isWinCairo() || isPlayStation()) {
     my @featureArgs = cmakeArgsFromFeatures(@features, !$noExperimentalFeatures);
     removeCMakeCache(@featureArgs);
 
index e87c56c..17737fa 100755 (executable)
@@ -62,8 +62,8 @@ chdir "Tools/WebKitTestRunner" or die;
 my $result;
 if (isAppleCocoaWebKit()) {
     $result = buildXCodeProject("WebKitTestRunner", $clean, XcodeOptions(), @ARGV);
-} elsif (isGtk() || isWPE()) {
-    # GTK+ and WPE build everything in one shot. No need to build anything here.
+} elsif (isGtk() || isWPE() || isPlayStation()) {
+    # GTK+, WPE, and PlayStation build everything in one shot. No need to build anything here.
     $result = 0;
 } else {
     die "WebKitTestRunner is not supported on this platform.\n";
index 0b5cf1e..0181922 100755 (executable)
@@ -104,16 +104,17 @@ BEGIN {
 
 # Ports
 use constant {
-    AppleWin => "AppleWin",
-    GTK      => "GTK",
-    iOS      => "iOS",
-    tvOS     => "tvOS",
-    watchOS  => "watchOS",
-    Mac      => "Mac",
-    JSCOnly  => "JSCOnly",
-    WinCairo => "WinCairo",
-    WPE      => "WPE",
-    Unknown  => "Unknown"
+    AppleWin    => "AppleWin",
+    GTK         => "GTK",
+    iOS         => "iOS",
+    tvOS        => "tvOS",
+    watchOS     => "watchOS",
+    Mac         => "Mac",
+    JSCOnly     => "JSCOnly",
+    PlayStation => "PlayStation",
+    WinCairo    => "WinCairo",
+    WPE         => "WPE",
+    Unknown     => "Unknown"
 };
 
 use constant USE_OPEN_COMMAND => 1; # Used in runMacWebKitApp().
@@ -494,6 +495,7 @@ sub argumentsForConfiguration()
     push(@args, '--wpe') if isWPE();
     push(@args, '--jsc-only') if isJSCOnly();
     push(@args, '--wincairo') if isWinCairo();
+    push(@args, '--playstation') if isPlayStation();
     return @args;
 }
 
@@ -771,7 +773,7 @@ sub determineConfigurationProductDir
     return if defined $configurationProductDir;
     determineBaseProductDir();
     determineConfiguration();
-    if (isAppleWinWebKit() || isWinCairo()) {
+    if (isAppleWinWebKit() || isWinCairo() || isPlayStation()) {
         $configurationProductDir = File::Spec->catdir($baseProductDir, $configuration);
     } else {
         if (usesPerConfigurationBuildDirectory()) {
@@ -1212,6 +1214,7 @@ sub determinePortName()
     my %argToPortName = (
         gtk => GTK,
         'jsc-only' => JSCOnly,
+        playstation => PlayStation,
         wincairo => WinCairo,
         wpe => WPE
     );
@@ -1280,6 +1283,11 @@ sub isWPE()
     return portName() eq WPE;
 }
 
+sub isPlayStation()
+{
+    return portName() eq PlayStation;
+}
+
 # Determine if this is debian, ubuntu, linspire, or something similar.
 sub isDebianBased()
 {
@@ -1972,6 +1980,17 @@ sub usingVisualStudioExpress()
     return $willUseVCExpressWhenBuilding;
 }
 
+sub getMSBuildPlatformArgument()
+{
+    if (isPlayStation()) {
+        return "";
+    } elsif (isWin64()) {
+        return "/p:Platform=x64";
+    } else {
+        return "/p:Platform=Win32";
+    }
+}
+
 sub buildVisualStudioProject
 {
     my ($project, $clean) = @_;
@@ -1988,7 +2007,7 @@ sub buildVisualStudioProject
         $action = "/t:clean";
     }
 
-    my $platform = "/p:Platform=" . (isWin64() ? "x64" : "Win32");
+    my $platform = getMSBuildPlatformArgument();
     my $logPath = File::Spec->catdir($baseProductDir, $configuration);
     make_path($logPath) unless -d $logPath or $logPath eq ".";
 
@@ -2098,7 +2117,7 @@ sub runInFlatpakIfAvailable(@)
 sub wrapperPrefixIfNeeded()
 {
 
-    if (isAnyWindows() || isJSCOnly()) {
+    if (isAnyWindows() || isJSCOnly() || isPlayStation()) {
         return ();
     }
     if (isAppleCocoaWebKit()) {
@@ -2274,6 +2293,8 @@ sub generateBuildSystemFromCMakeProject
 
     push @args, "-DENABLE_ADDRESS_SANITIZER=ON" if asanIsEnabled();
 
+    push @args, '-DCMAKE_TOOLCHAIN_FILE=Platform/PlayStation' if isPlayStation();
+
     if ($willUseNinja) {
         push @args, "-G";
         if (canUseEclipseNinjaGenerator()) {
@@ -2281,10 +2302,14 @@ sub generateBuildSystemFromCMakeProject
         } else {
             push @args, "Ninja";
         }
+        push @args, "-DUSE_THIN_ARCHIVES=OFF" if isPlayStation();
     } elsif (isAnyWindows() && isWin64()) {
         push @args, '-G "Visual Studio 15 2017 Win64"';
         push @args, '-DCMAKE_GENERATOR_TOOLSET="host=x64"';
+    } elsif (isPlayStation()) {
+        push @args, '-G "Visual Studio 15"';
     }
+
     # Do not show progress of generating bindings in interactive Ninja build not to leave noisy lines on tty
     push @args, '-DSHOW_BINDINGS_GENERATION_PROGRESS=1' unless ($willUseNinja && -t STDOUT);
 
diff --git a/Tools/TestWebKitAPI/PlatformPlayStation.cmake b/Tools/TestWebKitAPI/PlatformPlayStation.cmake
new file mode 100644 (file)
index 0000000..9f1a2a6
--- /dev/null
@@ -0,0 +1,18 @@
+set(TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestWebKitAPI")
+set(TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF "${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WTF")
+
+add_definitions(-DBUILDING_JSCONLY__)
+
+include_directories(
+    ${ICU_INCLUDE_DIRS}
+    ${FORWARDING_HEADERS_DIR}
+)
+
+set(test_main_SOURCES
+    ${TESTWEBKITAPI_DIR}/generic/main.cpp
+)
+
+list(APPEND TestWTF_SOURCES
+    ${TESTWEBKITAPI_DIR}/generic/UtilitiesGeneric.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/RunLoop.cpp
+)