[PlayStation] Use OBJECT libraries for WebCore and PAL
https://bugs.webkit.org/show_bug.cgi?id=209835

Reviewed by Ross Kirsling.

.:

When compiling WebCore in debug mode ranlib was having issues with the size of
libWebCore.a. This is similar to what happened with Visual Studio and WinCairo.

Additionally hidden visibility defaults are added for the port.

* Source/cmake/OptionsPlayStation.cmake:

Source/WebCore:

After moving to object libraries MediaStrategy's constructor and destructor were
being reported as linker errors despite being set to default. Moving the definitions
to a source file stopped these issues.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/MediaStrategy.cpp: Copied from Source/WebCore/platform/MediaStrategy.h.
* platform/MediaStrategy.h:

Source/WebKit:

Use the object libraries when building WebKit.

* PlatformPlayStation.cmake:

Tools:

Use the object libraries when compiling TestWebCore.

* TestWebKitAPI/PlatformPlayStation.cmake:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@259358 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index 794dda1..583a65c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2020-04-01  Don Olmstead  <don.olmstead@sony.com>
+
+        [PlayStation] Use OBJECT libraries for WebCore and PAL
+        https://bugs.webkit.org/show_bug.cgi?id=209835
+
+        Reviewed by Ross Kirsling.
+
+        When compiling WebCore in debug mode ranlib was having issues with the size of
+        libWebCore.a. This is similar to what happened with Visual Studio and WinCairo.
+
+        Additionally hidden visibility defaults are added for the port.
+
+        * Source/cmake/OptionsPlayStation.cmake:
+
 2020-03-30  Zan Dobersek  <zdobersek@igalia.com>
 
         [WPE] Can't create WebGL context after r259139
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 1b64187..05344f5 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2020-04-01  Don Olmstead  <don.olmstead@sony.com>
+
+        [PlayStation] Use OBJECT libraries for WebCore and PAL
+        https://bugs.webkit.org/show_bug.cgi?id=209835
+
+        Reviewed by Ross Kirsling.
+
+        After moving to object libraries MediaStrategy's constructor and destructor were
+        being reported as linker errors despite being set to default. Moving the definitions
+        to a source file stopped these issues.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/MediaStrategy.cpp: Copied from Source/WebCore/platform/MediaStrategy.h.
+        * platform/MediaStrategy.h:
+
 2020-04-01  Keith Miller  <keith_miller@apple.com>
 
         Bindings that override getOwnPropertySlotByIndex need to say they MayHaveIndexedAccessors
diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt
index 3de25c4..c6d55d53 100644
--- a/Source/WebCore/Sources.txt
+++ b/Source/WebCore/Sources.txt
@@ -1769,6 +1769,7 @@
 platform/LowPowerModeNotifier.cpp
 platform/MIMETypeRegistry.cpp
 platform/MainThreadSharedTimer.cpp
+platform/MediaStrategy.cpp
 platform/NotImplemented.cpp
 platform/NowPlayingManager.cpp
 platform/Pasteboard.cpp
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 9ecea60b..d437918 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -11684,6 +11684,7 @@
 		A1F78D0B1C25422C00245446 /* ResourceResponseCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceResponseCocoa.mm; sourceTree = "<group>"; };
 		A208E222A56A0C7575F2A72E /* RenderMathMLMenclose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLMenclose.h; sourceTree = "<group>"; };
 		A2B9217216C5CC420041DCD9 /* IntRectExtent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntRectExtent.h; sourceTree = "<group>"; };
+		A31AC70A24340984007F00A2 /* MediaStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStrategy.cpp; sourceTree = "<group>"; };
 		A31C4E4C16E02AA6002F7957 /* OESTextureHalfFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OESTextureHalfFloat.cpp; sourceTree = "<group>"; };
 		A31C4E4E16E02AB4002F7957 /* OESTextureHalfFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OESTextureHalfFloat.h; sourceTree = "<group>"; };
 		A31C4E5016E02AC5002F7957 /* OESTextureHalfFloat.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = OESTextureHalfFloat.idl; sourceTree = "<group>"; };
@@ -26182,6 +26183,7 @@
 				CD641EC7181ED60100EE4C41 /* MediaSample.h */,
 				A17D275D1EAC579800BF01E7 /* MediaSelectionOption.h */,
 				414460A02412994100814BE7 /* MediaSessionIdentifier.h */,
+				A31AC70A24340984007F00A2 /* MediaStrategy.cpp */,
 				9B1229C623FE4D5F008CA751 /* MediaStrategy.h */,
 				BC772C4C0C4EB3040083285F /* MIMETypeRegistry.cpp */,
 				BC772C4D0C4EB3040083285F /* MIMETypeRegistry.h */,
