From a918ff2da644b33d51225b7442e2746f2b1da4e0 Mon Sep 17 00:00:00 2001
From: Ioannis Kappas <ioannis.kappas@gmamil.com>
Date: Sat, 25 Jun 2022 22:55:43 +0100
Subject: [PATCH v6 6/6] New java-openjfx-web package

Installs native libs to lib/openjfx
---
 gnu/local.mk                                  |   7 +
 gnu/packages/java.scm                         | 242 +++++++++++++++++-
 ...penjfx-build-web-DumpRenderTree-java.patch |  30 +++
 ...-openjfx-build-web-OptionsJava.cmake.patch |  32 +++
 .../patches/java-openjfx-build-web-WTF.patch  |  33 +++
 ...-build-web-WebKitCompilerFlags.cmake.patch |  36 +++
 .../patches/java-openjfx-build-web-icu.patch  |  38 +++
 .../java-openjfx-build-web-js-test.patch      |  18 ++
 .../java-openjfx-build-web-xlocale.h.patch    |  52 ++++
 9 files changed, 487 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-DumpRenderTree-java.patch
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-OptionsJava.cmake.patch
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-WTF.patch
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-WebKitCompilerFlags.cmake.patch
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-icu.patch
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-js-test.patch
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-xlocale.h.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index fd3b992f33..29c3f750aa 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1321,6 +1321,13 @@ dist_patch_DATA =						\
   %D%/packages/patches/java-jeromq-fix-tests.patch		\
   %D%/packages/patches/java-openjfx-build-jdk_version.patch     \
   %D%/packages/patches/java-openjfx-build-swing-JFXPanel-JDK8.patch     \
