Skip to content

Commit

Permalink
Merge 165378 - [GTK] [CMake] Clean up library linking
Browse files Browse the repository at this point in the history
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.


Conflicts:
	ChangeLog
	Source/WebCore/ChangeLog
	Source/WebKit/ChangeLog
	Source/WebKit2/ChangeLog
  • Loading branch information
kov committed May 13, 2014
1 parent 344370e commit 19a07a6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 35 deletions.
36 changes: 5 additions & 31 deletions Source/WebCore/PlatformGTK.cmake
Expand Up @@ -112,6 +112,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
Expand All @@ -138,6 +139,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
Expand Down Expand Up @@ -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 (WTF_USE_GEOCLUE2)
Expand Down
3 changes: 2 additions & 1 deletion Source/WebKit/PlatformGTK.cmake
Expand Up @@ -135,9 +135,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)

Expand Down
8 changes: 5 additions & 3 deletions Source/WebKit2/PlatformGTK.cmake
Expand Up @@ -447,9 +447,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(
Expand Down Expand Up @@ -644,11 +645,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)

Expand Down
11 changes: 11 additions & 0 deletions Source/cmake/OptionsGTK.cmake
Expand Up @@ -287,3 +287,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()

0 comments on commit 19a07a6

Please sign in to comment.