diff --git a/Source/WebCore/platform/MediaStrategy.cpp b/Source/WebCore/platform/MediaStrategy.cpp
new file mode 100644
index 0000000..dee3032
--- /dev/null
+++ b/Source/WebCore/platform/MediaStrategy.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * 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 APPLE 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 APPLE 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 "MediaStrategy.h"
+
+namespace WebCore {
+
+MediaStrategy::MediaStrategy() = default;
+
+MediaStrategy::~MediaStrategy() = default;
+
+}
diff --git a/Source/WebCore/platform/MediaStrategy.h b/Source/WebCore/platform/MediaStrategy.h
index a150a3c..43d5765 100644
--- a/Source/WebCore/platform/MediaStrategy.h
+++ b/Source/WebCore/platform/MediaStrategy.h
@@ -46,7 +46,8 @@
 #endif
 
 protected:
-    virtual ~MediaStrategy() = default;
+    MediaStrategy();
+    virtual ~MediaStrategy();
 };
 
 } // namespace WebCore
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index fb51987..40cf214 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2020-04-01  Don Olmstead  <don.olmstead@sony.com>
+
+        [PlayStation] Use OBJECT libraries for WebCore and PAL
+        https://bugs.webkit.org/show_bug.cgi?id=209835
+
+        Reviewed by Ross Kirsling.
+
+        Use the object libraries when building WebKit.
+
+        * PlatformPlayStation.cmake:
+
 2020-04-01  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, reverting r259328.
diff --git a/Source/WebKit/PlatformPlayStation.cmake b/Source/WebKit/PlatformPlayStation.cmake
index d8f0bfd..b3d4262 100644
--- a/Source/WebKit/PlatformPlayStation.cmake
+++ b/Source/WebKit/PlatformPlayStation.cmake
@@ -298,6 +298,13 @@
     UIProcess/API/C/playstation/WKView.h
 )
 
+# Both PAL and WebCore are built as object libraries. The WebKit:: interface
+# targets are used. A limitation of that is the object files are not propagated
+# so they are added here.
+list(APPEND WebKit_PRIVATE_LIBRARIES
+    $<TARGET_OBJECTS:PAL>
+)
+
 WEBKIT_MAKE_FORWARDING_HEADERS(WebKit
     TARGET_NAME WebKitFrameworkHeaders
     DESTINATION ${WebKit_FRAMEWORK_HEADERS_DIR}/WebKit
diff --git a/Source/cmake/OptionsPlayStation.cmake b/Source/cmake/OptionsPlayStation.cmake
index c478a7f..983246e 100644
--- a/Source/cmake/OptionsPlayStation.cmake
+++ b/Source/cmake/OptionsPlayStation.cmake
@@ -79,6 +79,10 @@
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
 
+# Default to hidden visibility
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
+
 # Specify third party library directory
 if (NOT WEBKIT_LIBRARIES_DIR)
     if (DEFINED ENV{WEBKIT_LIBRARIES})
@@ -170,10 +174,12 @@
 set(WTF_LIBRARY_TYPE OBJECT)
 set(JavaScriptCore_LIBRARY_TYPE SHARED)
 
-# For the shared WebKit just link a STATIC WebCore since the exports from WebCore
-# and PAL are not needed.
-set(PAL_LIBRARY_TYPE STATIC)
-set(WebCore_LIBRARY_TYPE STATIC)
+# Create a shared WebKit
+#
+# Use OBJECT libraries for PAL and WebCore. The size of a libWebCore.a is too much
+# for ranlib.
+set(PAL_LIBRARY_TYPE OBJECT)
+set(WebCore_LIBRARY_TYPE OBJECT)
 set(WebKit_LIBRARY_TYPE SHARED)
 
 # Enable multi process builds for Visual Studio
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 15e72e9..7748dd6 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,14 @@
+2020-04-01  Don Olmstead  <don.olmstead@sony.com>
+
+        [PlayStation] Use OBJECT libraries for WebCore and PAL
+        https://bugs.webkit.org/show_bug.cgi?id=209835
+
+        Reviewed by Ross Kirsling.
+
+        Use the object libraries when compiling TestWebCore.
+
+        * TestWebKitAPI/PlatformPlayStation.cmake:
+
 2020-04-01  Jack Lee  <shihchieh_lee@apple.com>
 
         Unreviewed, add new committer to contributors.json
diff --git a/Tools/TestWebKitAPI/PlatformPlayStation.cmake b/Tools/TestWebKitAPI/PlatformPlayStation.cmake
index 3925e15..1fb5fee 100644
--- a/Tools/TestWebKitAPI/PlatformPlayStation.cmake
+++ b/Tools/TestWebKitAPI/PlatformPlayStation.cmake
@@ -22,6 +22,13 @@
     ${test_main_SOURCES}
 )
 
+# Both PAL and WebCore are built as object libraries. The WebKit:: interface
+# targets are used. A limitation of that is the object files are not propagated
+# so they are added here.
+list(APPEND TestWebCore_PRIVATE_LIBRARIES
+    $<TARGET_OBJECTS:PAL>
+)
+
 # TestWebKit
 if (ENABLE_WEBKIT)
     add_dependencies(TestWebKitAPIBase WebKitFrameworkHeaders)