[Qt][Win] Fix broken QtWebKit5.lib linking
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 13:43:13 +0000 (13:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 13:43:13 +0000 (13:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88321

Patch by Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>  Joel Dillon <joel.dillon@codethink.co.uk> on 2012-07-03
Reviewed by Kenneth Rohde Christiansen.

Source/JavaScriptCore:

The goal is to have different ports build systems define STATICALLY_LINKED_WITH_WTF
when building JavaScriptCore, if both are packaged in the same DLL, instead
of relying on the code to handle this.
The effects of BUILDING_* and STATICALLY_LINKED_WITH_* are currently the same
except for a check in Source/JavaScriptCore/config.h.

Keeping the old way for the WX port as requested by the port's contributors.
For non-Windows ports there is no difference between IMPORT and EXPORT, no
change is needed.

* API/JSBase.h:
  JS symbols shouldn't be included by WTF objects anymore. Remove the export when BUILDING_WTF.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
  Make sure that JavaScriptCore uses import symbols of WTF for the Win port.
* runtime/JSExportMacros.h:

Source/WebCore:

* platform/PlatformExportMacros.h:

Source/WTF:

Instead of letting a module's headers know which other modules depend on them,
have depending modules define explicitely that they want its symbols exported too.

JavaScriptCore should then be compiled with both BUILDING_JavaScriptCore and
STATICALLY_LINKED_WITH_WTF.

* wtf/ExportMacros.h:

Tools:

On windows the import/export definition is part of the symbol's signature.
Define STATICALLY_LINKED_WITH_$$library for each dependend module
that is being linked statically to make sure that they can be linked together
later on.

Also do not compile Assertions.cpp in DumpRenderTree anymore since all the
used symbols are exported and it would cause a duplicate symbols error.

* DumpRenderTree/qt/DumpRenderTree.pro:
* qmake/mkspecs/features/default_post.prf:

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

Source/JavaScriptCore/API/JSBase.h
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
Source/JavaScriptCore/runtime/JSExportMacros.h
Source/WTF/ChangeLog
Source/WTF/wtf/ExportMacros.h
Source/WebCore/ChangeLog
Source/WebCore/platform/PlatformExportMacros.h
Tools/ChangeLog
Tools/DumpRenderTree/qt/DumpRenderTree.pro
Tools/qmake/mkspecs/features/default_post.prf

index fed54fe..f46a417 100644 (file)
@@ -71,7 +71,7 @@ typedef struct OpaqueJSValue* JSObjectRef;
 #elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__)
 #define JS_EXPORT __attribute__((visibility("default")))
 #elif defined(WIN32) || defined(_WIN32) || defined(_WIN32_WCE) || defined(__CC_ARM) || defined(__ARMCC__)
-#if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF)
+#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore)
 #define JS_EXPORT __declspec(dllexport)
 #else
 #define JS_EXPORT __declspec(dllimport)
index 2ad874d..aca076a 100644 (file)
@@ -1,3 +1,26 @@
+2012-07-03  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>  Joel Dillon <joel.dillon@codethink.co.uk>
+
+        [Qt][Win] Fix broken QtWebKit5.lib linking
+        https://bugs.webkit.org/show_bug.cgi?id=88321
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        The goal is to have different ports build systems define STATICALLY_LINKED_WITH_WTF
+        when building JavaScriptCore, if both are packaged in the same DLL, instead
+        of relying on the code to handle this.
+        The effects of BUILDING_* and STATICALLY_LINKED_WITH_* are currently the same
+        except for a check in Source/JavaScriptCore/config.h.
+
+        Keeping the old way for the WX port as requested by the port's contributors.
+        For non-Windows ports there is no difference between IMPORT and EXPORT, no
+        change is needed.
+
+        * API/JSBase.h:
+          JS symbols shouldn't be included by WTF objects anymore. Remove the export when BUILDING_WTF.
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+          Make sure that JavaScriptCore uses import symbols of WTF for the Win port.
+        * runtime/JSExportMacros.h:
+
 2012-07-02  Filip Pizlo  <fpizlo@apple.com>
 
         DFG OSR exit value recoveries should be computed lazily
index df0724e..7d2461d 100644 (file)
@@ -7,7 +7,7 @@
        <Tool
                Name="VCCLCompilerTool"
                AdditionalIncludeDirectories="&quot;$(ConfigurationBuildDir)\obj\JavaScriptCore\DerivedSources\&quot;;../../;../../API/;../../parser/;../../bytecompiler/;../../dfg/;../../disassembler;../../jit/;../../llint/;../../runtime/;../../tools/;../../bytecode/;../../interpreter/;../../wtf/;../../profiler;../../assembler/;../../debugger/;../../heap/;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(ConfigurationBuildDir)\include&quot;;&quot;$(ConfigurationBuildDir)\include\JavaScriptCore&quot;;&quot;$(ConfigurationBuildDir)\include\private&quot;;&quot;$(ConfigurationBuildDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;"
-               PreprocessorDefinitions="__STD_C"
+               PreprocessorDefinitions="STATICALLY_LINKED_WITH_WTF;__STD_C"
                ForcedIncludeFiles="ICUVersion.h"
        />
        <Tool
index 884805f..19e2c28 100644 (file)
@@ -36,7 +36,7 @@
 // See note in wtf/Platform.h for more info on EXPORT_MACROS.
 #if USE(EXPORT_MACROS)
 
-#if defined(BUILDING_JavaScriptCore)
+#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore)
 #define JS_EXPORT_PRIVATE WTF_EXPORT
 #else
 #define JS_EXPORT_PRIVATE WTF_IMPORT
@@ -50,7 +50,7 @@
 
 #if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
 
-#if defined(BUILDING_JavaScriptCore)
+#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore)
 #define JS_EXPORTDATA __declspec(dllexport)
 #else
 #define JS_EXPORTDATA __declspec(dllimport)
index 09e5a77..54666fa 100644 (file)
@@ -1,3 +1,18 @@
+2012-07-03  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>  Joel Dillon <joel.dillon@codethink.co.uk>
+
+        [Qt][Win] Fix broken QtWebKit5.lib linking
+        https://bugs.webkit.org/show_bug.cgi?id=88321
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Instead of letting a module's headers know which other modules depend on them,
+        have depending modules define explicitely that they want its symbols exported too.
+
+        JavaScriptCore should then be compiled with both BUILDING_JavaScriptCore and
+        STATICALLY_LINKED_WITH_WTF.
+
+        * wtf/ExportMacros.h:
+
 2012-06-29  Tony Chang  <tony@chromium.org>
 
         Unreviewed, rolling out r121572.
index efa0c8f..36d7f48 100644 (file)
 #define WTF_HIDDEN
 #endif
 
-// Currently WTF is embedded statically in JSCore, which exports 
-// WTF symbols in the JSCore shared library.
-// Because of this, we need to make sure that we use WTF_EXPORT
-// when building JavaScriptCore as well as WTF.
-
 // FIXME: When all ports are using the export macros, we should replace
 // WTF_EXPORTDATA with WTF_EXPORT_PRIVATE macros.
-#if defined(BUILDING_WTF)  || defined(BUILDING_JavaScriptCore)
+#if defined(BUILDING_WTF) || defined(STATICALLY_LINKED_WITH_WTF) || (PLATFORM(WX) && defined(BUILDING_JavaScriptCore))
 #define WTF_EXPORTDATA WTF_EXPORT
 #else
 #define WTF_EXPORTDATA WTF_IMPORT
@@ -81,7 +76,7 @@
 #else // !USE(EXPORT_MACROS)
 
 #if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !COMPILER(GCC)
-#if defined(BUILDING_WTF) || defined(BUILDING_JavaScriptCore)
+#if defined(BUILDING_WTF) || defined(STATICALLY_LINKED_WITH_WTF)
 #define WTF_EXPORTDATA __declspec(dllexport)
 #else
 #define WTF_EXPORTDATA __declspec(dllimport)
@@ -98,7 +93,7 @@
 
 #endif // USE(EXPORT_MACROS)
 
-#if defined(BUILDING_WTF)  || defined(BUILDING_JavaScriptCore)
+#if defined(BUILDING_WTF) || defined(STATICALLY_LINKED_WITH_WTF) || (PLATFORM(WX) && defined(BUILDING_JavaScriptCore))
 #define WTF_EXPORT_PRIVATE WTF_EXPORT
 #else
 #define WTF_EXPORT_PRIVATE WTF_IMPORT
index d2dbbe4..e0bb9aa 100644 (file)
@@ -1,3 +1,12 @@
+2012-07-03  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>  Joel Dillon <joel.dillon@codethink.co.uk>
+
+        [Qt][Win] Fix broken QtWebKit5.lib linking
+        https://bugs.webkit.org/show_bug.cgi?id=88321
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * platform/PlatformExportMacros.h:
+
 2012-07-03  Philip Rogers  <pdr@google.com>
 
         Fix text positioning with non-bmp characters.
index 6c70813..ae3e30a 100644 (file)
@@ -35,7 +35,8 @@
 // See note in wtf/Platform.h for more info on EXPORT_MACROS.
 #if USE(EXPORT_MACROS)
 
-#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit)
+#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit) || \
+    defined(STATICALLY_LINKED_WITH_WebCore) || defined(STATICALLY_LINKED_WITH_WebKit)
 #define WEBKIT_EXPORTDATA WTF_EXPORT
 #else
 #define WEBKIT_EXPORTDATA WTF_IMPORT
@@ -45,7 +46,8 @@
 
 #if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC)
 
-#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit)
+#if defined(BUILDING_WebCore) || defined(BUILDING_WebKit) || \
+    defined(STATICALLY_LINKED_WITH_WebCore) || defined(STATICALLY_LINKED_WITH_WebKit)
 #define WEBKIT_EXPORTDATA __declspec(dllexport)
 #else
 #define WEBKIT_EXPORTDATA __declspec(dllimport)
index 5c782b0..a90ae32 100644 (file)
@@ -1,3 +1,21 @@
+2012-07-03  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>  Joel Dillon <joel.dillon@codethink.co.uk>
+
+        [Qt][Win] Fix broken QtWebKit5.lib linking
+        https://bugs.webkit.org/show_bug.cgi?id=88321
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        On windows the import/export definition is part of the symbol's signature.
+        Define STATICALLY_LINKED_WITH_$$library for each dependend module
+        that is being linked statically to make sure that they can be linked together
+        later on.
+
+        Also do not compile Assertions.cpp in DumpRenderTree anymore since all the
+        used symbols are exported and it would cause a duplicate symbols error.
+
+        * DumpRenderTree/qt/DumpRenderTree.pro:
+        * qmake/mkspecs/features/default_post.prf:
+
 2012-07-03  Szilard Ledan  <szledan@inf.u-szeged.hu>
 
         master.cfg cleanup, pass BuildStep instances instead of BuildStep subclasses
index 53a8c01..327dc3a 100644 (file)
@@ -37,7 +37,6 @@ HEADERS += \
     testplugin.h
 
 SOURCES += \
-    $${ROOT_WEBKIT_DIR}/Source/WTF/wtf/Assertions.cpp \
     $$PWD/../WorkQueue.cpp \
     DumpRenderTreeQt.cpp \
     EventSenderQt.cpp \
index dec4a6d..56c109c 100644 (file)
@@ -212,6 +212,12 @@ for(library, WEBKIT) {
         LIBS += $$dependent_libs
     }
 
+    # Anything not linking dynamically to QtWebKit should make sure to have its export
+    # macros syncrhonized with the code that it will be linked with statically.
+    !contains(QT, webkit) {
+        DEFINES += STATICALLY_LINKED_WITH_$$library
+    }
+
     LIBS = $$existing_libs $$LIBS
 }