Skip to content
Permalink
Browse files

8246357: Allow static build of webkit library on linux

Reviewed-by: kcr, ajoseph
  • Loading branch information
Johan Vos
Johan Vos committed Jun 9, 2020
1 parent a02e09d commit ba501ef29fefbe44d7a0972b607b964b34e62242
@@ -3430,6 +3430,9 @@ project(":web") {
exec {
workingDir("$webkitOutputDir")
def cmakeArgs = "-DENABLE_TOOLS=1"
if (IS_STATIC_BUILD) {
cmakeArgs = " $cmakeArgs -DSTATIC_BUILD=1 -DUSE_THIN_ARCHIVES=OFF";
}
cmakeArgs = " $cmakeArgs -DCMAKE_C_COMPILER='${webkitProperties.compiler}'"
if (t.name == "win") {
// To enable ninja build on Windows
@@ -3446,6 +3449,9 @@ project(":web") {
// TODO: Use cflags and ldflags from all platforms
def cFlags = webkitProperties.ccFlags?.join(' ') ?: ''
def lFlags = webkitProperties.linkFlags?.join(' ') ?: ''
if (IS_STATIC_BUILD) {
cFlags = " $cFlags -DSTATIC_BUILD=1";
}
// -shared flag should be omitted while creating executable.
def exeFlags = webkitProperties.linkFlags?.join(' ')?.replace('-shared', '') ?: ''
cmakeArgs = "$cmakeArgs -DCMAKE_C_FLAGS='${cFlags}' -DCMAKE_CXX_FLAGS='${cFlags}'"
@@ -146,8 +146,13 @@ set(WTF_LIBRARY_TYPE STATIC)
set(JavaScriptCore_LIBRARY_TYPE STATIC)
set(PAL_LIBRARY_TYPE STATIC)
set(WebCore_LIBRARY_TYPE STATIC)
set(WebKitLegacy_LIBRARY_TYPE SHARED)
set(WebKit_LIBRARY_TYPE SHARED)
if (DEFINED STATIC_BUILD)
set(WebKitLegacy_LIBRARY_TYPE STATIC)
set(WebKit_LIBRARY_TYPE STATIC)
else ()
set(WebKitLegacy_LIBRARY_TYPE SHARED)
set(WebKit_LIBRARY_TYPE SHARED)
endif ()
set(WebCoreTestSupport_LIBRARY_TYPE STATIC)

set(CMAKE_POSITION_INDEPENDENT_CODE True)
@@ -111,7 +111,11 @@ extern "C" {
#if PLATFORM(JAVA_WIN) && !defined(NDEBUG)
#include <crtdbg.h>
#endif
#ifdef STATIC_BUILD
JNIEXPORT jint JNICALL JNI_OnLoad_jfxwebkit(JavaVM* vm, void*)
#else
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*)
#endif
{
#if PLATFORM(JAVA_WIN) && !defined(NDEBUG)
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
@@ -8,5 +8,7 @@ if (ENABLE_API_TESTS)
endif ()

if (PORT STREQUAL "Java")
add_subdirectory(DumpRenderTree/java)
if (NOT DEFINED STATIC_BUILD)
add_subdirectory(DumpRenderTree/java)
endif ()
endif ()

0 comments on commit ba501ef

Please sign in to comment.
You can’t perform that action at this time.