[GTK] OSX linker doesn't understand --whole-archive
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Oct 2015 00:37:48 +0000 (00:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Oct 2015 00:37:48 +0000 (00:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144557

Patch by Philip Chimento <philip.chimento@gmail.com> on 2015-10-12
Reviewed by Martin Robinson.

.:

* Source/cmake/OptionsGTK.cmake: Turn the macro
ADD_WHOLE_ARCHIVE_TO_LIBRARIES into a no-op on Darwin systems,
because XCode's linker doesn't have the --whole-archive option.

Source/WebKit2:

* PlatformGTK.cmake: Link with extra libraries on Darwin, since
we don't have the --whole-archive linker option.

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

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

index 83dd484..1a9b89b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2015-10-12  Philip Chimento  <philip.chimento@gmail.com>
 
+        [GTK] OSX linker doesn't understand --whole-archive
+        https://bugs.webkit.org/show_bug.cgi?id=144557
+
+        Reviewed by Martin Robinson.
+
+        * Source/cmake/OptionsGTK.cmake: Turn the macro
+        ADD_WHOLE_ARCHIVE_TO_LIBRARIES into a no-op on Darwin systems,
+        because XCode's linker doesn't have the --whole-archive option.
+
+2015-10-12  Philip Chimento  <philip.chimento@gmail.com>
+
         [GTK] Use --version-script only on Linux
         https://bugs.webkit.org/show_bug.cgi?id=144555
 
index 52c51bf..8795a3b 100644 (file)
@@ -1,3 +1,13 @@
+2015-10-12  Philip Chimento  <philip.chimento@gmail.com>
+
+        [GTK] OSX linker doesn't understand --whole-archive
+        https://bugs.webkit.org/show_bug.cgi?id=144557
+
+        Reviewed by Martin Robinson.
+
+        * PlatformGTK.cmake: Link with extra libraries on Darwin, since
+        we don't have the --whole-archive linker option.
+
 2015-10-09  Anders Carlsson  <andersca@apple.com>
 
         Don't allow plug-ins to override image types for <embed> elements
index 4c2b1d8..48f00ad 100644 (file)
@@ -923,11 +923,18 @@ add_custom_command(
         ${WEBKIT2_DIR}/UIProcess/API/gtk/*.cpp
 )
 
+# Manually add some libraries on OSX because we don't have the --whole-archive flag
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+    set(INTROSPECTION_ADDITIONAL_LIBRARIES --library=c++)
+    set(INTROSPECTION_ADDITIONAL_LDFLAGS -lGObjectDOMBindings)
+endif ()
+
 add_custom_command(
     OUTPUT ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.gir
     DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
     DEPENDS ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir
-    COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations LDFLAGS=
+    COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations
+        LDFLAGS="${INTROSPECTION_ADDITIONAL_LDFLAGS}"
         LD_LIBRARY_PATH="${INTROSPECTION_ADDITIONAL_LIBRARY_PATH}"
         ${INTROSPECTION_SCANNER}
         --quiet
@@ -942,6 +949,7 @@ add_custom_command(
         --include-uninstalled=${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
         --library=webkit2gtk-${WEBKITGTK_API_VERSION}
         --library=javascriptcoregtk-${WEBKITGTK_API_VERSION}
+        ${INTROSPECTION_ADDITIONAL_LIBRARIES}
         -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
         ${INTROSPECTION_ADDITIONAL_LINKER_FLAGS}
         --no-libtool
index 32aa62f..bb81d32 100644 (file)
@@ -471,12 +471,15 @@ 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.
+# symbols that we actually need later. (--whole-archive isn't an option on XCode's
+# linker, though.)
 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}")
+    if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
+        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}")
+    endif ()
 endmacro()
 
 if (CMAKE_MAJOR_VERSION LESS 3)