Subject: [bug#41360] [PATCH v4 09/12] gnu: java-openjfx-build: Fix web component linkage.

From: Alexey Abramov <[email-masked]>
Date: Sun, 7 Jun 2020 17:55:15 +0200

* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/java.scm (java-openjfx-build)[source]: Use it.
* gnu/packages/patches/java-openjfx-build-web-WebKitCompilerFlags.cmake.patch:
  New file.

Signed-off-by: Alexey Abramov <[email-masked]>
---
 gnu/local.mk                                  |  1 +
 gnu/packages/java.scm                         |  1 +
 ...-build-web-WebKitCompilerFlags.cmake.patch | 36 +++++++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-WebKitCompilerFlags.cmake.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index d36636fd81..85f8db7150 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1113,6 +1113,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/java-openjfx-build-web-DumpRenderTree-java.patch	\
   %D%/packages/patches/java-openjfx-build-web-OptionsJava.cmake.patch	\
   %D%/packages/patches/java-openjfx-build-web-WTF.patch			\
+  %D%/packages/patches/java-openjfx-build-web-WebKitCompilerFlags.cmake.patch	\
   %D%/packages/patches/java-powermock-fix-java-files.patch		\
   %D%/packages/patches/java-simple-xml-fix-tests.patch		\
   %D%/packages/patches/java-svg-salamander-Fix-non-det.patch	\
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index cf6135e926..5da1476077 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2506,6 +2506,7 @@ new Date();"))
                                        "java-openjfx-build-web-DumpRenderTree-java.patch"
                                        "java-openjfx-build-web-OptionsJava.cmake.patch"
                                        "java-openjfx-build-web-WTF.patch"
+                                       "java-openjfx-build-web-WebKitCompilerFlags.cmake.patch"
                                        ))))
     (build-system ant-build-system)
     (arguments
diff --git a/gnu/packages/patches/java-openjfx-build-web-WebKitCompilerFlags.cmake.patch b/gnu/packages/patches/java-openjfx-build-web-WebKitCompilerFlags.cmake.patch
new file mode 100644
index 0000000000..d0bbb7e3b2
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-WebKitCompilerFlags.cmake.patch
@@ -0,0 +1,36 @@
+Subject: [PATCH] Fix WebKit linkage.
+
+Somehow the whole linkage fails because of the TestRunner's undefined
+references. However, I see the very same fixes in openjfx8-devel FreeBSD port,
+even though they use gradle to build it.
+
+CMakeFiles/DumpRenderTreeJava.dir/__/TestRunner.cpp.o:TestRunner.cpp:function TestRunner::runUIScript(OpaqueJSContext const*, OpaqueJSString*, OpaqueJSValue const*): error: undefined reference to 'WTF::String::String(unsigned short const*, unsigned int)'
+CMakeFiles/DumpRenderTreeJava.dir/__/__/TestRunnerShared/UIScriptContext/UIScriptContext.cpp.o:UIScriptContext.cpp:function WTR::UIScriptContext::tryToCompleteUIScriptForCurrentParentCallback(): error: undefined reference to 'WTF::String::String(unsigned short const*, unsigned int)'
+
+Some related bugs/commits are:
+https://github.com/WebKit/webkit/commit/1e46377e47674363131299d54c8557734a99fb5f
+https://bugs.webkit.org/show_bug.cgi?id=199625#c24
+https://bugs.webkit.org/show_bug.cgi?id=200074
+
+---
+ .../src/main/native/Source/cmake/WebKitCompilerFlags.cmake   | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/modules/web/src/main/native/Source/cmake/WebKitCompilerFlags.cmake b/modules/web/src/main/native/Source/cmake/WebKitCompilerFlags.cmake
+index 5bcf047..4526ee6 100644
+--- a/modules/web/src/main/native/Source/cmake/WebKitCompilerFlags.cmake
++++ b/modules/web/src/main/native/Source/cmake/WebKitCompilerFlags.cmake
+@@ -176,11 +176,6 @@ if (NOT MSVC)
+     string(REGEX MATCHALL "-fsanitize=[^ ]*" ENABLED_COMPILER_SANITIZERS ${CMAKE_CXX_FLAGS})
+ endif ()
+
+-if (UNIX AND NOT APPLE AND NOT ENABLED_COMPILER_SANITIZERS)
+-    set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
+-endif ()
+-
+-
+ # CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS only matters with GCC >= 4.7.0.  Since this
+ # version, -P does not output empty lines, which currently breaks make_names.pl in
+ # WebCore. Investigating whether make_names.pl should be changed instead is left as an exercise to
+--
+2.26.2
-- 
2.26.2