+  %D%/packages/patches/java-openjfx-build-web-xlocale.h.patch   \
+  %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-openjfx-build-web-icu.patch			\
+  %D%/packages/patches/java-openjfx-build-web-js-test.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 a5c6c687b1..f7ca88f990 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -60,11 +60,13 @@ (define-module (gnu packages java)
   #:use-module (gnu packages cpio)
   #:use-module (gnu packages cups)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
+  #:use-module (gnu packages gperf)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages ghostscript) ;lcms
@@ -88,11 +90,14 @@ (define-module (gnu packages java)
   #:use-module (gnu packages wget)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages popt)
   #:use-module (gnu packages kerberos)
+  #:use-module (gnu packages ruby)
   #:use-module (gnu packages security-token)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages sqlite)
   #:use-module (gnu packages texinfo)
   #:use-module ((srfi srfi-1) #:select (fold alist-delete))
   #:use-module (srfi srfi-11)
@@ -2521,12 +2526,21 @@ (define-public java-openjfx-build
                   ;; Delete included gradle jar
                   (delete-file-recursively "gradle/wrapper")
                   ;; Delete third party source code
+                  (delete-file-recursively "modules/web/src/main/native/Source/ThirdParty")
+                  (delete-file-recursively "modules/web/src/main/native/Source/PlatformJava.cmake")
                   (delete-file-recursively "modules/graphics/src/main/native-iio/libjpeg")))
               (sha256
                (base32
                 "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
               (patches (search-patches "java-openjfx-build-jdk_version.patch"
-                                       "java-openjfx-build-swing-JFXPanel-JDK8.patch"))))
+                                       "java-openjfx-build-swing-JFXPanel-JDK8.patch"
+                                       "java-openjfx-build-web-xlocale.h.patch"
+                                       "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"
+                                       "java-openjfx-build-web-icu.patch"
+                                       "java-openjfx-build-web-js-test.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
@@ -3589,6 +3603,232 @@ (define-public java-openjfx-controls
 applications.  This package contains UI control classes for the
 OpenJFX distribution.")))
 
+(define-public java-openjfx-web
+  (package (inherit java-openjfx-build)
+    (name "java-openjfx-web")
+    (arguments
+     `(#:jar-name "java-openjfx-web.jar"
+       #:source-dir (string-join '("modules/web/src/main/java"
+                                   "modules/web/src/main/native/Source/WebCore/bindings/java/dom3")
+                                 ";")
+       #:test-dir "modules/web/src/test"
+       #:test-include (list "**/*Test.*")
+       #:modules ((ice-9 match)
+                  (ice-9 regex)
+                  (guix build ant-build-system)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; add native libs path to the java.library.path property. Used
+             ;; by the openjfx NativeLibLoader at runtime to locate its
+             ;; libraries.
+             (let ((lib (string-append (assoc-ref outputs "out")
+                                       "/lib/openjfx")))
+               (substitute* "modules/web/src/main/java/com/sun/webkit/WebPage.java"
+                 (((regexp-quote "static {") all)
+                  (string-append
+                   all
+                   "\nString jlp = \""lib":\"+System.getProperty(\"java.library.path\");\n"
+                   "System.setProperty(\"java.library.path\", jlp);\n"))))
+
+             (invoke "ant" "compile" "-Dclasses.dir=modules/web/build/classes/java/main")))
+
+         (add-after 'build 'generate-headers
+           ;; XX: We provide only software built from source, so let's build
+           ;; webkit as well. List of webkit classes can be found in
+           ;; build.gradle:2516. We need to generate headers for the upcoming
+           ;; compilation step first and put them in generated-src/headers
+           ;; location.
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((classes "modules/web/build/classes/java/main")
+                    (web-generated-headers "modules/web/build/generated-src/headers")
+                    (web-generated-classes '("com.sun.webkit.ContextMenu"
+                                             "com.sun.webkit.ContextMenuItem"
+                                             "com.sun.webkit.CursorManager"
+                                             "com.sun.webkit.PageCache"
+                                             "com.sun.webkit.PopupMenu"
+                                             "com.sun.webkit.SharedBuffer"
+                                             "com.sun.webkit.WebPage"
+                                             "com.sun.webkit.LoadListenerClient"
+                                             "com.sun.webkit.event.WCFocusEvent"
+                                             "com.sun.webkit.event.WCKeyEvent"
+                                             "com.sun.webkit.event.WCMouseEvent"
+                                             "com.sun.webkit.event.WCMouseWheelEvent"
+                                             "com.sun.webkit.graphics.GraphicsDecoder"
+                                             "com.sun.webkit.graphics.RenderMediaControls"
+                                             "com.sun.webkit.graphics.RenderTheme"
+                                             "com.sun.webkit.graphics.ScrollBarTheme"
+                                             "com.sun.webkit.graphics.WCMediaPlayer"
+                                             "com.sun.webkit.graphics.WCGraphicsManager"
+                                             "com.sun.webkit.graphics.WCRenderQueue"
+                                             "com.sun.webkit.graphics.WCPath"
+                                             "com.sun.webkit.graphics.WCPathIterator"
+                                             "com.sun.webkit.Timer"
+                                             "com.sun.webkit.WCFrameView"
+                                             "com.sun.webkit.WCPasteboard"
+                                             "com.sun.webkit.WCPluginWidget"
+                                             "com.sun.webkit.dom.CharacterDataImpl"
+                                             "com.sun.webkit.dom.JSObject"
+                                             "com.sun.webkit.network.SocketStreamHandle"
+                                             "com.sun.webkit.network.URLLoader"
+                                             "com.sun.webkit.text.TextBreakIterator"
+                                             "com.sun.webkit.text.TextNormalizer"))
+                    (graphics (assoc-ref inputs "java-openjfx-graphics")))
+               (mkdir-p web-generated-headers)
+               (apply invoke
+                      "javah"
+                      "-Djava.ext.dirs="
+                      "-XDignore.symbol.file"
+                      "-XDuseUnsharedTable=true"
+                      "-d" web-generated-headers
+                      "-cp" (string-join (cons* classes (find-files graphics "\\.jar$")) ":")
+                      web-generated-classes))))
+
+         (add-after 'unpack 'copy-resources
+           (lambda _
+             (copy-recursively "modules/web/src/test/resources"
+                               "build/test-classes")
+             (copy-recursively "modules/web/src/main/resources"
+                               "build/classes")))
+         (add-after 'generate-headers 'compile-native-linux
+           (lambda* (#:key inputs system outputs #:allow-other-keys)
+             (let*  ((module (string-append (getcwd) "/modules/web"))
+                     ;;
+                     (webkit-native-dest (string-append module "/build/linux"))
+                     (webkit-native-src (string-append module "/src/main/native"))
+                     ;;
+                     (lib (string-append (assoc-ref outputs "out") "/lib/openjfx"))
+                     ;; uname -m
+                     (machine (match system
+                                ("x86_64-linux"   "x86_64")
+                                ("i686-linux"     "i686")
+                                ;; Prevent errors when querying this
+                                ;; package on unsupported platforms,
+                                ;; e.g. when running "guix package
+                                ;; --search="
+                                (_                "UNSUPPORTED"))))
+
+               (setenv "PYTHONDONTWRITEBYTECODE" "1")
+               (setenv "WEBKIT_OUTPUTDIR" webkit-native-dest)
+               (apply invoke `("perl"
+                               ,(string-append webkit-native-src "/Tools/Scripts/set-webkit-configuration")
+                               ,(if ,(target-64bit?) "--64-bit" "--32-bit")
+                               "--release"))
+
+               (invoke "perl"
+                       (string-append webkit-native-src "/Tools/Scripts/build-webkit")
+                       "--java" ; webkit port
+                       "--skip-library-update"
+                       "--icu-unicode"
+                       "--verbose"
+                       (string-append
+                        "--cmakeargs="
+                        (string-join
+                         (list "-DENABLE_TOOLS=1"
+                               "-DCMAKE_SYSTEM_NAME=Linux"
+                               ;; Ensure that the libraries are installed into /lib
+                               (string-append "-DCMAKE_INSTALL_LIBDIR=" lib)
+                               ;; Add input libraries to rpath
+                               "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
+                               ;; Enable verbose output from builds
+                               "-DCMAKE_VERBOSE_MAKEFILE=ON"
+                               (string-append "-DCMAKE_SHARED_LINKER_FLAGS="
+                                              "\"-Wl,-rpath=" lib "\"")
+                               (string-append "-DCMAKE_SYSTEM_PROCESSOR=" machine)
+                               "-DJAVAFX_RELEASE_VERSION=8.0"
+                               (string-append "-DCMAKE_CXX_FLAGS=\""
+                                              (string-join (list "-W"
+                                                                 "-DU_DEFINE_FALSE_AND_TRUE=1"
+                                                                 "-Wall"
+                                                                 "-Wl,--gc-sections"
+                                                                 "-Wno-parentheses"
+                                                                 "-Wno-unused"
+
+                                                                 ;; silence excessive warnings
+                                                                 "-Wno-expansion-to-defined"
+                                                                 "-Wno-deprecated-copy"
+                                                                 "-Wno-redundant-move"
+                                                                 "-Wno-class-memaccess"
+                                                                 "-Wno-undef"
+
+                                                                 "-fPIC"
+                                                                 "-fno-omit-frame-pointer"
+                                                                 "-fno-strict-aliasing"
+                                                                 "-fstack-protector")
+                                                           " ")
+                                              "\""))))))))
+
+
+         (add-before 'check 'x-test-setup
+           (lambda _
+             (system "Xvfb :33 &")
+             (setenv "DISPLAY" ":33")))
+
+         (add-before 'x-test-setup 'copy-classes
+           (lambda _
+
+             (mkdir-p "src/test/resources")
+             (copy-recursively
+              "modules/web/src/test/resources"
+              "src/test/resources")
+
+             (mkdir-p "src/main/native/Tools/TestWebKitAPI/Tests/mac/")
+             (copy-file "modules/web/src/main/native/Tools/TestWebKitAPI/Tests/mac/Ahem.ttf"
+                        "src/main/native/Tools/TestWebKitAPI/Tests/mac/Ahem.ttf")
+
+             (with-directory-excursion "modules/web/src/test/resources/test/html/"
+               (apply invoke "jar" "cf" "webArchiveJar.jar" (find-files ".")))
+
+             (copy-recursively "modules/web/build/classes/java/main" "build/classes")
+             (substitute* "build.xml"
+               (("<junit.*haltonfailure=\"yes\">" all)
+                (string-append "<mkdir dir=\"${test.home}/home\" />" ;; home dir required for some tests.
+                               all
+                               "<sysproperty key=\"user.home\" value=\"${test.home}/home\"/>"
+                               "<sysproperty key=\"java.library.path\" value=\"modules/web/build/linux/Release/lib/\"/>"
+                               "<jvmarg value=\"-DWEB_ARCHIVE_JAR_TEST_DIR=modules/web/src/test/resources/test/html/\"/>")))))
+
+         (add-before 'install 'build-jar
+           (lambda _
+             (let* ((resources "modules/web/src/main/resources")
+                    (classes "modules/web/build/classes/java/main"))
+               (copy-recursively resources classes)
+               (invoke "ant" "jar" (string-append "-Dclasses.dir=" classes)))))
+
+         (add-after 'install 'install-native
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((lib (string-append (assoc-ref outputs "out") "/lib/openjfx")))
+               (for-each (lambda (file)
+                           (install-file file lib))
+                         (find-files "." "\\.so$"))))))))
+
+    (native-inputs
+     (list java-junit
+           cmake
+           ruby
+           perl
+           gperf
+           python-2
+           pkg-config
+           xorg-server-for-tests))
+    (inputs
+     (list
+      ;; Webkit Java port dependencies
+      icu4c
+      libxml2
+      libxslt
+      sqlite))
+    (propagated-inputs
+     (list java-openjfx-controls
+           java-openjfx-media
+           java-openjfx-graphics))
+    (description "OpenJFX is a client application platform for desktop,
+mobile and embedded systems built on Java.  Its goal is to produce a modern,
+efficient, and fully featured toolkit for developing rich client applications.
+This package provides means for loading and displaying Web content.")))
+
 (define-public javacc-4
   (package
     (name "javacc")
diff --git a/gnu/packages/patches/java-openjfx-build-web-DumpRenderTree-java.patch b/gnu/packages/patches/java-openjfx-build-web-DumpRenderTree-java.patch
new file mode 100644
index 0000000000..0200e92c05
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-DumpRenderTree-java.patch
@@ -0,0 +1,30 @@
+Subject: [PATCH] Fix DumpRenderTree linking.
+
+DumpRenderTree compiles OK, but fails on a linking stage with the bellow
+error. I found the very same fix for openjfx-8 FreeBSD ports as well. Let's
+ignore undefined references for now.
+
+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)'
+collect2: error: ld returned 1 exit status
+
+---
+ .../src/main/native/Tools/DumpRenderTree/java/CMakeLists.txt  | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/modules/web/src/main/native/Tools/DumpRenderTree/java/CMakeLists.txt b/modules/web/src/main/native/Tools/DumpRenderTree/java/CMakeLists.txt
+index e2ce5ef..2ad3db7 100644
+--- a/modules/web/src/main/native/Tools/DumpRenderTree/java/CMakeLists.txt
++++ b/modules/web/src/main/native/Tools/DumpRenderTree/java/CMakeLists.txt
+@@ -72,9 +72,5 @@ add_library(DumpRenderTreeJava SHARED ${DumpRenderTree_SOURCES})
+ add_definitions(-DWEBCORE_EXPORT=WTF_IMPORT -DWEBCORE_TESTSUPPORT_EXPORT=WTF_IMPORT)
+ add_dependencies(DumpRenderTreeJava DumpRenderTreeBindings)
+
+-if (UNIX AND NOT APPLE)
+-  set_target_properties(DumpRenderTreeJava PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
+-endif ()
+-
+ set_target_properties(DumpRenderTreeJava PROPERTIES OUTPUT_NAME "DumpRenderTreeJava")
+ target_link_libraries(DumpRenderTreeJava ${DumpRenderTree_LIBRARIES})
+--
+2.26.2
diff --git a/gnu/packages/patches/java-openjfx-build-web-OptionsJava.cmake.patch b/gnu/packages/patches/java-openjfx-build-web-OptionsJava.cmake.patch
new file mode 100644
index 0000000000..1f133571cb
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-OptionsJava.cmake.patch
@@ -0,0 +1,32 @@
+Subject: [PATCH] Use find_package.
+
+We remove all embedded 3rd-party libs like icu, libxml, libxslt and sqlite,
+and use libraries provided via guix inputs.
+---
+ .../web/src/main/native/Source/cmake/OptionsJava.cmake | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/modules/web/src/main/native/Source/cmake/OptionsJava.cmake b/modules/web/src/main/native/Source/cmake/OptionsJava.cmake
+index 76a6695..73c525b 100644
+--- a/modules/web/src/main/native/Source/cmake/OptionsJava.cmake
++++ b/modules/web/src/main/native/Source/cmake/OptionsJava.cmake
+@@ -26,13 +26,11 @@ endif ()
+ set(LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE PATH "Absolute path to library installation directory")
+ set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}" CACHE PATH "Absolute path to executable installation directory")
+
+-set(SQLITE_LIBRARIES SqliteJava)
+-set(LIBXML2_LIBRARIES XMLJava)
+-set(LIBXSLT_LIBRARIES XSLTJava)
+
+-set(ICU_LIBRARIES icuuc icudata)
+-set(ICU_I18N_LIBRARIES icui18n icuuc icudata)
+-set(ICU_DATA_LIBRARIES icudata)
++find_package(Sqlite REQUIRED)
++find_package(LibXml2 REQUIRED)
++find_package(LibXslt REQUIRED)
++find_package(ICU REQUIRED)
+
+ find_package(JNI REQUIRED)
+ find_package(Threads REQUIRED)
+--
+2.26.2
diff --git a/gnu/packages/patches/java-openjfx-build-web-WTF.patch b/gnu/packages/patches/java-openjfx-build-web-WTF.patch
new file mode 100644
index 0000000000..5fa76449df
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-WTF.patch
@@ -0,0 +1,33 @@
+Subject: [PATCH] Fix compilation against ICU 59+.
+
+ICU4C has moved to char16_t as the type for UTF-16
+http://site.icu-project.org/download/59
+
+diff --git a/modules/web/src/main/native/Source/WTF/wtf/unicode/java/UnicodeJava.h b/modules/web/src/main/native/Source/WTF/wtf/unicode/java/UnicodeJava.h
+index 0993aa6..e6ea131 100644
+--- a/modules/web/src/main/native/Source/WTF/wtf/unicode/java/UnicodeJava.h
++++ b/modules/web/src/main/native/Source/WTF/wtf/unicode/java/UnicodeJava.h
+@@ -15,21 +15,6 @@
+
+ #define CharProp(p) com_sun_webkit_dom_CharacterDataImpl_##p
+
+-#if PLATFORM(JAVA) && OS(WINDOWS)
+-typedef wchar_t UChar;
+-#else
+-typedef uint16_t UChar;
+-#endif
+-
+-// #ifdef UChar32
+-// #undef UChar32
+-// #endif
+-
+-#ifndef __UMACHINE_H__ //XXX: recheck
+-typedef uint32_t UChar32;
+-#endif
+-
+-#define U_MASK(x) ((uint32_t)1<<(x))
+ #define USE_FAST_PATH(c, fast, slow) ((c) <= 0x7F ? fast((char)c) : slow(c))
+
+ #define CHECK_PROPERTY(c, mask, isSet) \
+--
+2.26.2
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
diff --git a/gnu/packages/patches/java-openjfx-build-web-icu.patch b/gnu/packages/patches/java-openjfx-build-web-icu.patch
new file mode 100644
index 0000000000..3e5c4a770c
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-icu.patch
@@ -0,0 +1,38 @@
+Subject: [PATCH] Fix compilateion with ICU.
+
+Regressed by https://github.com/unicode-org/icu/commit/480bec3ea652
+
+---
+ modules/web/src/main/native/Source/WebCore/dom/Document.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/modules/web/src/main/native/Source/WebCore/dom/Document.cpp b/modules/web/src/main/native/Source/WebCore/dom/Document.cpp
+index ec30fb5..4b0ff9d 100644
+--- a/modules/web/src/main/native/Source/WebCore/dom/Document.cpp
++++ b/modules/web/src/main/native/Source/WebCore/dom/Document.cpp
+@@ -4704,12 +4704,12 @@ static bool isValidNameNonASCII(const UChar* characters, unsigned length)
+     unsigned i = 0;
+
+     UChar32 c;
+-    U16_NEXT(characters, i, length, c)
++    U16_NEXT(characters, i, length, c);
+     if (!isValidNameStart(c))
+         return false;
+
+     while (i < length) {
+-        U16_NEXT(characters, i, length, c)
++        U16_NEXT(characters, i, length, c);
+         if (!isValidNamePart(c))
+             return false;
+     }
+@@ -4769,7 +4769,7 @@ ExceptionOr<std::pair<AtomicString, AtomicString>> Document::parseQualifiedName(
+
+     for (unsigned i = 0; i < length; ) {
+         UChar32 c;
+-        U16_NEXT(qualifiedName, i, length, c)
++        U16_NEXT(qualifiedName, i, length, c);
+         if (c == ':') {
+             if (sawColon)
+                 return Exception { InvalidCharacterError };
+--
+2.26.2
diff --git a/gnu/packages/patches/java-openjfx-build-web-js-test.patch b/gnu/packages/patches/java-openjfx-build-web-js-test.patch
new file mode 100644
index 0000000000..040042976a
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-js-test.patch
@@ -0,0 +1,18 @@
+Fix test from later revision
+
+report: https://bugs.openjdk.org/browse/JDK-8212014
+
+fix: http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/697a138c3b6b
+
+diff --git a/modules/web/src/test/java/javafx/scene/web/JavaScriptBridgeTest.java b/modules/web/src/test/java/javafx/scene/web/JavaScriptBridgeTest.java
+--- a/modules/web/src/test/java/javafx/scene/web/JavaScriptBridgeTest.java
++++ b/modules/web/src/test/java/javafx/scene/web/JavaScriptBridgeTest.java
+@@ -578,7 +578,7 @@
+             bind("alist", alist);
+             Integer[] iarr = new Integer[4];
+             bind("iarr", iarr);
+-            Object r = web.executeScript("alist.toArray(iarr)");
++            Object r = web.executeScript("alist['toArray(Object[])'](iarr)");
+             assertSame(iarr, r);
+             assertEquals("98/87/76/null",
+                          iarr[0]+"/"+iarr[1]+"/"+iarr[2]+"/"+iarr[3]);
diff --git a/gnu/packages/patches/java-openjfx-build-web-xlocale.h.patch b/gnu/packages/patches/java-openjfx-build-web-xlocale.h.patch
new file mode 100644
index 0000000000..138f39f9af
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-xlocale.h.patch
@@ -0,0 +1,52 @@
+Subject: [PATCH] Check <xlocale.h> header file
+
+Few libraries use hard-coded xlocale_h header even though if CMake takes care
+of it properly. Remove defined headers, and rely on CMake preprocessor
+instead.
+
+---
+ .../src/main/native/Source/ThirdParty/libxslt/linux/config.h    | 2 +-
+ .../src/main/native/Source/ThirdParty/libxslt/src/config.h.in   | 2 +-
+ modules/web/src/main/native/Source/cmake/OptionsCommon.cmake    | 1 +
+ 3 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/modules/web/src/main/native/Source/ThirdParty/libxslt/linux/config.h b/modules/web/src/main/native/Source/ThirdParty/libxslt/linux/config.h
+index bd44c163..b19b45f4 100644
+--- a/modules/web/src/main/native/Source/ThirdParty/libxslt/linux/config.h
++++ b/modules/web/src/main/native/Source/ThirdParty/libxslt/linux/config.h
+@@ -143,7 +143,7 @@
+ #define HAVE_VSPRINTF 1
+
+ /* Define to 1 if you have the <xlocale.h> header file. */
+-#define HAVE_XLOCALE_H 1
++/* #define HAVE_XLOCALE_H 1 */
+
+ /* Define to 1 if you have the `_stat' function. */
+ /* #undef HAVE__STAT */
+diff --git a/modules/web/src/main/native/Source/ThirdParty/libxslt/src/config.h.in b/modules/web/src/main/native/Source/ThirdParty/libxslt/src/config.h.in
+index 085354e9..0210fce2 100644
+--- a/modules/web/src/main/native/Source/ThirdParty/libxslt/src/config.h.in
++++ b/modules/web/src/main/native/Source/ThirdParty/libxslt/src/config.h.in
+@@ -142,7 +142,7 @@
+ #undef HAVE_VSPRINTF
+
+ /* Define to 1 if you have the <xlocale.h> header file. */
+-#undef HAVE_XLOCALE_H
++/* #undef HAVE_XLOCALE_H */
+
+ /* Define to 1 if you have the `_stat' function. */
+ #undef HAVE__STAT
+diff --git a/modules/web/src/main/native/Source/cmake/OptionsCommon.cmake b/modules/web/src/main/native/Source/cmake/OptionsCommon.cmake
+index 3bbd2c4a..2b618dd6 100644
+--- a/modules/web/src/main/native/Source/cmake/OptionsCommon.cmake
++++ b/modules/web/src/main/native/Source/cmake/OptionsCommon.cmake
+@@ -148,6 +148,7 @@ _HAVE_CHECK_INCLUDE(HAVE_STRINGS_H strings.h)
+ _HAVE_CHECK_INCLUDE(HAVE_SYS_PARAM_H sys/param.h)
+ _HAVE_CHECK_INCLUDE(HAVE_SYS_TIME_H sys/time.h)
+ _HAVE_CHECK_INCLUDE(HAVE_SYS_TIMEB_H sys/timeb.h)
++_HAVE_CHECK_INCLUDE(HAVE_XLOCALE_H xlocale.h)
+
+ # Check for functions
+ _HAVE_CHECK_FUNCTION(HAVE_ALIGNED_MALLOC _aligned_malloc)
+--
+2.24.1
-- 
2.34.0

