[webkit-qt] library linkage

Simon Hausmann simon.hausmann at nokia.com
Thu Jan 28 07:53:31 PST 2010


Hi,

we used to build JavaScriptCore as a static library and then link it into 
QtWebKit and JSC. We had to stop doing that because with qmake that static 
linkage propagated to the applications, causing them who link against QtWebKit 
to also try to link against the static library.

With Qt 4.6.0 this was fixed in qmake through the introduction of the 
PRIVATE_LIBS variable, which can be used to link libraries that should not be 
visible to the libs/apps that link against the library that is being created.

I've done a quick prototype hack to verify that this works, and indeed it does 
(patch attached).

Nowadays there are a few arguments in favour of separating the two again, one 
of them being for example the option of applying different optimization flags 
for JavaScriptCore than for the rest.


If anyone feels tempted to mess a bit with the build system, please feel free 
to pick up this task :). I'd be happy to help with the review.


Simon
-------------- next part --------------
diff --git a/JavaScriptCore/JavaScriptCore.pri b/JavaScriptCore/JavaScriptCore.pri
index 75737ae..d9039bc 100644
--- a/JavaScriptCore/JavaScriptCore.pri
+++ b/JavaScriptCore/JavaScriptCore.pri
@@ -40,6 +40,10 @@ INCLUDEPATH = \
     $$JSC_GENERATED_SOURCES_DIR \
     $$INCLUDEPATH
 
+linux-*: DEFINES += HAVE_STDINT_H
+freebsd-*: DEFINES += HAVE_PTHREAD_NP_H
+win32-*: DEFINES += _HAS_TR1=0
+
 DEFINES += BUILDING_QT__ BUILDING_JavaScriptCore BUILDING_WTF
 
 win32-* {
diff --git a/JavaScriptCore/JavaScriptCore.pro b/JavaScriptCore/JavaScriptCore.pro
index 0d6becb..fe3a58e 100644
--- a/JavaScriptCore/JavaScriptCore.pro
+++ b/JavaScriptCore/JavaScriptCore.pro
@@ -10,40 +10,18 @@ CONFIG += depend_includepath
 
 contains(QT_CONFIG, embedded):CONFIG += embedded
 
-CONFIG(QTDIR_build) {
-    GENERATED_SOURCES_DIR = $$PWD/generated
-    OLDDESTDIR = $$DESTDIR
-    include($$QT_SOURCE_TREE/src/qbase.pri)
-    INSTALLS =
-    DESTDIR = $$OLDDESTDIR
-    DEFINES *= NDEBUG
-}
-
-isEmpty(GENERATED_SOURCES_DIR):GENERATED_SOURCES_DIR = tmp
-GENERATED_SOURCES_DIR_SLASH = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}
-
-INCLUDEPATH += $$GENERATED_SOURCES_DIR
-
 !CONFIG(QTDIR_build) {
-    CONFIG(debug, debug|release) {
-        OBJECTS_DIR = obj/debug
-    } else { # Release
-        OBJECTS_DIR = obj/release
-    }
+    DESTDIR = $$OUTPUT_DIR/lib
+    !static: DEFINES += QT_MAKEDLL
 }
 
-CONFIG(release):!CONFIG(QTDIR_build) {
+CONFIG(release):!CONFIG(standalone_package) {
     contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
     unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
 }
 
-linux-*: DEFINES += HAVE_STDINT_H
-freebsd-*: DEFINES += HAVE_PTHREAD_NP_H
-
 DEFINES += BUILD_WEBKIT
 
-win32-*: DEFINES += _HAS_TR1=0
-
 # Pick up 3rdparty libraries from INCLUDE/LIB just like with MSVC
 win32-g++ {
     TMPPATH            = $$quote($$(INCLUDE))
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 7f630ed..52eaaf7 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -84,9 +84,6 @@ CONFIG(release):!CONFIG(standalone_package) {
     unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
 }
 
-linux-*: DEFINES += HAVE_STDINT_H
-freebsd-*: DEFINES += HAVE_PTHREAD_NP_H
-
 DEFINES += BUILD_WEBKIT
 
 # Remove whole program optimizations due to miscompilations
@@ -95,7 +92,6 @@ win32-msvc2005|win32-msvc2008:{
     QMAKE_CXXFLAGS_RELEASE -= -GL
 }
 
-win32-*: DEFINES += _HAS_TR1=0
 wince* {
 #    DEFINES += ENABLE_SVG=0 ENABLE_XPATH=0 ENABLE_XBL=0 \
 #               ENABLE_SVG_ANIMATION=0 ENABLE_SVG_USE=0  \
@@ -125,7 +121,32 @@ RESOURCES += \
     RESOURCES += $$PWD/../WebCore/inspector/front-end/WebKit.qrc
 }
 
-include($$PWD/../JavaScriptCore/JavaScriptCore.pri)
+JSPATH = ../JavaScriptCore
+
+INCLUDEPATH = \
+    $$JSPATH \
+    $$JSPATH/.. \
+    $$JSPATH/assembler \
+    $$JSPATH/bytecode \
+    $$JSPATH/bytecompiler \
+    $$JSPATH/debugger \
+    $$JSPATH/interpreter \
+    $$JSPATH/jit \
+    $$JSPATH/parser \
+    $$JSPATH/pcre \
+    $$JSPATH/profiler \
+    $$JSPATH/runtime \
+    $$JSPATH/wrec \
+    $$JSPATH/wtf \
+    $$JSPATH/wtf/unicode \
+    $$JSPATH/yarr \
+    $$JSPATH/API \
+    $$JSPATH/ForwardingHeaders \
+    $$JSPATH/generated \
+    $$INCLUDEPATH
+
+QMAKE_LIBDIR = $$OUTPUT_DIR/lib $$QMAKE_LIBDIR
+LIBS_PRIVATE += -lJavaScriptCore
 
 # Disable HTML5 media compilation if phonon is unavailable
 !contains(DEFINES, ENABLE_VIDEO=1) {
diff --git a/WebKit.pro b/WebKit.pro
index f63eaa0..096b6ac 100644
--- a/WebKit.pro
+++ b/WebKit.pro
@@ -4,6 +4,7 @@ CONFIG += ordered
 include(WebKit.pri)
 
 SUBDIRS += \
+        JavaScriptCore \
         WebCore \
         WebKitTools/QtLauncher \
         WebKit/qt/QGVLauncher
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20100128/9f3b5c8d/attachment.bin>


More information about the webkit-qt mailing list