Skip to content

Commit

Permalink
8246357: Allow static build of webkit library on linux
Browse files Browse the repository at this point in the history
Reviewed-by: kcr, ajoseph
  • Loading branch information
Johan Vos committed Jun 9, 2020
1 parent a02e09d commit ba501ef
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
6 changes: 6 additions & 0 deletions build.gradle
Expand Up @@ -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
Expand All @@ -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}'"
Expand Down
9 changes: 7 additions & 2 deletions modules/javafx.web/src/main/native/CMakeLists.txt
Expand Up @@ -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)
Expand Down
Expand Up @@ -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 );
Expand Down
4 changes: 3 additions & 1 deletion modules/javafx.web/src/main/native/Tools/CMakeLists.txt
Expand Up @@ -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.