[GTK] [CMake] Clean up library linking
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Mar 2014 17:11:21 +0000 (17:11 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Mar 2014 17:11:21 +0000 (17:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=129782

Reviewed by Philippe Normand.

.:

* Source/cmake/OptionsGTK.cmake: Add a macro to wrap all libraries in a list with --whole-archive
so that unused symbols are not dropped. This is useful when building up shared libraries
from convenience libraries.

Source/WebCore:

* PlatformGTK.cmake: Some files are duplicated on the source list of two convenience
libraries. Ensure that they are all compiled into WebCore instead of WebCorePlatformGTK.
Some simply need to be moved to WebCore from WebCorePlatformGTK. Don't try to link
WebCorePlatformGTK against WebCore -- convenience libraries should be able to save
their symbol resolution for the final linking step.

Source/WebKit:

* PlatformGTK.cmake: Use the new macro.

Source/WebKit2:

* PlatformGTK.cmake: Use the new macro.

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

ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/PlatformGTK.cmake
Source/WebKit/ChangeLog
Source/WebKit/PlatformGTK.cmake
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/cmake/OptionsGTK.cmake

index f433d2a..3fb6379 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-03-10  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Clean up library linking
+        https://bugs.webkit.org/show_bug.cgi?id=129782
+
+        Reviewed by Philippe Normand.
+
+        * Source/cmake/OptionsGTK.cmake: Add a macro to wrap all libraries in a list with --whole-archive
+        so that unused symbols are not dropped. This is useful when building up shared libraries
+        from convenience libraries.
+
 2014-03-08  Landry Breuil  <landry@openbsd.org>
 
         Don't check for shm_open on librt on OpenBSD, lib doesnt exist.
index 5a6dbc2..01d60d9 100644 (file)
@@ -1,3 +1,16 @@
+2014-03-10  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Clean up library linking
+        https://bugs.webkit.org/show_bug.cgi?id=129782
+
+        Reviewed by Philippe Normand.
+
+        * PlatformGTK.cmake: Some files are duplicated on the source list of two convenience
+        libraries. Ensure that they are all compiled into WebCore instead of WebCorePlatformGTK.
+        Some simply need to be moved to WebCore from WebCorePlatformGTK. Don't try to link
+        WebCorePlatformGTK against WebCore -- convenience libraries should be able to save
+        their symbol resolution for the final linking step.
+
 2014-03-10  Radu Stavila  <stavila@adobe.com>
 
         [CSS Regions] Scrolling regions with the mouse wheel only works properly if hovering over the region's padding
index df431fb..74a4dfa 100644 (file)
@@ -111,6 +111,7 @@ list(APPEND WebCore_SOURCES
     platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp
 
     platform/network/soup/AuthenticationChallengeSoup.cpp
+    platform/network/soup/CertificateInfo.cpp
     platform/network/soup/CookieJarSoup.cpp
     platform/network/soup/CookieStorageSoup.cpp
     platform/network/soup/CredentialStorageSoup.cpp
@@ -137,6 +138,10 @@ list(APPEND WebCore_SOURCES
     platform/text/TextEncodingDetectorICU.cpp
 
     platform/text/enchant/TextCheckerEnchant.cpp
+
+    platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp
+
+    platform/network/gtk/CredentialBackingStore.cpp
 )
 
 list(APPEND WebCorePlatformGTK_SOURCES
@@ -236,37 +241,6 @@ list(APPEND WebCorePlatformGTK_SOURCES
     platform/gtk/WidgetBackingStoreGtkX11.cpp
     platform/gtk/WidgetGtk.cpp
     platform/gtk/WidgetRenderingContext.cpp
-
-    platform/network/gtk/CredentialBackingStore.cpp
-
-    platform/network/soup/AuthenticationChallengeSoup.cpp
-    platform/network/soup/CertificateInfo.cpp
-    platform/network/soup/CookieJarSoup.cpp
-    platform/network/soup/CookieStorageSoup.cpp
-    platform/network/soup/CredentialStorageSoup.cpp
-    platform/network/soup/DNSSoup.cpp
-    platform/network/soup/NetworkStorageSessionSoup.cpp
-    platform/network/soup/ProxyResolverSoup.cpp
-    platform/network/soup/ProxyServerSoup.cpp
-    platform/network/soup/ResourceErrorSoup.cpp
-    platform/network/soup/ResourceHandleSoup.cpp
-    platform/network/soup/ResourceRequestSoup.cpp
-    platform/network/soup/ResourceResponseSoup.cpp
-    platform/network/soup/SocketStreamHandleSoup.cpp
-    platform/network/soup/SynchronousLoaderClientSoup.cpp
-
-    platform/soup/SharedBufferSoup.cpp
-
-    platform/text/icu/UTextProvider.cpp
-    platform/text/icu/UTextProviderLatin1.cpp
-    platform/text/icu/UTextProviderUTF16.cpp
-    platform/text/LocaleICU.cpp
-    platform/text/TextCodecICU.cpp
-    platform/text/TextEncodingDetectorICU.cpp
-
-    platform/text/enchant/TextCheckerEnchant.cpp
-
-    platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp
 )
 
 if (ENABLE_NETSCAPE_PLUGIN_API)
@@ -463,7 +437,6 @@ set_property(
         ${GDK_INCLUDE_DIRS}
 )
 target_link_libraries(WebCorePlatformGTK
-    WebCore
     ${WebCore_LIBRARIES}
     ${GTK_LIBRARIES}
     ${GDK_LIBRARIES}
index 81aa691..9d8bc0f 100644 (file)
@@ -1,3 +1,12 @@
+2014-03-10  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Clean up library linking
+        https://bugs.webkit.org/show_bug.cgi?id=129782
+
+        Reviewed by Philippe Normand.
+
+        * PlatformGTK.cmake: Use the new macro.
+
 2014-03-07  Alex Christensen  <achristensen@webkit.org>
 
         [Win] Unreviewed build fix after r165310.
index f8805d7..da6627c 100644 (file)
@@ -134,9 +134,10 @@ list(APPEND WebKitGTK_INSTALLED_HEADERS
 # Since the GObjectDOMBindings convenience library exports API that is unused except
 # in embedding applications we need to instruct the linker to link all symbols explicitly.
 list(APPEND WebKit_LIBRARIES
-    -Wl,--whole-archive GObjectDOMBindings -Wl,--no-whole-archive
+    GObjectDOMBindings
     WebCorePlatformGTK
 )
+ADD_WHOLE_ARCHIVE_TO_LIBRARIES(WebKit_LIBRARIES)
 
 set(WebKit_MARSHAL_LIST ${WEBKIT_DIR}/gtk/webkitmarshal.list)
 
index 19a8654..2841b49 100644 (file)
@@ -1,3 +1,12 @@
+2014-03-10  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Clean up library linking
+        https://bugs.webkit.org/show_bug.cgi?id=129782
+
+        Reviewed by Philippe Normand.
+
+        * PlatformGTK.cmake: Use the new macro.
+
 2014-03-10  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] The web process can finish while a print operation is still ongoing
index cd3ee91..1784e45 100644 (file)
@@ -453,9 +453,10 @@ set(SharedWebKit2Libraries
 # Since the GObjectDOMBindings convenience library exports API that is unused except
 # in embedding applications we need to instruct the linker to link all symbols explicitly.
 list(APPEND WebKit2_LIBRARIES
-    -Wl,--whole-archive GObjectDOMBindings -Wl,--no-whole-archive
+    GObjectDOMBindings
     WebCorePlatformGTK
 )
+ADD_WHOLE_ARCHIVE_TO_LIBRARIES(WebKit2_LIBRARIES)
 
 set(WebKit2_MARSHAL_LIST ${WEBKIT2_DIR}/UIProcess/API/gtk/webkit2marshal.list)
 add_custom_command(
@@ -650,11 +651,12 @@ if (ENABLE_PLUGIN_PROCESS)
             ${GDK2_INCLUDE_DIRS}
     )
 
-    target_link_libraries(WebKitPluginProcess
+    set(WebKitPluginProcess_LIBRARIES
         ${SharedWebKit2Libraries}
         WebCorePlatformGTK2
-        WebCore
     )
+    ADD_WHOLE_ARCHIVE_TO_LIBRARIES(WebKitPluginProcess_LIBRARIES)
+    target_link_libraries(WebKitPluginProcess ${WebKitPluginProcess_LIBRARIES})
 
     add_dependencies(WebKitPluginProcess WebKit2)
 
index c7aa153..4d80135 100644 (file)
@@ -282,3 +282,14 @@ macro(ADD_TYPELIB typelib)
     list(APPEND GObjectIntrospectionTargets ${target_name}-gir)
     set(GObjectIntrospectionTargets ${GObjectIntrospectionTargets} PARENT_SCOPE)
 endmacro()
+
+# CMake does not automatically add --whole-archive when building shared objects from
+# a list of convenience libraries. This can lead to missing symbols in the final output.
+# We add --whole-archive to all libraries manually to prevent the linker from trimming
+# symbols that we actually need later.
+macro(ADD_WHOLE_ARCHIVE_TO_LIBRARIES _list_name)
+    foreach (library IN LISTS ${_list_name})
+      list(APPEND ${_list_name}_TMP -Wl,--whole-archive ${library} -Wl,--no-whole-archive)
+    endforeach ()
+    set(${_list_name} "${${_list_name}_TMP}")
+endmacro()