unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch.
@ 2020-02-22 20:17 Alexey Abramov
  2020-02-22 20:17 ` [bug#39744] [PATCH 2/7] gnu: java-openjfx-build: Fix indentation Alexey Abramov
                   ` (8 more replies)
  0 siblings, 9 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-02-22 20:17 UTC (permalink / raw)
  To: 39742

* gnu/packages/java.scm: Add patch
* gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch: New
  file. Allows you to run gradlew to run properly. Useful for debugging.
---
 gnu/packages/java.scm                              |  3 ++-
 .../java-openjfx-build-get_guix_jdk_version.patch  | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 9371901e1f..01541ee419 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2355,7 +2355,8 @@ new Date();"))
               (file-name (string-append name "-" version "-checkout"))
               (sha256
                (base32
-                "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))))
+                "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
+              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
diff --git a/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch b/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
new file mode 100644
index 0000000000..214ef9949c
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
@@ -0,0 +1,14 @@
+--- a/build.gradle
++++ b/build.gradle
+@@ -742,9 +742,9 @@
+     if (inStream.readLine() != null) {
+         String v = inStream.readLine();
+         if (v != null) {
+-            int ib = v.indexOf(" (build ");
++            int ib = v.indexOf(" (guix build ");
+             if (ib != -1) {
+-                String ver = v.substring(ib + 8, v.size() - 1);
++                String ver = v.substring(ib + 13, v.size() - 1);
+ 
+                 defineProperty("jdkRuntimeVersion", ver)
+                 defineProperty("jdkVersion", jdkRuntimeVersion.split("-")[0])
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39744] [PATCH 2/7] gnu: java-openjfx-build: Fix indentation.
  2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
@ 2020-02-22 20:17 ` Alexey Abramov
  2020-02-22 20:17 ` [bug#39747] [PATCH 3/7] gnu: java-openjfx-graphics: Implement a complete compilation Alexey Abramov
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-02-22 20:17 UTC (permalink / raw)
  To: 39744

---
 gnu/packages/java.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 01541ee419..6f75194256 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2348,10 +2348,10 @@ new Date();"))
     (source (origin
               (method hg-fetch)
               (uri (hg-reference
-                     (url "http://hg.openjdk.java.net/openjfx/8u-dev/rt")
-                     (changeset (string-append
-                                  (string-join (string-split version #\.) "u")
-                                  "-ga"))))
+                    (url "http://hg.openjdk.java.net/openjfx/8u-dev/rt")
+                    (changeset (string-append
+                                (string-join (string-split version #\.) "u")
+                                "-ga"))))
               (file-name (string-append name "-" version "-checkout"))
               (sha256
                (base32
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39747] [PATCH 3/7] gnu: java-openjfx-graphics: Implement a complete compilation.
  2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
  2020-02-22 20:17 ` [bug#39744] [PATCH 2/7] gnu: java-openjfx-build: Fix indentation Alexey Abramov
@ 2020-02-22 20:17 ` Alexey Abramov
  2020-03-04  3:00   ` Leo Famulari
  2020-03-09 12:46   ` [bug#39747] [v2] " Alexey Abramov
  2020-02-22 20:17 ` [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable Alexey Abramov
                   ` (6 subsequent siblings)
  8 siblings, 2 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-02-22 20:17 UTC (permalink / raw)
  To: 39747

---
 gnu/packages/java.scm | 639 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 625 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 6f75194256..4e975a0490 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -53,6 +53,7 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gl)
+  #:use-module (gnu packages glib)
   #:use-module (gnu packages ghostscript) ;lcms
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages groovy)
@@ -2419,20 +2420,630 @@ distribution.")))
 
 (define-public java-openjfx-graphics
   (package (inherit java-openjfx-build)
-    (name "java-openjfx-graphics")
-    (arguments
-     `(#:jar-name "java-openjfx-graphics.jar"
-       #:source-dir "modules/graphics/src/main/java"
-       #:tests? #f; require X
-       #:test-dir "modules/graphics/src/test"))
-    (propagated-inputs
-     `(("java-openjfx-base" ,java-openjfx-base)
-       ("java-swt" ,java-swt)))
-    (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 contains graphics-related classes for the
-OpenJFX distribution.")))
+           (name "java-openjfx-graphics")
+           (arguments
+            `(#:jar-name "java-openjfx-graphics.jar"
+              #:source-dir "modules/graphics/src/main/java"
+              #:tests? #f               ; requires X
+              #:test-dir "modules/graphics/src/test"
+              #:test-include (list "**/*Test.*")
+              #:modules ((guix build ant-build-system)
+                         (guix build utils)
+                         (srfi srfi-1)
+                         (srfi srfi-26)
+                         (ice-9 regex)
+                         (ice-9 match))
+              #:phases
+              (let* ((jdk (assoc-ref %build-inputs "jdk"))
+                     (javac/h-flags
+                      `( ;; When javac is compiling code it doesn't link
+                        ;; against rt.jar by default. Instead it uses special
+                        ;; symbol file lib/ct.sym with class stubs.
+                        ;; Surprisingly this file contains many but not *all*
+                        ;; of internal classes.
+                        "-XDignore.symbol.file"
+                        ;; It’s an internal option for JDK 1.7+ that prevents
+                        ;; the compiler from sharing a table that will never
+                        ;; be reused. When shared, it can’t be garbage
+                        ;; collected, continues to accumulate data, and
+                        ;; therefore wastes memory.
+                        "-XDuseUnsharedTable=true"))
+                     (common-flags
+                      `("-fno-strict-aliasing" "-fPIC" "-fno-omit-frame-pointer" ;; optimization flags
+                        "-fstack-protector"
+                        "-W" "-Wall" "-Wno-unused" "-Wno-parentheses" "-Werror=implicit-function-declaration"))
+                     (cc-flags
+                      `(,@common-flags "-c" "-ffunction-sections" "-fdata-sections"
+                                       "-I" ,(string-append jdk "/include")
+                                       "-I" ,(string-append jdk "/include/linux")))
+                     (link-flags
+                      `("-static-libgcc" "-static-libstdc++" "-shared" ,@common-flags
+                        "-z" "relro"
+                        "-Wl,--gc-sections"))
+                     (java-aux-class?
+                      (lambda (class)
+                        (string-match "\\$[0-9]+.class" class)))
+                     (java-list-classes
+                      (lambda (path)
+                        ;; For each .java file we need to figure out what
+                        ;; class the .java file belongs in and convert it to a
+                        ;; class name.
+                        (filter-map
+                         (lambda (class)
+                           (let* ((rx (make-regexp (string-append path file-name-separator-string "?")))
+                                  (class (string-drop-right class (string-length ".class")))
+                                  (class (match:suffix (regexp-exec rx class))))
+                             (if (java-aux-class? class)
+                                 #f
+                                 (string-join (string-split class #\/) "."))))
+                         (find-files path "\\.class$")))))
+                (modify-phases %standard-phases
+
+                  (replace 'build
+                    (lambda _
+                      ;; Do not mix different classes. There will be more stuff in build/classes
+                      (invoke "ant" "compile" "-Dclasses.dir=modules/graphics/build/classes/java/main")
+                      #t))
+
+                  (add-after 'build 'chdir-to-a-module-directory
+                    (lambda _
+                      (chdir (string-append (getcwd) "/modules/graphics"))
+                      #t))
+
+                  (add-after 'chdir-to-a-module-directory 'compile-prism-compilers
+                    (lambda _
+                      (let ((prism-compilers-classes "build/classes/jsl-compilers/prism")
+                            (prism-src "src/main/jsl-prism/"))
+                        (mkdir-p prism-compilers-classes)
+                        (apply invoke `("javac"
+                                        "-d" ,prism-compilers-classes
+                                        ,@javac/h-flags
+                                        ,@(find-files prism-src "\\.java"))))
+                      #t))
+
+                  (add-after 'compile-prism-compilers 'generate-prism-shaders
+                    (lambda _
+                      (let ((prism-compilers-classes "build/classes/jsl-compilers/prism")
+                            (prism-src "src/main/jsl-prism/")
+                            (prism-generated-src "build/generated-src/jsl-prism"))
+                        (mkdir-p prism-generated-src)
+                        (for-each (lambda (file)
+                                    (apply invoke `("java"
+                                                    "-cp" ,(string-join (list
+                                                                         ;; For CompileJSL
+                                                                         prism-compilers-classes
+                                                                         ;; jsl files are there
+                                                                         prism-src
+                                                                         (getenv "CLASSPATH"))
+                                                                        ":")
+                                                    "CompileJSL"
+                                                    "-i" ,prism-src
+                                                    "-o" ,prism-generated-src
+                                                    "-t"
+                                                    "-pkg" "com/sun/prism"
+                                                    "-d3d"
+                                                    "-es2"
+                                                    "-name" ,file)))
+                                  (find-files prism-src "\\.jsl$")))
+                      #t))
+
+                  (add-after 'generate-prism-shaders 'compile-prism-shaders
+                    (lambda _
+                      (let* ((classes "build/classes/java/main")
+                             (prism-classes "build/classes/jsl-prism")
+                             (prism-generated-src "build/generated-src/jsl-prism")
+                             (prism-generated-shaders-src (string-append prism-generated-src "/com/sun/prism/shader")))
+                        (mkdir-p prism-classes)
+                        (apply invoke `("javac"
+                                        "-d" ,prism-classes
+                                        "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                        ,@javac/h-flags
+                                        ,@(find-files prism-generated-shaders-src))))
+                      #t))
+                  (add-after 'compile-prism-shaders 'compile-decora-compilers
+                    (lambda _
+                      (let ((classes "build/classes/java/main")
+                            (decora-compilers-classes "build/classes/jsl-compilers/decora")
+                            (decora-src "src/main/jsl-decora/"))
+                        (mkdir-p decora-compilers-classes)
+                        (apply invoke `("javac"
+                                        "-d" ,decora-compilers-classes
+                                        "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                        ,@javac/h-flags
+                                        ,@(find-files decora-src "\\.java"))))
+                      #t))
+
+                  (add-after 'compile-decora-compilers 'generate-decora-shaders
+                    (lambda _
+                      (let ((classes "build/classes/java/main")
+                            (decora-classes "build/classes/jsl-decora/")
+                            (decora-compilers-classes "build/classes/jsl-compilers/decora")
+                            (decora-generated-src "build/generated-src/jsl-decora")
+                            (decora-src "src/main/jsl-decora/")
+                            (decora-components '([(file-name . "ColorAdjust")
+                                                  (generator . "CompileJSL")
+                                                  (outputs . "-all")]
+                                                 [(file-name . "Brightpass")
+                                                  (generator . "CompileJSL")
+                                                  (outputs . "-all")]
+                                                 [(file-name . "SepiaTone")
+                                                  (generator . "CompileJSL")
+                                                  (outputs . "-all")]
+                                                 [(file-name . "PerspectiveTransform")
+                                                  (generator . "CompileJSL")
+                                                  (outputs . "-all")]
+                                                 [(file-name . "DisplacementMap")
+                                                  (generator . "CompileJSL")
+                                                  (outputs . "-all")]
+                                                 [(file-name . "InvertMask")
+                                                  (generator . "CompileJSL")
+                                                  (outputs . "-all")]
+                                                 [(file-name . "Blend")
+                                                  (generator . "CompileBlend")
+                                                  (outputs . "-all")]
+                                                 [(file-name . "PhongLighting")
+                                                  (generator . "CompilePhong")
+                                                  (outputs . "-all")]
+                                                 [(file-name . "LinearConvolve")
+                                                  (generator . "CompileLinearConvolve")
+                                                  (outputs . "-hw")]
+                                                 [(file-name . "LinearConvolveShadow")
+                                                  (generator . "CompileLinearConvolve")
+                                                  (outputs . "-hw")])))
+                        (mkdir-p decora-generated-src)
+                        (for-each (match-lambda
+                                    ((('file-name . file-name)
+                                      ('generator . generator)
+                                      ('outputs . outputs))
+                                     (apply invoke `("java"
+                                                     "-cp" ,(string-join (cons* classes
+                                                                                decora-src
+                                                                                ;; CompileJSL
+                                                                                decora-compilers-classes
+                                                                                decora-classes
+                                                                                ;; We need resources from the build
+                                                                                "../../buildSrc/src/main/resources"
+                                                                                (list (getenv "CLASSPATH")))
+                                                                         ":")
+                                                     ,generator
+                                                     "-i" ,decora-src
+                                                     "-o" ,decora-generated-src
+                                                     "-t"
+                                                     "-pkg" "com/sun/scenario/effect"
+                                                     ,outputs
+                                                     ,file-name))))
+                                  decora-components)
+                        #t)))
+
+                  (add-after 'generate-decora-shaders 'compile-decora-shaders
+                    (lambda _
+                      (let ((classes "build/classes/java/main")
+                            (decora-classes "build/classes/jsl-decora/")
+                            (decora-generated-src "build/generated-src/jsl-decora"))
+                        (mkdir-p decora-classes)
+                        (apply invoke `("javac"
+                                        "-d" ,decora-classes
+                                        "-cp" ,classes
+                                        ,@javac/h-flags
+                                        ,@(find-files decora-generated-src "\\.java$"))))
+                      #t))
+
+                  (add-after 'compile-decora-shaders 'compile-decora-native-lib
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((classes "build/classes/java/main")
+                             (decora-generated-headers "build/generated-src/headers/jsl-decora")
+                             (decora-generated-src "build/generated-src/jsl-decora")
+                             (decora-native-lib "build/libs/jsl-decora/linux/libdecora_sse.so")
+                             (decora-native-obj "build/native/jsl-decora/linux")
+                             (decora-native-src "src/main/native-decora")
+                             (decora-src "src/main/jsl-decora/")
+                             (decora-classes "build/classes/jsl-decora/")
+                             (decora-cc-flags `(,@cc-flags "-ffast-math")))
+                        (mkdir-p decora-generated-headers)
+                        (apply invoke `("javah"
+                                        "-d" ,decora-generated-headers
+                                        "-cp" ,(string-join (list classes decora-classes) ":")
+                                        ,@javac/h-flags
+                                        ,@(filter (cut string-prefix? "com.sun.scenario.effect.impl.sw.sse" <>)
+                                                  (append (java-list-classes classes)
+                                                          (java-list-classes decora-classes)))))
+                        (mkdir-p decora-native-obj)
+                        (for-each (lambda (cc)
+                                    (apply invoke `("gcc"
+                                                    ,@decora-cc-flags
+                                                    "-I" ,decora-generated-headers
+                                                    "-I" ,decora-generated-src
+                                                    "-I" ,decora-native-src
+                                                    "-o" ,(string-append decora-native-obj  "/"
+                                                                         (basename cc ".cc") ".obj")
+                                                    ,cc)))
+                                  (append (find-files decora-generated-src "\\.cc$")
+                                          (find-files decora-native-src "\\.cc$")))
+                        (mkdir-p (dirname decora-native-lib))
+                        (apply invoke `("g++"
+                                        "-o" ,decora-native-lib
+                                        ,@link-flags
+                                        ,@(find-files decora-native-obj "\\.obj$"))))
+                      #t))
+
+                  (add-after 'compile-decora-native-lib 'compile-linux-font-native-lib
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((classes "build/classes/java/main")
+                             (font-generated-headers "build/generated-src/headers/font/linux")
+                             (font-native-lib "build/libs/font/linux/libjavafx_font.so")
+                             (font-native-obj "build/native/font/linux")
+                             (font-native-src "src/main/native-font")
+                             ;;
+                             (font-cc-flags `("-DJFXFONT_PLUS" ,@cc-flags)))
+                        (mkdir-p font-generated-headers)
+                        (apply invoke `("javah"
+                                        "-d" ,font-generated-headers
+                                        "-cp" ,classes
+                                        ,@javac/h-flags
+                                        ,@(filter (lambda (class)
+                                                    (or (string-prefix? "com.sun.javafx.font" class)
+                                                        (string-prefix? "com.sun.javafx.text" class)))
+                                                  (java-list-classes classes))))
+                        (mkdir-p font-native-obj)
+                        (for-each (lambda (cc)
+                                    (apply invoke `("gcc"
+                                                    ,@font-cc-flags
+                                                    "-I" ,font-generated-headers
+                                                    "-I" ,font-native-src
+                                                    "-o" ,(string-append font-native-obj "/"
+                                                                         (basename cc ".c") ".obj")
+                                                    ,cc)))
+                                  (find-files font-native-src "\\.c$"))
+                        (mkdir-p (dirname font-native-lib))
+                        (apply invoke `("g++"
+                                        "-o" ,font-native-lib
+                                        ,@link-flags
+                                        ,@(find-files font-native-obj "\\.obj$"))))
+                      #t))
+
+                  (add-after 'compile-linux-font-native-lib 'compile-linux-font-freetype
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((classes "build/classes/java/main")
+                             ;;
+                             (font-freetype-generated-headers "build/generated-src/headers/fontFreetype/linux")
+                             (font-freetype-native-lib "build/libs/fontFreetype/linux/libjavafx_font_freetype.so")
+                             (font-freetype-native-obj "build/native/fontFreetype/linux")
+                             (font-freetype-native-src "src/main/native-font/freetype.c")
+                             (font-freetype-cc-flags `("-DJFXFONT_PLUS" "-D_ENABLE_PANGO"
+                                                       "$(pkg-config --cflags freetype2)" ,@cc-flags))
+                             (font-freetype-link-flags `("$(pkg-config --libs freetype2)" ,@link-flags)))
+                        (mkdir-p font-freetype-generated-headers)
+                        (apply invoke `("javah"
+                                        "-d" ,font-freetype-generated-headers
+                                        "-cp" ,classes
+                                        ,@javac/h-flags
+                                        ,@(filter (cut string-prefix? "com.sun.javafx.font.freetype.OSFreetype" <>)
+                                                  (java-list-classes classes))))
+                        (mkdir-p font-freetype-native-obj)
+                        (invoke "bash" "-c"
+                                (string-join `("gcc"
+                                               ,@font-freetype-cc-flags
+                                               "-I" ,font-freetype-generated-headers
+                                               "-I" ,(dirname font-freetype-native-src)
+                                               "-o" ,(string-append font-freetype-native-obj "/"
+                                                                    (basename font-freetype-native-src ".c") ".obj")
+                                               ,font-freetype-native-src)))
+                        (mkdir-p (dirname font-freetype-native-lib))
+                        (invoke "bash" "-c"
+                                (string-join `("g++"
+                                               "-o" ,font-freetype-native-lib
+                                               ,@font-freetype-link-flags
+                                               ,@(find-files font-freetype-native-obj "\\.obj$"))))
+                        #t)))
+
+                  (add-after 'compile-linux-font-freetype 'compile-linux-font-pango-lib
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((classes "build/classes/java/main")
+                             (font-pango-generated-headers "build/generated-src/headers/fontPango/linux")
+                             (font-pango-native-lib "build/libs/fontPango/linux/libjavafx_font_pango.so")
+                             (font-pango-native-obj "build/native/fontPango/linux")
+                             (font-pango-native-src "src/main/native-font/pango.c")
+                             (font-pango-cc-flags `("-DJFXFONT_PLUS" "-D_ENABLE_PANGO"
+                                                    "$(pkg-config --cflags pangoft2)" ,@cc-flags))
+                             (font-pango-link-flags `("$(pkg-config --libs pangoft2)" ,@link-flags)))
+                        (mkdir-p font-pango-generated-headers)
+                        (apply invoke `("javah"
+                                        "-d" ,font-pango-generated-headers
+                                        "-cp" ,classes
+                                        ,@javac/h-flags
+                                        ,@(filter (cut string-prefix? "com.sun.javafx.font.freetype.OSPango" <>)
+                                                  (java-list-classes classes))))
+                        (mkdir-p font-pango-native-obj)
+                        (invoke "bash" "-c"
+                                (string-join `("gcc"
+                                               ,@font-pango-cc-flags
+                                               "-I" ,font-pango-generated-headers
+                                               "-I" ,(dirname font-pango-native-src)
+                                               "-o" ,(string-append font-pango-native-obj "/"
+                                                                    (basename font-pango-native-src ".c") ".obj")
+                                               ,font-pango-native-src)))
+                        (mkdir-p (dirname font-pango-native-lib))
+                        (invoke "bash" "-c"
+                                (string-join `("g++"
+                                               ,@font-pango-link-flags
+                                               "-o" ,font-pango-native-lib
+                                               ,@(find-files font-pango-native-obj "\\.obj$")))))
+                      #t))
+
+                  (add-after 'compile-linux-font-pango-lib 'compile-linux-glass-lib
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((classes "build/classes/java/main")
+                             ;; glass
+                             (glass-generated-headers "build/generated-src/headers/glass/linux")
+                             (glass-native-lib "build/libs/glass/linux/libglass.so")
+                             (glass-native-obj "build/native/glass/linux/glass")
+                             (glass-native-src "src/main/native-glass/gtk/launcher.c")
+                             (glass-cc-flags `(,@cc-flags "$(pkg-config --cflags glib-2.0 gdk-2.0 gtk+-2.0 gthread-2.0 xtst)" "-Werror"))
+                             (glass-link-flags `(,@link-flags "$(pkg-config --libs x11)" "-ldl"))
+                             ;; glass-gtk2
+                             (gtk (assoc-ref inputs "gtk"))
+                             (glass-gtk2-native-obj "build/native/glass/linux/glassgtk2")
+                             (glass-gtk2-native-src (dirname glass-native-src))
+                             (glass-gtk2-native-lib "build/libs/glass/linux/libglassgtk2.so")
+                             (glass-gtk2-cc-flags `(,@cc-flags "$(pkg-config --cflags gtk+-2.0 gthread-2.0 xtst)" "-Werror"))
+                             (glass-gtk2-link-flags `(,@link-flags "$(pkg-config --libs gtk+-2.0 gthread-2.0 xtst)"))
+                             ;; glass-gtk3
+                             (gtk3 (assoc-ref inputs "gtk3"))
+                             (glass-gtk3-native-obj "build/native/glass/linux/glassgtk3")
+                             (glass-gtk3-native-src (dirname glass-native-src))
+                             (glass-gtk3-native-lib "build/libs/glass/linux/libglassgtk3.so")
+                             (glass-gtk3-cc-flags `(,@cc-flags "$(pkg-config --cflags gtk+-3.0 gthread-2.0 xtst)" "-Wno-deprecated-declarations" "-Werror"))
+                             (glass-gtk3-link-flags `(,@link-flags "$(pkg-config --libs gtk+-3.0 gthread-2.0 xtst)")))
+                        ;; glass
+                        (mkdir-p glass-generated-headers)
+                        (apply invoke `("javah"
+                                        "-d" ,glass-generated-headers
+                                        "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                        ,@javac/h-flags
+                                        ,@(filter (lambda (class)
+                                                    (or (string-prefix? "com.sun.glass.events" class)
+                                                        (string-prefix? "com.sun.glass.ui.gtk" class)
+                                                        (string-prefix? "com.sun.glass.ui" class)))
+                                                  (java-list-classes classes))))
+                        (mkdir-p glass-native-obj)
+                        (invoke "bash" "-c"
+                                (string-join `("gcc"
+                                               ,@glass-cc-flags
+                                               "-I" ,glass-generated-headers
+                                               "-I" ,(dirname glass-native-src)
+                                               "-o" ,(string-append glass-native-obj "/"
+                                                                    (basename glass-native-src ".c") ".obj")
+                                               ,glass-native-src)))
+                        (mkdir-p (dirname glass-native-lib))
+                        (invoke "bash" "-c"
+                                (string-join `("g++"
+                                               ,@glass-link-flags
+                                               "-o" ,glass-native-lib
+                                               ,@(find-files glass-native-obj "\\.obj$"))))
+                        ;; gtk2
+                        (mkdir-p glass-gtk2-native-obj)
+                        (for-each (lambda (cpp)
+                                    (invoke "bash" "-c"
+                                            (string-join `("gcc"
+                                                           ,@glass-gtk2-cc-flags
+                                                           "-I" ,glass-generated-headers
+                                                           "-o" ,(string-append glass-gtk2-native-obj "/"
+                                                                                (basename cpp ".cpp") ".obj")
+                                                           ,cpp))))
+                                  (find-files glass-gtk2-native-src "\\.cpp$"))
+                        (mkdir-p (dirname glass-gtk2-native-lib))
+                        (invoke "bash" "-c"
+                                (string-join `("g++"
+                                               ,@glass-gtk2-link-flags
+                                               "-o" ,glass-gtk2-native-lib
+                                               ,@(find-files glass-gtk2-native-obj "\\.obj$"))))
+                        ;; gtk3
+                        (mkdir-p glass-gtk3-native-obj)
+                        (for-each (lambda (cpp)
+                                    (invoke "bash" "-c"
+                                            (string-join `("gcc"
+                                                           ,@glass-gtk3-cc-flags
+                                                           "-I" ,glass-generated-headers
+                                                           "-o" ,(string-append glass-gtk3-native-obj "/"
+                                                                                (basename cpp ".cpp") ".obj")
+                                                           ,cpp))))
+                                  (find-files glass-gtk3-native-src "\\.cpp$"))
+                        (mkdir-p (dirname glass-gtk3-native-lib))
+                        (invoke "bash" "-c"
+                                (string-join `("g++"
+                                               ,@glass-gtk3-link-flags
+                                               "-o" ,glass-gtk3-native-lib
+                                               ,@(find-files glass-gtk3-native-obj "\\.obj$")))))
+                      #t))
+
+                  (add-after 'compile-linux-glass-lib  'compile-linux-iio
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((classes "build/classes/java/main")
+                             (iio-generated-headers "build/generated-src/headers/iio/linux")
+                             (iio-native-lib "build/libs/iio/linux/libjavafx_iio.so")
+                             (iio-native-obj "build/native/iio/linux")
+                             (iio-native-src "src/main/native-iio")
+                             (iio-cc-flags cc-flags)
+                             (iio-link-flags link-flags))
+                        (mkdir-p iio-generated-headers)
+                        (apply invoke `("javah"
+                                        "-d" ,iio-generated-headers
+                                        "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                        ,@javac/h-flags
+                                        ,@(filter (cut string-prefix? "com.sun.javafx.iio" <>)
+                                                  (java-list-classes classes))))
+                        (mkdir-p iio-native-obj)
+                        (for-each (lambda (c)
+                                    (invoke "bash" "-c"
+                                            (string-join `("gcc"
+                                                           ,@iio-cc-flags
+                                                           "-I" ,iio-generated-headers
+                                                           "-o" ,(string-append iio-native-obj "/"
+                                                                                (basename c ".c") ".obj")
+                                                           ,c))))
+                                  (find-files iio-native-src "\\.c$"))
+                        (mkdir-p (dirname iio-native-lib))
+                        (invoke "bash" "-c"
+                                (string-join `("g++"
+                                               ,@iio-link-flags
+                                               "-o" ,iio-native-lib
+                                               ,@(find-files iio-native-obj "\\.obj$"))))
+                        #t)))
+
+                  (add-after 'compile-linux-iio 'compile-linux-prism
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((classes "build/classes/java/main")
+                             (prism-generated-headers "build/generated-src/headers/prism/linux")
+                             (prism-native-lib "build/libs/prism/linux/libprism_common.so")
+                             (prism-native-obj "build/native/prism/linux")
+                             (prism-native-src "src/main/native-prism")
+                             (prism-cc-flags `(,@cc-flags "-DINLINE=inline"))
+                             (prism-link-flags link-flags))
+                        (mkdir-p prism-generated-headers)
+                        (apply invoke `("javah"
+                                        "-d" ,prism-generated-headers
+                                        "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                        ,@javac/h-flags
+                                        ,@(filter (lambda (class)
+                                                    (or (string-prefix? "com.sun.prism.impl" class)
+                                                        (string-prefix? "com.sun.prism.PresentableState" class)))
+                                                  (java-list-classes classes))))
+                        (mkdir-p prism-native-obj)
+                        (for-each (lambda (c)
+                                    (invoke "bash" "-c"
+                                            (string-join `("gcc"
+                                                           ,@prism-cc-flags
+                                                           "-I" ,prism-generated-headers
+                                                           "-I" ,prism-native-src
+                                                           "-o" ,(string-append prism-native-obj "/"
+                                                                                (basename c ".c") ".obj")
+                                                           ,c))))
+                                  (find-files prism-native-obj "\\.c$"))
+                        (mkdir-p (dirname prism-native-lib))
+                        (invoke "bash" "-c"
+                                (string-join `("g++"
+                                               ,@prism-link-flags
+                                               "-o" ,prism-native-lib
+                                               ,@(find-files prism-native-obj "\\.obj$"))))
+                        #t)))
+
+                  (add-after 'compile-linux-prism 'compile-linux-prism-es2
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((classes "build/classes/java/main")
+                             (prism-es2-generated-headers "build/generated-src/headers/prismES2/linux")
+                             (prism-es2-native-lib "build/libs/prism/linux/libprism_es2.so")
+                             (prism-es2-native-obj "build/native/prismES2/linux")
+                             (prism-es2-native-src "src/main/native-prism-es2")
+                             (prism-es2-cc-flags `("-DLINUX" ,@cc-flags))
+                             (prism-es2-link-flags `(,@link-flags "$(pkg-config --libs x11 xxf86vm gl)")))
+                        (mkdir-p prism-es2-generated-headers)
+                        (apply invoke `("javah"
+                                        "-d" ,prism-es2-generated-headers
+                                        "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                        ,@javac/h-flags
+                                        ,@(filter (cut string-prefix? "com.sun.prism.es2" <>)
+                                                  (java-list-classes classes))))
+                        (mkdir-p prism-es2-native-obj)
+                        (for-each (lambda (c)
+                                    (apply invoke `("gcc"
+                                                    ,@prism-es2-cc-flags
+                                                    "-I" ,glass-native-src
+                                                    "-I" ,prism-es2-generated-headers
+                                                    "-I" ,prism-es2-native-src
+                                                    "-I" ,(string-append prism-es2-native-src "/GL")
+                                                    "-I" ,(string-append prism-es2-native-src "/x11")
+                                                    "-o" ,(string-append prism-es2-native-obj "/"
+                                                                         (basename c ".c") ".obj")
+                                                    ,c)))
+                                  (find-files prism-es2-native-src
+                                              (lambda (abs _)
+                                                (or (regexp-exec (make-regexp (string-append prism-es2-native-src "[^/]*\\.c$"))
+                                                                 abs)
+                                                    (regexp-exec (make-regexp (string-append prism-es2-native-src "(x11/|GL/)"))
+                                                                 abs)))))
+                        (mkdir-p (dirname prism-es2-native-lib))
+                        (invoke "bash" "-c"
+                                (string-join `("g++"
+                                               ,@prism-es2-link-flags
+                                               "-o" ,prism-es2-native-lib
+                                               ,@(find-files prism-es2-native-obj "\\.obj$"))))
+                        #t)))
+
+                  (add-after 'compile-linux-prism-es2 'compile-linux-prism-sw
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let* ((classes "build/classes/java/main")
+                             (prism-sw-generated-headers "build/generated-src/headers/prismSW/linux")
+                             (prism-sw-native-lib "build/libs/prism/linux/libprism_sw.so")
+                             (prism-sw-native-obj "build/native/prismSW/linux")
+                             (prism-sw-native-src "src/main/native-prism-sw")
+                             ;;
+                             (prism-sw-cc-flags `(,@cc-flags "-DINLINE=inline"))
+                             (prism-sw-link-flags link-flags))
+                        (mkdir-p prism-sw-generated-headers)
+                        (apply invoke `("javah"
+                                        "-d" ,prism-sw-generated-headers
+                                        "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                        ,@javac/h-flags
+                                        ,@(filter (cut string-prefix? "com.sun.pisces" <>)
+                                                  (java-list-classes classes))))
+                        (mkdir-p prism-sw-native-obj)
+                        (for-each (lambda (c)
+                                    (invoke "bash" "-c"
+                                            (string-join `("gcc"
+                                                           ,@prism-sw-cc-flags
+                                                           "-I" ,prism-sw-generated-headers
+                                                           "-I" ,prism-sw-native-src
+                                                           "-o" ,(string-append prism-sw-native-obj "/"
+                                                                                (basename c ".c") ".obj")
+                                                           ,c))))
+                                  (find-files prism-sw-native-src "\\.c$"))
+                        (mkdir-p (dirname prism-sw-native-lib))
+                        (apply invoke `("g++"
+                                        ,@prism-sw-link-flags
+                                        "-o" ,prism-sw-native-lib
+                                        ,@(find-files prism-sw-native-obj "\\.obj$")))
+                        #t)))
+
+                  (add-before 'check 'chdir-to-root
+                    (lambda _
+                      (chdir (dirname (dirname (getcwd))))
+                      #t))
+
+                  (add-after 'chdir-to-root 'install-native
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((lib (string-append (assoc-ref outputs "out") "/share/amd64")))
+                        (for-each (lambda (file)
+                                    (install-file file lib))
+                                  (find-files "." "\\.so$"))
+                        #t)))
+
+                  (add-after 'install-native 'build-jar
+                    (lambda _
+                      (let* ((module (string-append (getcwd) "/modules/graphics"))
+                             (resources (string-append module "/src/main/resources"))
+                             (classes (string-append module "/build/classes/java/main")))
+                        (copy-recursively resources classes)
+
+                        (invoke "ant" "jar" (string-append "-Dclasses.dir=" classes)))
+                      #t))
+
+                  ))))
+           (native-inputs
+            `(("freetype" ,freetype)
+              ("fontconfig" ,fontconfig)
+              ("gcc" ,gcc)
+              ("glib" ,glib)
+              ("zlib" ,zlib)
+              ("gtk" ,gtk+-2)
+              ("gtk3" ,gtk+)
+              ("jpeg" ,libjpeg)
+              ("libxtst" ,libxtst)
+              ("pango" ,pango)
+              ("libpng" ,libpng)
+              ("pkg-config" ,pkg-config)))
+           (propagated-inputs
+            `(("java-openjfx-base" ,java-openjfx-base)
+              ("java-swt" ,java-swt)))))
 
 (define-public java-openjfx-media
   (package (inherit java-openjfx-build)
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable.
  2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
  2020-02-22 20:17 ` [bug#39744] [PATCH 2/7] gnu: java-openjfx-build: Fix indentation Alexey Abramov
  2020-02-22 20:17 ` [bug#39747] [PATCH 3/7] gnu: java-openjfx-graphics: Implement a complete compilation Alexey Abramov
@ 2020-02-22 20:17 ` Alexey Abramov
  2020-03-04  3:04   ` Leo Famulari
                     ` (3 more replies)
  2020-02-22 20:17 ` [bug#39741] [PATCH 5/7] gnu: java-openjfx-swt: " Alexey Abramov
                   ` (5 subsequent siblings)
  8 siblings, 4 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-02-22 20:17 UTC (permalink / raw)
  To: 39745

* gnu/packages/java.scm (java-openjfx-build): Add patch to the base package.
* gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch: Fix swing compilation for jdk8.
---
 gnu/packages/java.scm                         | 16 ++++-
 ...ld-swing-compile-JFXPanel-with-JDK-8.patch | 58 +++++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 4e975a0490..f2a3861501 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2357,7 +2357,8 @@ new Date();"))
               (sha256
                (base32
                 "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
-              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"))))
+              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"
+                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
@@ -3045,6 +3046,19 @@ distribution.")))
             `(("java-openjfx-base" ,java-openjfx-base)
               ("java-swt" ,java-swt)))))
 
+(define-public java-openjfx-swing
+  (package (inherit java-openjfx-build)
+           (name "java-openjfx-swing")
+           (arguments
+            `(#:jar-name "java-openjfx-swing.jar"
+              #:source-dir "modules/swing/src/main/java"
+              #:tests? #f))
+           (inputs
+            `(("antlr3" ,antlr3)
+              ("java-stringtemplate" ,java-stringtemplate)))
+           (propagated-inputs
+            `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public java-openjfx-media
   (package (inherit java-openjfx-build)
     (name "java-openjfx-media")
diff --git a/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch b/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch
new file mode 100644
index 0000000000..948c0355e9
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch
@@ -0,0 +1,58 @@
+From 173e65937d9e76872df51f7ba39c9d58986dc38f Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Fri, 3 Jan 2020 01:17:45 +0100
+Subject: [PATCH] java-openjfx-build: Cannot compile JFXPanel with JDK 8
+
+For more info please see https://bugs.openjdk.java.net/browse/JDK-8149967
+---
+ .../java/javafx/embed/swing/JFXPanel.java     | 20 ++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
+index 97515e2290..614ed656b9 100644
+--- a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
++++ b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
+@@ -81,6 +81,7 @@ import sun.awt.AppContext;
+ import sun.awt.CausedFocusEvent;
+ import sun.awt.SunToolkit;
+ import sun.java2d.SunGraphics2D;
++import sun.java2d.SurfaceData;
+ import sun.util.logging.PlatformLogger;
+ import sun.util.logging.PlatformLogger.Level;
+ 
+@@ -681,6 +682,23 @@ 
+                 e.getCaret().getInsertionIndex());
+     }
+
++    // FIXME: once we move to JDK 9 as the boot JDK we should remove the
++    // reflection code from this method, consider changing it to
++    // use double rather than int, and account for the possibility of
++    // a different scale factor in X and Y.
++    private int getDefaultScale(SurfaceData surfaceData) {
++        /*
++          double scale = surfaceData.getDefaultScaleX();
++        */
++        double scale = 1;
++        try {
++            Method meth = SurfaceData.class.getMethod("getDefaultScaleX");
++            scale = (Double)meth.invoke(surfaceData);
++        } catch (Exception ex) {
++        }
++
++        return (int)Math.round(scale);
++    }
+ 
+     /**
+      * Overrides the {@link javax.swing.JComponent#paintComponent(Graphics)}
+@@ -720,7 +738,7 @@ public class JFXPanel extends JComponent {
+ 
+             int newScaleFactor = scaleFactor;
+             if (g instanceof SunGraphics2D) {
+-                newScaleFactor = ((SunGraphics2D)g).surfaceData.getDefaultScale();
++                newScaleFactor = getDefaultScale(((SunGraphics2D)g).surfaceData);
+             }
+             if (scaleFactor != newScaleFactor) {
+                 resizePixelBuffer(newScaleFactor);
+--
+2.24.1
+
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39741] [PATCH 5/7] gnu: java-openjfx-swt: Add new variable.
  2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
                   ` (2 preceding siblings ...)
  2020-02-22 20:17 ` [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable Alexey Abramov
@ 2020-02-22 20:17 ` Alexey Abramov
  2020-03-09 16:41   ` [bug#39741] [v2] " Alexey Abramov
  2020-02-22 20:17 ` [bug#39743] [PATCH 6/7] gnu: java-openjfx-controls: " Alexey Abramov
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 34+ messages in thread
From: Alexey Abramov @ 2020-02-22 20:17 UTC (permalink / raw)
  To: 39741

---
 gnu/packages/java.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index f2a3861501..60f220f873 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3059,6 +3059,19 @@ distribution.")))
            (propagated-inputs
             `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
 
+(define-public java-openjfx-swt
+  (package (inherit java-openjfx-build)
+           (name "java-openjfx-swt")
+           (arguments
+            `(#:jar-name "java-openjfx-swt.jar"
+              #:source-dir "modules/swt/src/main/java"
+              #:tests? #f))
+           (inputs
+            `(("antlr3" ,antlr3)
+              ("java-stringtemplate" ,java-stringtemplate)))
+           (propagated-inputs
+            `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public java-openjfx-media
   (package (inherit java-openjfx-build)
     (name "java-openjfx-media")
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39743] [PATCH 6/7] gnu: java-openjfx-controls: Add new variable.
  2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
                   ` (3 preceding siblings ...)
  2020-02-22 20:17 ` [bug#39741] [PATCH 5/7] gnu: java-openjfx-swt: " Alexey Abramov
@ 2020-02-22 20:17 ` Alexey Abramov
  2020-03-09 16:54   ` [bug#39743] [v2] " Alexey Abramov
  2020-02-22 20:17 ` [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: " Alexey Abramov
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 34+ messages in thread
From: Alexey Abramov @ 2020-02-22 20:17 UTC (permalink / raw)
  To: 39743

---
 gnu/packages/java.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 60f220f873..de7efbb29f 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3072,6 +3072,22 @@ distribution.")))
            (propagated-inputs
             `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
 
+(define-public java-openjfx-controls
+  (package (inherit java-openjfx-build)
+           (name "java-openjfx-controls")
+           (arguments
+            `(#:jar-name "java-openjfx-controls.jar"
+              #:source-dir "modules/controls/src/main/java"
+              #:tests? #f
+              #:phases
+              (modify-phases %standard-phases
+                (add-before 'build 'copy-resources
+                  (lambda _
+                    (let ((resources (string-append (getcwd) "/modules/controls/src/main/resources")))
+                      (copy-recursively resources "build/classes")) #t)))))
+           (propagated-inputs
+            `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public java-openjfx-media
   (package (inherit java-openjfx-build)
     (name "java-openjfx-media")
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: Add new variable.
  2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
                   ` (4 preceding siblings ...)
  2020-02-22 20:17 ` [bug#39743] [PATCH 6/7] gnu: java-openjfx-controls: " Alexey Abramov
@ 2020-02-22 20:17 ` Alexey Abramov
  2020-03-04  3:07   ` Leo Famulari
                     ` (2 more replies)
  2020-03-04  2:56 ` [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Leo Famulari
                   ` (2 subsequent siblings)
  8 siblings, 3 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-02-22 20:17 UTC (permalink / raw)
  To: 39746

* gnu/packages/java.scm (java-openjfx-build): Add patch to the base package.
* gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch: New
  file. Remove hardcoded xlocale definitions.
---
 gnu/packages/java.scm                         | 155 +++++++++++++++++-
 ...uild-web-Check-xlocale.h-header-file.patch |  52 ++++++
 2 files changed, 206 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index de7efbb29f..a9433b89a3 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -47,11 +47,13 @@
   #: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 gettext)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages gperf)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages ghostscript) ;lcms
@@ -71,8 +73,10 @@
   #: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 xml)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages texinfo)
@@ -2358,7 +2362,8 @@ new Date();"))
                (base32
                 "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
               (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"
-                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"))))
+                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"
+                                       "java-openjfx-build-web-Check-xlocale.h-header-file.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
@@ -3103,6 +3108,154 @@ modern, efficient, and fully featured toolkit for developing rich client
 applications.  This package contains media-related 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")
+                                        ";")
+              #:tests? #f
+              #:modules ((ice-9 match)
+                         (guix build ant-build-system)
+                         (guix build utils))
+              #:phases
+              (modify-phases %standard-phases
+                (replace 'build
+                  (lambda* (#:key inputs #:allow-other-keys)
+                    (let* ((module (string-append (getcwd) "/modules/web"))
+                           (classes (string-append module "/build/classes/java/main")))
+                      (invoke "ant" "compile" (string-append "-Dclasses.dir=" classes)))
+                    #t))
+                (add-after 'build 'generate-headers
+                  (lambda* (#:key inputs #:allow-other-keys)
+                    (let* ((module (string-append (getcwd) "/modules/web"))
+                           (classes (string-append module "/build/classes/java/main"))
+                           (web-generated-headers (string-append module "/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)))
+                    #t))
+
+                (add-after 'generate-headers 'compile-native-linux
+                  (lambda* (#:key inputs system #: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"))
+                            ;; 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"))))
+
+                      (mkdir-p webkit-native-dest)
+                      (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"
+                              "--verbose"
+                              (string-append "--cmakeargs="
+                                             (string-join `("-DCMAKE_SYSTEM_NAME=Linux"
+                                                            ,(string-append "-DCMAKE_SYSTEM_PROCESSOR=" machine)
+                                                            "-DJAVAFX_RELEASE_VERSION=8.0"
+                                                            "-W"
+                                                            "-Wall"
+                                                            "-Werror=implicit-function-declaration"
+                                                            "-Wl,--gc-sections"
+                                                            "-Wno-parentheses"
+                                                            "-Wno-unused"
+                                                            "-fPIC"
+                                                            "-fno-omit-frame-pointer"
+                                                            "-fno-strict-aliasing"
+                                                            "-fstack-protector")))))
+                    #t))
+
+                (add-after 'compile-native-linux 'install-native
+                  (lambda* (#:key outputs #:allow-other-keys)
+                    (let ((lib (string-append (assoc-ref outputs "out") "/share/amd64")))
+                      (for-each (lambda (file)
+                                  (install-file file lib))
+                                (find-files "." "\\.so$"))
+                      #t)))
+
+                (add-before 'install 'build-jar
+                  (lambda _
+                    (let* ((module (string-append (getcwd) "/modules/web"))
+                           (resources (string-append module "/src/main/resources"))
+                           (classes (string-append module "/build/classes/java/main")))
+                      (copy-recursively resources classes)
+                      (invoke "ant" "jar" (string-append "-Dclasses.dir=" classes)))
+                    #t)))))
+           (inputs
+            `(("antlr3" ,antlr3)
+              ("java-stringtemplate" ,java-stringtemplate)
+              ("pkg-config" ,pkg-config)))
+           (native-inputs
+            `(("java-junit" ,java-junit)
+              ("java-hamcrest-core" ,java-hamcrest-core)
+              ("cmake" ,cmake)
+              ("gcc" ,gcc)
+              ("gtk" ,gtk+-2)
+              ("gtk3" ,gtk+)
+              ("ruby" ,ruby)
+              ("perl" ,perl)
+              ("gperf" ,gperf)
+              ("python-2" ,python-2)))
+           (propagated-inputs
+            `(("java-openjfx-controls" ,java-openjfx-controls)
+              ("java-openjfx-media" ,java-openjfx-media)
+              ("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public javacc-4
   (package
     (name "javacc")
diff --git a/gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch b/gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch
new file mode 100644
index 0000000000..5efc9d0a73
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch
@@ -0,0 +1,52 @@
+From 95fe8463a3283f0f2c72fcf3416ebfac095688e5 Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Sun, 9 Feb 2020 18:31:26 +0100
+Subject: [PATCH] Check <xlocale.h> header file
+
+---
+ .../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.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch.
  2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
                   ` (5 preceding siblings ...)
  2020-02-22 20:17 ` [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: " Alexey Abramov
@ 2020-03-04  2:56 ` Leo Famulari
  2020-03-05 20:42   ` Alexey Abramov
  2020-03-05 19:09 ` Björn Höfling
  2020-03-08 19:40 ` [bug#39742] [v2] " Alexey Abramov
  8 siblings, 1 reply; 34+ messages in thread
From: Leo Famulari @ 2020-03-04  2:56 UTC (permalink / raw)
  To: Alexey Abramov; +Cc: 39742

Hi,

Thanks for these patches and sorry for the delay in review! There are a
lot of patches and it takes a while to get through them.

On Sat, Feb 22, 2020 at 09:17:49PM +0100, Alexey Abramov wrote:
> * gnu/packages/java.scm: Add patch
> * gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch: New
>   file. Allows you to run gradlew to run properly. Useful for debugging.

The commit message needs a couple changes, to something like this:

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

We don't need to describe the patch in the commit message. Instead, we
explain it in a comment at the beginning of the patch file itself. This
is easier for the people that will read the patch later. The comment
should explain what the patch does and where it came from, including
links to bug reports and external patch sources, if they exist.

We need to register the new patch file in 'gnu/local.mk', so that it
gets distributed in the Guix release process.

And finally, we need to name the package variable (java-openjfx-build)
that the patch is being used by.

Here is an example from an older commit:

https://git.savannah.gnu.org/cgit/guix.git/commit/?id=ca5e404f9a1ff81a38a32578c9c3a6c866482a9a

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39747] [PATCH 3/7] gnu: java-openjfx-graphics: Implement a complete compilation.
  2020-02-22 20:17 ` [bug#39747] [PATCH 3/7] gnu: java-openjfx-graphics: Implement a complete compilation Alexey Abramov
@ 2020-03-04  3:00   ` Leo Famulari
  2020-03-09 13:08     ` levenson
  2020-03-09 12:46   ` [bug#39747] [v2] " Alexey Abramov
  1 sibling, 1 reply; 34+ messages in thread
From: Leo Famulari @ 2020-03-04  3:00 UTC (permalink / raw)
  To: Alexey Abramov; +Cc: 39747

On Sat, Feb 22, 2020 at 09:17:51PM +0100, Alexey Abramov wrote:
> +           (name "java-openjfx-graphics")
> +           (arguments
> +            `(#:jar-name "java-openjfx-graphics.jar"
> +              #:source-dir "modules/graphics/src/main/java"
> +              #:tests? #f               ; requires X
> +              #:test-dir "modules/graphics/src/test"
> +              #:test-include (list "**/*Test.*")
> +              #:modules ((guix build ant-build-system)
> +                         (guix build utils)
> +                         (srfi srfi-1)
> +                         (srfi srfi-26)
> +                         (ice-9 regex)
> +                         (ice-9 match))

[...]

Wow, this might be one of the longest package definitions in Guix :)

I can't review it in detail but if it's working for you, okay. Just make
sure to run `./pre-inst-env guix lint java-openjfx-graphics` and fix any
cosmetic issues.

Maybe some of the Guix Java experts can give it a closer review...

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable.
  2020-02-22 20:17 ` [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable Alexey Abramov
@ 2020-03-04  3:04   ` Leo Famulari
  2020-03-09 22:08     ` [bug#39741] " levenson
  2020-03-09 16:15   ` [bug#39745] [v2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8 Alexey Abramov
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 34+ messages in thread
From: Leo Famulari @ 2020-03-04  3:04 UTC (permalink / raw)
  To: Alexey Abramov; +Cc: 39745

On Sat, Feb 22, 2020 at 09:17:52PM +0100, Alexey Abramov wrote:
> * gnu/packages/java.scm (java-openjfx-build): Add patch to the base package.
> * gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch: Fix swing compilation for jdk8.

This commit adds the patch file but also makes a new package
java-openjfx-swing. Adding the patch to java-openjfx-build and adding
the new package should be done in separate commits.

Also remember to add the patch to 'gnu/local.mk'.

> +From 173e65937d9e76872df51f7ba39c9d58986dc38f Mon Sep 17 00:00:00 2001
> +From: Alexey Abramov <levenson@mmer.org>
> +Date: Fri, 3 Jan 2020 01:17:45 +0100
> +Subject: [PATCH] java-openjfx-build: Cannot compile JFXPanel with JDK 8
> +
> +For more info please see https://bugs.openjdk.java.net/browse/JDK-8149967

This link is great but please add a brief summary of why we need the
patch and what it does (one or two sentences is enough).

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: Add new variable.
  2020-02-22 20:17 ` [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: " Alexey Abramov
@ 2020-03-04  3:07   ` Leo Famulari
  2020-03-09 22:13     ` [bug#39741] " levenson
  2020-03-09 21:41   ` [bug#39746] [v2 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web Alexey Abramov
  2020-03-14  6:10   ` [bug#39746] [v3 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web Alexey Abramov
  2 siblings, 1 reply; 34+ messages in thread
From: Leo Famulari @ 2020-03-04  3:07 UTC (permalink / raw)
  To: Alexey Abramov; +Cc: 39746

On Sat, Feb 22, 2020 at 09:17:55PM +0100, Alexey Abramov wrote:
> * gnu/packages/java.scm (java-openjfx-build): Add patch to the base package.
> * gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch: New
>   file. Remove hardcoded xlocale definitions.

I have the same comments as previously. We need to fix up the commit
message, add java-openjfx-web in a separate commit, and add some
description to the xlocale patch file.

Can you send a revised patch series? You can add the argument
'--subject-prefix=v2' to your `git send-email` or `git format-patch`
command to distinguish the new patches from the old ones.

Thanks!

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch.
  2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
                   ` (6 preceding siblings ...)
  2020-03-04  2:56 ` [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Leo Famulari
@ 2020-03-05 19:09 ` Björn Höfling
  2020-03-05 20:10   ` Alexey Abramov
  2020-03-05 21:35   ` Björn Höfling
  2020-03-08 19:40 ` [bug#39742] [v2] " Alexey Abramov
  8 siblings, 2 replies; 34+ messages in thread
From: Björn Höfling @ 2020-03-05 19:09 UTC (permalink / raw)
  To: Alexey Abramov; +Cc: Julien Lepiller, 39742, Leo Famulari

[-- Attachment #1: Type: text/plain, Size: 3147 bytes --]

Hi Alexey,

On Sat, 22 Feb 2020 21:17:49 +0100
Alexey Abramov <levenson@mmer.org> wrote:

> * gnu/packages/java.scm: Add patch
> * gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch:
> New file. Allows you to run gradlew to run properly. Useful for
> debugging. ---

This sentence sounds suspicious :-)

In Guix, we build everything from source. If we need a compiler,
library, or build-tool, we build that also from source.

Here, the problem is that:

gradle/wrapper/gradle-wrapper.jar

is a binary JAR-file included in the sources, which is used by the
'gradlew' script. This jar-file should not be part of the original
sources used to to compile this package.

Whenever sources contain unwanted binaries, we use 'snippets' to remove
them before doing any further steps. You will find them in many places
in the java.scm file, just search for 'snippet', for example in the
package java-cisd-jhdf5.

For using gradle, we need to compile gradle from sources, but this is
very hard, there are some bootstrapping problems involed in this.

So, first we should first snipp away the jar-files from the original
java-openjfx-build package by Julien.

And second, I hope you don't rely on the gradle build in any way
here :-)

Björn

>  gnu/packages/java.scm                              |  3 ++-
>  .../java-openjfx-build-get_guix_jdk_version.patch  | 14
> ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
>  create mode 100644
> gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
> 
> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
> index 9371901e1f..01541ee419 100644
> --- a/gnu/packages/java.scm
> +++ b/gnu/packages/java.scm
> @@ -2355,7 +2355,8 @@ new Date();"))
>                (file-name (string-append name "-" version
> "-checkout")) (sha256
>                 (base32
> -
> "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))))
> +
> "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
> +              (patches (search-patches
> "java-openjfx-build-get_guix_jdk_version.patch")))) (build-system
> ant-build-system) (arguments
>       `(#:jar-name "java-openjfx.jar"
> diff --git
> a/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
> b/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
> new file mode 100644 index 0000000000..214ef9949c --- /dev/null
> +++
> b/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
> @@ -0,0 +1,14 @@ +--- a/build.gradle
> ++++ b/build.gradle
> +@@ -742,9 +742,9 @@
> +     if (inStream.readLine() != null) {
> +         String v = inStream.readLine();
> +         if (v != null) {
> +-            int ib = v.indexOf(" (build ");
> ++            int ib = v.indexOf(" (guix build ");
> +             if (ib != -1) {
> +-                String ver = v.substring(ib + 8, v.size() - 1);
> ++                String ver = v.substring(ib + 13, v.size() - 1);
> + 
> +                 defineProperty("jdkRuntimeVersion", ver)
> +                 defineProperty("jdkVersion",
> jdkRuntimeVersion.split("-")[0])


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch.
  2020-03-05 19:09 ` Björn Höfling
@ 2020-03-05 20:10   ` Alexey Abramov
  2020-03-05 21:35   ` Björn Höfling
  1 sibling, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-05 20:10 UTC (permalink / raw)
  To: Björn Höfling; +Cc: Julien Lepiller, 39742, Leo Famulari

Hi,

I have been trying to compile it so many times, so I patched the file for 
easy debugging )

I traced some confusing parts of a build.gradle using gradlew ...  
--verbose to translate it in Scheme.


Alexey

On March 5, 2020 19:38:40 Björn Höfling <bjoern.hoefling@bjoernhoefling.de> 
wrote:

> Hi Alexey,
>
> On Sat, 22 Feb 2020 21:17:49 +0100
> Alexey Abramov <levenson@mmer.org> wrote:
>
>> * gnu/packages/java.scm: Add patch
>> * gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch:
>> New file. Allows you to run gradlew to run properly. Useful for
>> debugging. ---
>
> This sentence sounds suspicious :-)
>
> In Guix, we build everything from source. If we need a compiler,
> library, or build-tool, we build that also from source.
>
> Here, the problem is that:
>
> gradle/wrapper/gradle-wrapper.jar
>
> is a binary JAR-file included in the sources, which is used by the
> 'gradlew' script. This jar-file should not be part of the original
> sources used to to compile this package.
>
> Whenever sources contain unwanted binaries, we use 'snippets' to remove
> them before doing any further steps. You will find them in many places
> in the java.scm file, just search for 'snippet', for example in the
> package java-cisd-jhdf5.
>
> For using gradle, we need to compile gradle from sources, but this is
> very hard, there are some bootstrapping problems involed in this.
>
> So, first we should first snipp away the jar-files from the original
> java-openjfx-build package by Julien.
>
> And second, I hope you don't rely on the gradle build in any way
> here :-)
>
> Björn
>
>> gnu/packages/java.scm                              |  3 ++-
>> .../java-openjfx-build-get_guix_jdk_version.patch  | 14
>> ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
>> create mode 100644
>> gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
>>
>> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
>> index 9371901e1f..01541ee419 100644
>> --- a/gnu/packages/java.scm
>> +++ b/gnu/packages/java.scm
>> @@ -2355,7 +2355,8 @@ new Date();"))
>>       (file-name (string-append name "-" version
>> "-checkout")) (sha256
>>        (base32
>> -
>> "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))))
>> +
>> "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
>> +              (patches (search-patches
>> "java-openjfx-build-get_guix_jdk_version.patch")))) (build-system
>> ant-build-system) (arguments
>> `(#:jar-name "java-openjfx.jar"
>> diff --git
>> a/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
>> b/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
>> new file mode 100644 index 0000000000..214ef9949c --- /dev/null
>> +++
>> b/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
>> @@ -0,0 +1,14 @@ +--- a/build.gradle
>> ++++ b/build.gradle
>> +@@ -742,9 +742,9 @@
>> +     if (inStream.readLine() != null) {
>> +         String v = inStream.readLine();
>> +         if (v != null) {
>> +-            int ib = v.indexOf(" (build ");
>> ++            int ib = v.indexOf(" (guix build ");
>> +             if (ib != -1) {
>> +-                String ver = v.substring(ib + 8, v.size() - 1);
>> ++                String ver = v.substring(ib + 13, v.size() - 1);
>> +
>> +                 defineProperty("jdkRuntimeVersion", ver)
>> +                 defineProperty("jdkVersion",
>> jdkRuntimeVersion.split("-")[0])

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch.
  2020-03-04  2:56 ` [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Leo Famulari
@ 2020-03-05 20:42   ` Alexey Abramov
  0 siblings, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-05 20:42 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 39742


Many thanks! I will fix these in the next patches.

Alexey

On March 4, 2020 03:25:36 Leo Famulari <leo@famulari.name> wrote:

> Hi,
>
> Thanks for these patches and sorry for the delay in review! There are a
> lot of patches and it takes a while to get through them.
>
> On Sat, Feb 22, 2020 at 09:17:49PM +0100, Alexey Abramov wrote:
>> * gnu/packages/java.scm: Add patch
>> * gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch: New
>> file. Allows you to run gradlew to run properly. Useful for debugging.
>
> The commit message needs a couple changes, to something like this:
>
> ------
> * gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/java.scm (java-openjfx-build)[source]: Use it.
> ------
>
> We don't need to describe the patch in the commit message. Instead, we
> explain it in a comment at the beginning of the patch file itself. This
> is easier for the people that will read the patch later. The comment
> should explain what the patch does and where it came from, including
> links to bug reports and external patch sources, if they exist.
>
> We need to register the new patch file in 'gnu/local.mk', so that it
> gets distributed in the Guix release process.
>
> And finally, we need to name the package variable (java-openjfx-build)
> that the patch is being used by.
>
> Here is an example from an older commit:
>
> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=ca5e404f9a1ff81a38a32578c9c3a6c866482a9a

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch.
  2020-03-05 19:09 ` Björn Höfling
  2020-03-05 20:10   ` Alexey Abramov
@ 2020-03-05 21:35   ` Björn Höfling
  1 sibling, 0 replies; 34+ messages in thread
From: Björn Höfling @ 2020-03-05 21:35 UTC (permalink / raw)
  To: Alexey Abramov; +Cc: Julien Lepiller, 39742, Leo Famulari

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

On Thu, 5 Mar 2020 20:09:25 +0100
Björn Höfling <bjoern.hoefling@bjoernhoefling.de> wrote:

> Here, the problem is that:
> 
> gradle/wrapper/gradle-wrapper.jar

[..]

> So, first we should first snipp away the jar-files from the original
> java-openjfx-build package by Julien.

I fixed that in the java-openjfx-build package under commit:

2c2b1ef85448681d858f447ac6fed6679a95209f

 
Björn


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39742] [v2] gnu: java-openjfx-build: Add helpful patch.
  2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
                   ` (7 preceding siblings ...)
  2020-03-05 19:09 ` Björn Höfling
@ 2020-03-08 19:40 ` Alexey Abramov
  2020-03-15 18:19   ` bug#39742: " Leo Famulari
  8 siblings, 1 reply; 34+ messages in thread
From: Alexey Abramov @ 2020-03-08 19:40 UTC (permalink / raw)
  To: 39742; +Cc: Alexey Abramov

* gnu/packages/java.scm (java-openjfx-build)[source]: Use it.
* gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/java.scm                         |  3 +-
 ...a-openjfx-build-get_guix_jdk_version.patch | 37 +++++++++++++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index f6c56ceb28..0bcbde7301 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1033,6 +1033,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch	\
   %D%/packages/patches/java-commons-collections-fix-java8.patch \
   %D%/packages/patches/java-jeromq-fix-tests.patch		\
+  %D%/packages/patches/java-openjfx-build-get_guix_jdk_version.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 5229eeda06..a46d4013d8 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2361,7 +2361,8 @@ new Date();"))
                   #t))
               (sha256
                (base32
-                "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))))
+                "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
+              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
diff --git a/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch b/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
new file mode 100644
index 0000000000..4ebdadc671
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-get_guix_jdk_version.patch
@@ -0,0 +1,37 @@
+From d156313340d3edcd78751ea8ed5e66c7668275c3 Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Sun, 8 Mar 2020 20:07:22 +0100
+Subject: [PATCH] openjfx: Determine the version of Java in JDK_HOME
+
+Icedtea contains guix in its version, so build.gradle failes to run. Openjfx
+packaging is not trivial, so you will probably need to try build it with
+gradlew.
+
+---
+ build.gradle | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/build.gradle b/build.gradle
+index df82f63..2c626cd 100644
+--- a/build.gradle
++++ b/build.gradle
+@@ -742,9 +742,9 @@ try {
+     if (inStream.readLine() != null) {
+         String v = inStream.readLine();
+         if (v != null) {
+-            int ib = v.indexOf(" (build ");
++            int ib = v.indexOf(" (guix build ");
+             if (ib != -1) {
+-                String ver = v.substring(ib + 8, v.size() - 1);
++                String ver = v.substring(ib + 13, v.size() - 1);
+ 
+                 defineProperty("jdkRuntimeVersion", ver)
+                 defineProperty("jdkVersion", jdkRuntimeVersion.split("-")[0])
+@@ -3540,4 +3540,3 @@ compileTargets { t ->
+         }
+     )
+ }
+-
+-- 
+2.24.1
+
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39747] [v2] gnu: java-openjfx-graphics: Implement a complete compilation.
  2020-02-22 20:17 ` [bug#39747] [PATCH 3/7] gnu: java-openjfx-graphics: Implement a complete compilation Alexey Abramov
  2020-03-04  3:00   ` Leo Famulari
@ 2020-03-09 12:46   ` Alexey Abramov
  1 sibling, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-09 12:46 UTC (permalink / raw)
  To: 39747; +Cc: Alexey Abramov

---
 gnu/packages/java.scm | 659 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 651 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index d2d481fb5e..349b22419a 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -53,6 +53,7 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gl)
+  #:use-module (gnu packages glib)
   #:use-module (gnu packages ghostscript) ;lcms
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages groovy)
@@ -2429,16 +2430,658 @@ distribution.")))
     (arguments
      `(#:jar-name "java-openjfx-graphics.jar"
        #:source-dir "modules/graphics/src/main/java"
-       #:tests? #f; require X
-       #:test-dir "modules/graphics/src/test"))
+       #:tests? #f               ; requires X
+       #:test-dir "modules/graphics/src/test"
+       #:test-include (list "**/*Test.*")
+       #:modules ((guix build ant-build-system)
+                  (guix build utils)
+                  (srfi srfi-1)
+                  (srfi srfi-26)
+                  (ice-9 regex)
+                  (ice-9 match))
+       #:phases
+       (let* ((jdk (assoc-ref %build-inputs "jdk"))
+              (javac/h-flags
+               `(;; When javac is compiling code it doesn't link
+                 ;; against rt.jar by default. Instead it uses special
+                 ;; symbol file lib/ct.sym with class stubs.
+                 ;; Surprisingly this file contains many but not *all*
+                 ;; of internal classes.
+                 "-XDignore.symbol.file"
+                 ;; It’s an internal option for JDK 1.7+ that prevents
+                 ;; the compiler from sharing a table that will never
+                 ;; be reused. When shared, it can’t be garbage
+                 ;; collected, continues to accumulate data, and
+                 ;; therefore wastes memory.
+                 "-XDuseUnsharedTable=true"))
+              (common-flags
+               `("-fno-strict-aliasing" "-fPIC" "-fno-omit-frame-pointer" ;; optimization flags
+                 "-fstack-protector"
+                 "-W" "-Wall" "-Wno-unused" "-Wno-parentheses" "-Werror=implicit-function-declaration"))
+              (cc-flags
+               `(,@common-flags "-c" "-ffunction-sections" "-fdata-sections"
+                                "-I" ,(string-append jdk "/include")
+                                "-I" ,(string-append jdk "/include/linux")))
+              (link-flags
+               `("-static-libgcc" "-static-libstdc++" "-shared" ,@common-flags
+                 "-z" "relro"
+                 "-Wl,--gc-sections"))
+              (java-aux-class?
+               (lambda (class)
+                 (string-match "\\$[0-9]+.class" class)))
+              (java-list-classes
+               (lambda (path)
+                 ;; For each .java file we need to figure out what
+                 ;; class the .java file belongs in and convert it to a
+                 ;; class name.
+                 (filter-map
+                  (lambda (class)
+                    (let* ((rx (make-regexp (string-append path file-name-separator-string "?")))
+                           (class (string-drop-right class (string-length ".class")))
+                           (class (match:suffix (regexp-exec rx class))))
+                      (if (java-aux-class? class)
+                          #f
+                          (string-join (string-split class #\/) "."))))
+                  (find-files path "\\.class$")))))
+         (modify-phases %standard-phases
+
+           (replace 'build
+             (lambda _
+               ;; Do not mix different classes. There will be more stuff in build/classes
+               (invoke "ant" "compile" "-Dclasses.dir=modules/graphics/build/classes/java/main")
+               #t))
+
+           (add-after 'build 'chdir-to-a-module-directory
+             (lambda _
+               (chdir (string-append (getcwd) "/modules/graphics"))
+               #t))
+
+           (add-after 'chdir-to-a-module-directory 'compile-prism-compilers
+             (lambda _
+               (let ((prism-compilers-classes "build/classes/jsl-compilers/prism")
+                     (prism-src "src/main/jsl-prism/"))
+                 (mkdir-p prism-compilers-classes)
+                 (apply invoke `("javac"
+                                 "-d" ,prism-compilers-classes
+                                 ,@javac/h-flags
+                                 ,@(find-files prism-src "\\.java"))))
+               #t))
+
+           (add-after 'compile-prism-compilers 'generate-prism-shaders
+             (lambda _
+               (let ((prism-compilers-classes "build/classes/jsl-compilers/prism")
+                     (prism-src "src/main/jsl-prism/")
+                     (prism-gen-src "build/generated-src/jsl-prism"))
+                 (mkdir-p prism-gen-src)
+                 (for-each (lambda (file)
+                             (apply invoke `("java"
+                                             "-cp" ,(string-join (list
+                                                                  ;; For CompileJSL
+                                                                  prism-compilers-classes
+                                                                  ;; jsl files are there
+                                                                  prism-src
+                                                                  (getenv "CLASSPATH"))
+                                                                 ":")
+                                             "CompileJSL"
+                                             "-i" ,prism-src
+                                             "-o" ,prism-gen-src
+                                             "-t"
+                                             "-pkg" "com/sun/prism"
+                                             "-d3d"
+                                             "-es2"
+                                             "-name" ,file)))
+                           (find-files prism-src "\\.jsl$")))
+               #t))
+
+           (add-after 'generate-prism-shaders 'compile-prism-shaders
+             (lambda _
+               (let* ((classes "build/classes/java/main")
+                      (prism-classes "build/classes/jsl-prism")
+                      (prism-gen-src "build/generated-src/jsl-prism")
+                      (prism-gen-shaders-src (string-append prism-gen-src "/com/sun/prism/shader")))
+                 (mkdir-p prism-classes)
+                 (apply invoke `("javac"
+                                 "-d" ,prism-classes
+                                 "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                 ,@javac/h-flags
+                                 ,@(find-files prism-gen-shaders-src))))
+               #t))
+
+           (add-after 'compile-prism-shaders 'compile-decora-compilers
+             (lambda _
+               (let ((classes "build/classes/java/main")
+                     (decora-compilers-classes "build/classes/jsl-compilers/decora")
+                     (decora-src "src/main/jsl-decora/"))
+                 (mkdir-p decora-compilers-classes)
+                 (apply invoke `("javac"
+                                 "-d" ,decora-compilers-classes
+                                 "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                 ,@javac/h-flags
+                                 ,@(find-files decora-src "\\.java"))))
+               #t))
+
+           (add-after 'compile-decora-compilers 'generate-decora-shaders
+             (lambda _
+               (let ((classes "build/classes/java/main")
+                     (decora-classes "build/classes/jsl-decora/")
+                     (decora-compilers-classes "build/classes/jsl-compilers/decora")
+                     (decora-gen-src "build/generated-src/jsl-decora")
+                     (decora-src "src/main/jsl-decora/")
+                     (decora-components '([(file-name . "ColorAdjust")
+                                           (generator . "CompileJSL")
+                                           (outputs . "-all")]
+                                          [(file-name . "Brightpass")
+                                           (generator . "CompileJSL")
+                                           (outputs . "-all")]
+                                          [(file-name . "SepiaTone")
+                                           (generator . "CompileJSL")
+                                           (outputs . "-all")]
+                                          [(file-name . "PerspectiveTransform")
+                                           (generator . "CompileJSL")
+                                           (outputs . "-all")]
+                                          [(file-name . "DisplacementMap")
+                                           (generator . "CompileJSL")
+                                           (outputs . "-all")]
+                                          [(file-name . "InvertMask")
+                                           (generator . "CompileJSL")
+                                           (outputs . "-all")]
+                                          [(file-name . "Blend")
+                                           (generator . "CompileBlend")
+                                           (outputs . "-all")]
+                                          [(file-name . "PhongLighting")
+                                           (generator . "CompilePhong")
+                                           (outputs . "-all")]
+                                          [(file-name . "LinearConvolve")
+                                           (generator . "CompileLinearConvolve")
+                                           (outputs . "-hw")]
+                                          [(file-name . "LinearConvolveShadow")
+                                           (generator . "CompileLinearConvolve")
+                                           (outputs . "-hw")])))
+                 (mkdir-p decora-gen-src)
+                 (for-each (match-lambda
+                             ((('file-name . file-name)
+                               ('generator . generator)
+                               ('outputs . outputs))
+                              (apply invoke `("java"
+                                              "-cp" ,(string-join (cons* classes
+                                                                         decora-src
+                                                                         ;; CompileJSL
+                                                                         decora-compilers-classes
+                                                                         decora-classes
+                                                                         ;; We need resources from the build
+                                                                         "../../buildSrc/src/main/resources"
+                                                                         (list (getenv "CLASSPATH")))
+                                                                  ":")
+                                              ,generator
+                                              "-i" ,decora-src
+                                              "-o" ,decora-gen-src
+                                              "-t"
+                                              "-pkg" "com/sun/scenario/effect"
+                                              ,outputs
+                                              ,file-name))))
+                           decora-components)
+                 #t)))
+
+           (add-after 'generate-decora-shaders 'compile-decora-shaders
+             (lambda _
+               (let ((classes "build/classes/java/main")
+                     (decora-classes "build/classes/jsl-decora/")
+                     (decora-gen-src "build/generated-src/jsl-decora"))
+                 (mkdir-p decora-classes)
+                 (apply invoke `("javac"
+                                 "-d" ,decora-classes
+                                 "-cp" ,classes
+                                 ,@javac/h-flags
+                                 ,@(find-files decora-gen-src "\\.java$"))))
+               #t))
+
+           (add-after 'compile-decora-shaders 'compile-decora-native-lib
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((classes "build/classes/java/main")
+                      (decora-gen-headers "build/generated-src/headers/jsl-decora")
+                      (decora-gen-src "build/generated-src/jsl-decora")
+                      (decora-native-lib "build/libs/jsl-decora/linux/libdecora_sse.so")
+                      (decora-native-obj "build/native/jsl-decora/linux")
+                      (decora-native-src "src/main/native-decora")
+                      (decora-src "src/main/jsl-decora/")
+                      (decora-classes "build/classes/jsl-decora/")
+                      (decora-cc-flags `(,@cc-flags "-ffast-math")))
+                 (mkdir-p decora-gen-headers)
+                 (apply invoke `("javah"
+                                 "-d" ,decora-gen-headers
+                                 "-cp" ,(string-join (list classes decora-classes) ":")
+                                 ,@javac/h-flags
+                                 ,@(filter (cut string-prefix? "com.sun.scenario.effect.impl.sw.sse" <>)
+                                           (append (java-list-classes classes)
+                                                   (java-list-classes decora-classes)))))
+                 (mkdir-p decora-native-obj)
+                 (for-each (lambda (cc)
+                             (apply invoke `("gcc"
+                                             ,@decora-cc-flags
+                                             "-I" ,decora-gen-headers
+                                             "-I" ,decora-gen-src
+                                             "-I" ,decora-native-src
+                                             "-o" ,(string-append decora-native-obj  "/"
+                                                                  (basename cc ".cc") ".obj")
+                                             ,cc)))
+                           (append (find-files decora-gen-src "\\.cc$")
+                                   (find-files decora-native-src "\\.cc$")))
+                 (mkdir-p (dirname decora-native-lib))
+                 (apply invoke `("g++"
+                                 "-o" ,decora-native-lib
+                                 ,@link-flags
+                                 ,@(find-files decora-native-obj "\\.obj$"))))
+               #t))
+
+           (add-after 'compile-decora-native-lib 'compile-linux-font-native-lib
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((classes "build/classes/java/main")
+                      (font-gen-headers "build/generated-src/headers/font/linux")
+                      (font-native-lib "build/libs/font/linux/libjavafx_font.so")
+                      (font-native-obj "build/native/font/linux")
+                      (font-native-src "src/main/native-font")
+                      ;;
+                      (font-cc-flags `("-DJFXFONT_PLUS" ,@cc-flags)))
+                 (mkdir-p font-gen-headers)
+                 (apply invoke `("javah"
+                                 "-d" ,font-gen-headers
+                                 "-cp" ,classes
+                                 ,@javac/h-flags
+                                 ,@(filter (lambda (class)
+                                             (or (string-prefix? "com.sun.javafx.font" class)
+                                                 (string-prefix? "com.sun.javafx.text" class)))
+                                           (java-list-classes classes))))
+                 (mkdir-p font-native-obj)
+                 (for-each (lambda (cc)
+                             (apply invoke `("gcc"
+                                             ,@font-cc-flags
+                                             "-I" ,font-gen-headers
+                                             "-I" ,font-native-src
+                                             "-o" ,(string-append font-native-obj "/"
+                                                                  (basename cc ".c") ".obj")
+                                             ,cc)))
+                           (find-files font-native-src "\\.c$"))
+                 (mkdir-p (dirname font-native-lib))
+                 (apply invoke `("g++"
+                                 "-o" ,font-native-lib
+                                 ,@link-flags
+                                 ,@(find-files font-native-obj "\\.obj$"))))
+               #t))
+
+           (add-after 'compile-linux-font-native-lib 'compile-linux-font-freetype
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((classes "build/classes/java/main")
+                      ;;
+                      (font-freetype-gen-headers "build/generated-src/headers/fontFreetype/linux")
+                      (font-freetype-native-lib "build/libs/fontFreetype/linux/libjavafx_font_freetype.so")
+                      (font-freetype-native-obj "build/native/fontFreetype/linux")
+                      (font-freetype-native-src "src/main/native-font/freetype.c")
+                      (font-freetype-cc-flags `("-DJFXFONT_PLUS" "-D_ENABLE_PANGO"
+                                                "$(pkg-config --cflags freetype2)" ,@cc-flags))
+                      (font-freetype-link-flags `("$(pkg-config --libs freetype2)" ,@link-flags)))
+                 (mkdir-p font-freetype-gen-headers)
+                 (apply invoke `("javah"
+                                 "-d" ,font-freetype-gen-headers
+                                 "-cp" ,classes
+                                 ,@javac/h-flags
+                                 ,@(filter (cut string-prefix? "com.sun.javafx.font.freetype.OSFreetype" <>)
+                                           (java-list-classes classes))))
+                 (mkdir-p font-freetype-native-obj)
+                 (invoke "bash" "-c"
+                         (string-join `("gcc"
+                                        ,@font-freetype-cc-flags
+                                        "-I" ,font-freetype-gen-headers
+                                        "-I" ,(dirname font-freetype-native-src)
+                                        "-o" ,(string-append font-freetype-native-obj "/"
+                                                             (basename font-freetype-native-src ".c") ".obj")
+                                        ,font-freetype-native-src)))
+                 (mkdir-p (dirname font-freetype-native-lib))
+                 (invoke "bash" "-c"
+                         (string-join `("g++"
+                                        "-o" ,font-freetype-native-lib
+                                        ,@font-freetype-link-flags
+                                        ,@(find-files font-freetype-native-obj "\\.obj$"))))
+                 #t)))
+
+           (add-after 'compile-linux-font-freetype 'compile-linux-font-pango-lib
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((classes "build/classes/java/main")
+                      (font-pango-gen-headers "build/generated-src/headers/fontPango/linux")
+                      (font-pango-native-lib "build/libs/fontPango/linux/libjavafx_font_pango.so")
+                      (font-pango-native-obj "build/native/fontPango/linux")
+                      (font-pango-native-src "src/main/native-font/pango.c")
+                      (font-pango-cc-flags `("-DJFXFONT_PLUS" "-D_ENABLE_PANGO"
+                                             "$(pkg-config --cflags pangoft2)" ,@cc-flags))
+                      (font-pango-link-flags `("$(pkg-config --libs pangoft2)" ,@link-flags)))
+                 (mkdir-p font-pango-gen-headers)
+                 (apply invoke `("javah"
+                                 "-d" ,font-pango-gen-headers
+                                 "-cp" ,classes
+                                 ,@javac/h-flags
+                                 ,@(filter (cut string-prefix? "com.sun.javafx.font.freetype.OSPango" <>)
+                                           (java-list-classes classes))))
+                 (mkdir-p font-pango-native-obj)
+                 (invoke "bash" "-c"
+                         (string-join `("gcc"
+                                        ,@font-pango-cc-flags
+                                        "-I" ,font-pango-gen-headers
+                                        "-I" ,(dirname font-pango-native-src)
+                                        "-o" ,(string-append font-pango-native-obj "/"
+                                                             (basename font-pango-native-src ".c") ".obj")
+                                        ,font-pango-native-src)))
+                 (mkdir-p (dirname font-pango-native-lib))
+                 (invoke "bash" "-c"
+                         (string-join `("g++"
+                                        ,@font-pango-link-flags
+                                        "-o" ,font-pango-native-lib
+                                        ,@(find-files font-pango-native-obj "\\.obj$")))))
+               #t))
+
+           (add-after 'compile-linux-font-pango-lib 'compile-linux-glass-lib
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((classes "build/classes/java/main")
+                      ;; glass
+                      (glass-gen-headers "build/generated-src/headers/glass/linux")
+                      (glass-native-lib "build/libs/glass/linux/libglass.so")
+                      (glass-native-obj "build/native/glass/linux/glass")
+                      (glass-native-src "src/main/native-glass/gtk/launcher.c")
+                      (glass-cc-flags
+                       `(,@cc-flags
+                         "$(pkg-config --cflags glib-2.0 gdk-2.0 gtk+-2.0 gthread-2.0 xtst)"
+                         "-Werror"))
+                      (glass-link-flags
+                       `(,@link-flags "$(pkg-config --libs x11)" "-ldl"))
+                      ;; glass-gtk2
+                      (gtk (assoc-ref inputs "gtk"))
+                      (glass-gtk2-native-obj "build/native/glass/linux/glassgtk2")
+                      (glass-gtk2-native-src (dirname glass-native-src))
+                      (glass-gtk2-native-lib "build/libs/glass/linux/libglassgtk2.so")
+                      (glass-gtk2-cc-flags
+                       `(,@cc-flags
+                         "$(pkg-config --cflags gtk+-2.0 gthread-2.0 xtst)"
+                         "-Werror"))
+                      (glass-gtk2-link-flags
+                       `(,@link-flags
+                         "$(pkg-config --libs gtk+-2.0 gthread-2.0 xtst)"))
+                      ;; glass-gtk3
+                      (gtk3 (assoc-ref inputs "gtk3"))
+                      (glass-gtk3-native-obj "build/native/glass/linux/glassgtk3")
+                      (glass-gtk3-native-src (dirname glass-native-src))
+                      (glass-gtk3-native-lib "build/libs/glass/linux/libglassgtk3.so")
+                      (glass-gtk3-cc-flags
+                       `(,@cc-flags
+                         "$(pkg-config --cflags gtk+-3.0 gthread-2.0 xtst)"
+                         "-Wno-deprecated-declarations" "-Werror"))
+                      (glass-gtk3-link-flags
+                       `(,@link-flags "$(pkg-config --libs gtk+-3.0 gthread-2.0 xtst)")))
+                 ;; glass
+                 (mkdir-p glass-gen-headers)
+                 (apply invoke `("javah"
+                                 "-d" ,glass-gen-headers
+                                 "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                 ,@javac/h-flags
+                                 ,@(filter (lambda (class)
+                                             (or (string-prefix? "com.sun.glass.events" class)
+                                                 (string-prefix? "com.sun.glass.ui.gtk" class)
+                                                 (string-prefix? "com.sun.glass.ui" class)))
+                                           (java-list-classes classes))))
+                 (mkdir-p glass-native-obj)
+                 (invoke "bash" "-c"
+                         (string-join `("gcc"
+                                        ,@glass-cc-flags
+                                        "-I" ,glass-gen-headers
+                                        "-I" ,(dirname glass-native-src)
+                                        "-o" ,(string-append glass-native-obj "/"
+                                                             (basename glass-native-src ".c") ".obj")
+                                        ,glass-native-src)))
+                 (mkdir-p (dirname glass-native-lib))
+                 (invoke "bash" "-c"
+                         (string-join `("g++"
+                                        ,@glass-link-flags
+                                        "-o" ,glass-native-lib
+                                        ,@(find-files glass-native-obj "\\.obj$"))))
+                 ;; gtk2
+                 (mkdir-p glass-gtk2-native-obj)
+                 (for-each (lambda (cpp)
+                             (invoke "bash" "-c"
+                                     (string-join `("gcc"
+                                                    ,@glass-gtk2-cc-flags
+                                                    "-I" ,glass-gen-headers
+                                                    "-o" ,(string-append glass-gtk2-native-obj "/"
+                                                                         (basename cpp ".cpp") ".obj")
+                                                    ,cpp))))
+                           (find-files glass-gtk2-native-src "\\.cpp$"))
+                 (mkdir-p (dirname glass-gtk2-native-lib))
+                 (invoke "bash" "-c"
+                         (string-join `("g++"
+                                        ,@glass-gtk2-link-flags
+                                        "-o" ,glass-gtk2-native-lib
+                                        ,@(find-files glass-gtk2-native-obj "\\.obj$"))))
+                 ;; gtk3
+                 (mkdir-p glass-gtk3-native-obj)
+                 (for-each (lambda (cpp)
+                             (invoke "bash" "-c"
+                                     (string-join `("gcc"
+                                                    ,@glass-gtk3-cc-flags
+                                                    "-I" ,glass-gen-headers
+                                                    "-o" ,(string-append glass-gtk3-native-obj "/"
+                                                                         (basename cpp ".cpp") ".obj")
+                                                    ,cpp))))
+                           (find-files glass-gtk3-native-src "\\.cpp$"))
+                 (mkdir-p (dirname glass-gtk3-native-lib))
+                 (invoke "bash" "-c"
+                         (string-join `("g++"
+                                        ,@glass-gtk3-link-flags
+                                        "-o" ,glass-gtk3-native-lib
+                                        ,@(find-files glass-gtk3-native-obj "\\.obj$")))))
+               #t))
+
+           (add-after 'compile-linux-glass-lib  'compile-linux-iio
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((classes "build/classes/java/main")
+                      (iio-gen-headers "build/generated-src/headers/iio/linux")
+                      (iio-native-lib "build/libs/iio/linux/libjavafx_iio.so")
+                      (iio-native-obj "build/native/iio/linux")
+                      (iio-native-src "src/main/native-iio")
+                      (iio-cc-flags cc-flags)
+                      (iio-link-flags link-flags))
+                 (mkdir-p iio-gen-headers)
+                 (apply invoke `("javah"
+                                 "-d" ,iio-gen-headers
+                                 "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                 ,@javac/h-flags
+                                 ,@(filter (cut string-prefix? "com.sun.javafx.iio" <>)
+                                           (java-list-classes classes))))
+                 (mkdir-p iio-native-obj)
+                 (for-each (lambda (c)
+                             (invoke "bash" "-c"
+                                     (string-join `("gcc"
+                                                    ,@iio-cc-flags
+                                                    "-I" ,iio-gen-headers
+                                                    "-o" ,(string-append iio-native-obj "/"
+                                                                         (basename c ".c") ".obj")
+                                                    ,c))))
+                           (find-files iio-native-src "\\.c$"))
+                 (mkdir-p (dirname iio-native-lib))
+                 (invoke "bash" "-c"
+                         (string-join `("g++"
+                                        ,@iio-link-flags
+                                        "-o" ,iio-native-lib
+                                        ,@(find-files iio-native-obj "\\.obj$"))))
+                 #t)))
+
+           (add-after 'compile-linux-iio 'compile-linux-prism
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((classes "build/classes/java/main")
+                      (prism-gen-headers "build/generated-src/headers/prism/linux")
+                      (prism-native-lib "build/libs/prism/linux/libprism_common.so")
+                      (prism-native-obj "build/native/prism/linux")
+                      (prism-native-src "src/main/native-prism")
+                      (prism-cc-flags `(,@cc-flags "-DINLINE=inline"))
+                      (prism-link-flags link-flags))
+                 (mkdir-p prism-gen-headers)
+                 (apply invoke `("javah"
+                                 "-d" ,prism-gen-headers
+                                 "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                 ,@javac/h-flags
+                                 ,@(filter (lambda (class)
+                                             (or (string-prefix? "com.sun.prism.impl" class)
+                                                 (string-prefix? "com.sun.prism.PresentableState" class)))
+                                           (java-list-classes classes))))
+                 (mkdir-p prism-native-obj)
+                 (for-each (lambda (c)
+                             (invoke "bash" "-c"
+                                     (string-join `("gcc"
+                                                    ,@prism-cc-flags
+                                                    "-I" ,prism-gen-headers
+                                                    "-I" ,prism-native-src
+                                                    "-o" ,(string-append prism-native-obj "/"
+                                                                         (basename c ".c") ".obj")
+                                                    ,c))))
+                           (find-files prism-native-obj "\\.c$"))
+                 (mkdir-p (dirname prism-native-lib))
+                 (invoke "bash" "-c"
+                         (string-join `("g++"
+                                        ,@prism-link-flags
+                                        "-o" ,prism-native-lib
+                                        ,@(find-files prism-native-obj "\\.obj$"))))
+                 #t)))
+
+           (add-after 'compile-linux-prism 'compile-linux-prism-es2
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((classes "build/classes/java/main")
+                      (prism-es2-gen-headers "build/generated-src/headers/prismES2/linux")
+                      (prism-es2-native-lib "build/libs/prism/linux/libprism_es2.so")
+                      (prism-es2-native-obj "build/native/prismES2/linux")
+                      (prism-es2-native-src "src/main/native-prism-es2")
+                      (prism-es2-cc-flags `("-DLINUX" ,@cc-flags))
+                      (prism-es2-link-flags
+                       `(,@link-flags "$(pkg-config --libs x11 xxf86vm gl)"))
+                      ;; We need all *.c files in the root and only those
+                      ;; which are in a specific directories.
+                      (filter-src
+                       (lambda (abs _)
+                         (or (regexp-exec (make-regexp (string-append prism-es2-native-src "[^/]*\\.c$"))
+                                          abs)
+                             (regexp-exec (make-regexp (string-append prism-es2-native-src "(x11/|GL/)"))
+                                          abs)))))
+                 (mkdir-p prism-es2-gen-headers)
+                 (apply invoke `("javah"
+                                 "-d" ,prism-es2-gen-headers
+                                 "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                 ,@javac/h-flags
+                                 ,@(filter (cut string-prefix? "com.sun.prism.es2" <>)
+                                           (java-list-classes classes))))
+                 (mkdir-p prism-es2-native-obj)
+                 (for-each (lambda (c)
+                             (apply invoke `("gcc"
+                                             ,@prism-es2-cc-flags
+                                             "-I" ,glass-native-src
+                                             "-I" ,prism-es2-gen-headers
+                                             "-I" ,prism-es2-native-src
+                                             "-I" ,(string-append prism-es2-native-src "/GL")
+                                             "-I" ,(string-append prism-es2-native-src "/x11")
+                                             "-o" ,(string-append prism-es2-native-obj "/"
+                                                                  (basename c ".c") ".obj")
+                                             ,c)))
+                           (find-files prism-es2-native-src filter-src))
+                 (mkdir-p (dirname prism-es2-native-lib))
+                 (invoke "bash" "-c"
+                         (string-join `("g++"
+                                        ,@prism-es2-link-flags
+                                        "-o" ,prism-es2-native-lib
+                                        ,@(find-files prism-es2-native-obj "\\.obj$"))))
+                 #t)))
+
+           (add-after 'compile-linux-prism-es2 'compile-linux-prism-sw
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((classes "build/classes/java/main")
+                      (prism-sw-gen-headers "build/generated-src/headers/prismSW/linux")
+                      (prism-sw-native-lib "build/libs/prism/linux/libprism_sw.so")
+                      (prism-sw-native-obj "build/native/prismSW/linux")
+                      (prism-sw-native-src "src/main/native-prism-sw")
+                      ;;
+                      (prism-sw-cc-flags `(,@cc-flags "-DINLINE=inline"))
+                      (prism-sw-link-flags link-flags))
+                 (mkdir-p prism-sw-gen-headers)
+                 (apply invoke `("javah"
+                                 "-d" ,prism-sw-gen-headers
+                                 "-cp" ,(string-append classes ":" (getenv "CLASSPATH"))
+                                 ,@javac/h-flags
+                                 ,@(filter (cut string-prefix? "com.sun.pisces" <>)
+                                           (java-list-classes classes))))
+                 (mkdir-p prism-sw-native-obj)
+                 (for-each (lambda (c)
+                             (invoke "bash" "-c"
+                                     (string-join `("gcc"
+                                                    ,@prism-sw-cc-flags
+                                                    "-I" ,prism-sw-gen-headers
+                                                    "-I" ,prism-sw-native-src
+                                                    "-o" ,(string-append prism-sw-native-obj "/"
+                                                                         (basename c ".c") ".obj")
+                                                    ,c))))
+                           (find-files prism-sw-native-src "\\.c$"))
+                 (mkdir-p (dirname prism-sw-native-lib))
+                 (apply invoke `("g++"
+                                 ,@prism-sw-link-flags
+                                 "-o" ,prism-sw-native-lib
+                                 ,@(find-files prism-sw-native-obj "\\.obj$")))
+                 #t)))
+
+           (add-before 'check 'chdir-to-root
+             (lambda _
+               (chdir (dirname (dirname (getcwd))))
+               #t))
+
+           (add-after 'chdir-to-root 'install-native
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((lib-path (string-append (assoc-ref outputs "out")
+                                              ,(match (%current-system)
+                                                 ("i686-linux"
+                                                  "/lib/i386")
+                                                 ("x86_64-linux"
+                                                  "/lib/amd64")
+                                                 ("armhf-linux"
+                                                  "/lib/arm")
+                                                 ("aarch64-linux"
+                                                  "/lib/aarch64")
+                                                 ;; We need a catch-all, dropping
+                                                 ;; '-linux' works in most cases.
+                                                 (_
+                                                  (string-append
+                                                   "/lib/"
+                                                   (string-drop-right
+                                                    (%current-system) 6)))))))
+                 (for-each (lambda (file)
+                             (install-file file lib-path))
+                           (find-files "." "\\.so$"))
+                 #t)))
+
+           (add-after 'install-native 'build-jar
+             (lambda _
+               (let* ((module (string-append (getcwd) "/modules/graphics"))
+                      (resources (string-append module "/src/main/resources"))
+                      (classes (string-append module "/build/classes/java/main")))
+                 (copy-recursively resources classes)
+
+                 (invoke "ant" "jar" (string-append "-Dclasses.dir=" classes)))
+               #t))))))
+    (native-inputs
+     `(("freetype" ,freetype)
+       ("fontconfig" ,fontconfig)
+       ("gcc" ,gcc)
+       ("glib" ,glib)
+       ("zlib" ,zlib)
+       ("gtk" ,gtk+-2)
+       ("gtk3" ,gtk+)
+       ("jpeg" ,libjpeg)
+       ("libxtst" ,libxtst)
+       ("pango" ,pango)
+       ("libpng" ,libpng)
+       ("pkg-config" ,pkg-config)))
     (propagated-inputs
      `(("java-openjfx-base" ,java-openjfx-base)
-       ("java-swt" ,java-swt)))
-    (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 contains graphics-related classes for the
-OpenJFX distribution.")))
+       ("java-swt" ,java-swt)))))
 
 (define-public java-openjfx-media
   (package (inherit java-openjfx-build)
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39747] [PATCH 3/7] gnu: java-openjfx-graphics: Implement a complete compilation.
  2020-03-04  3:00   ` Leo Famulari
@ 2020-03-09 13:08     ` levenson
  0 siblings, 0 replies; 34+ messages in thread
From: levenson @ 2020-03-09 13:08 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 39747, Alexey Abramov


I have updated the patch. 

Leo Famulari <leo@famulari.name> writes:

> On Sat, Feb 22, 2020 at 09:17:51PM +0100, Alexey Abramov wrote:
>> +           (name "java-openjfx-graphics")
>> +           (arguments
>> +            `(#:jar-name "java-openjfx-graphics.jar"
>
>> +              #:source-dir "modules/graphics/src/main/java"
>> +              #:tests? #f               ; requires X
>> +              #:test-dir "modules/graphics/src/test"
>> +              #:test-include (list "**/*Test.*")
>> +              #:modules ((guix build ant-build-system)
>> +                         (guix build utils)
>> +                         (srfi srfi-1)
>> +                         (srfi srfi-26)
>> +                         (ice-9 regex)
>> +                         (ice-9 match))
>
> [...]
>
> Wow, this might be one of the longest package definitions in Guix :)

Yeah, OpenJDK has two build instruction procedures for u8 and u9. I was
thinking about some helpers to reduce the amount of code but wasn't sure
if it's going to work/help for u9. My goal was to package davmail, so I
started packaging what I had been using to run it.

> I can't review it in detail but if it's working for you, okay. Just make
> sure to run `./pre-inst-env guix lint java-openjfx-graphics` and fix any
> cosmetic issues.

In my case it complains about:

1. Patch file name, which is added to the java-openjfx-build package. I
can rename it, but I am guessing it will start complaining on
java-openjfx-build. Bug? Or am I doing something wrong?

2. java-openjfx-build is not under Software Heritage, hence the
message.

3. Lines are too long, All lines are shorter than 120 for
sure. I would prefer to keep them as it is. It is easier to read. 

> Maybe some of the Guix Java experts can give it a closer review...

That would be great, cause I did build a lot of native libraries, but
not all of them. fontT2k for example which is a fallback library for
some fonts engines.

-- 
Alexey

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39745] [v2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8
  2020-02-22 20:17 ` [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable Alexey Abramov
  2020-03-04  3:04   ` Leo Famulari
@ 2020-03-09 16:15   ` Alexey Abramov
  2020-03-09 16:36   ` [bug#39745] [v3 1/2] " Alexey Abramov
  2020-03-11 10:36   ` [bug#39745] [v4 1/2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8 Alexey Abramov
  3 siblings, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-09 16:15 UTC (permalink / raw)
  To: 39745; +Cc: Alexey Abramov

* gnu/packages/java.scm (java-openjfx-build)[source]: Use it.
* gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch:
  New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/java.scm                         |  3 +-
 ...ld-swing-compile-JFXPanel-with-JDK-8.patch | 64 +++++++++++++++++++
 3 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 0bcbde7301..7e4554198c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1034,6 +1034,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/java-commons-collections-fix-java8.patch \
   %D%/packages/patches/java-jeromq-fix-tests.patch		\
   %D%/packages/patches/java-openjfx-build-get_guix_jdk_version.patch    \
+  %D%/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.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 349b22419a..21217b0211 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2363,7 +2363,8 @@ new Date();"))
               (sha256
                (base32
                 "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
-              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"))))
+              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"
+                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
diff --git a/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch b/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch
new file mode 100644
index 0000000000..8f222e1780
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch
@@ -0,0 +1,64 @@
+From 173e65937d9e76872df51f7ba39c9d58986dc38f Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Fri, 3 Jan 2020 01:17:45 +0100
+Subject: [PATCH] java-openjfx-build: Cannot compile JFXPanel with JDK 8
+
+In JDKu9 getDefaultScale method was removed and sun.java2d.SurfaceData class now
+has separate getDefaultScaleX() and getDefaultScaleY() methods. See
+https://bugs.openjdk.java.net/browse/JDK-8073320 for more info.
+
+Backport the missing port to build openjfx-swing package using JDKu8. For more
+info please see https://bugs.openjdk.java.net/browse/JDK-8149967
+
+---
+ .../java/javafx/embed/swing/JFXPanel.java     | 20 ++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
+index 97515e2290..614ed656b9 100644
+--- a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
++++ b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
+@@ -81,6 +81,7 @@ import sun.awt.AppContext;
+ import sun.awt.CausedFocusEvent;
+ import sun.awt.SunToolkit;
+ import sun.java2d.SunGraphics2D;
++import sun.java2d.SurfaceData;
+ import sun.util.logging.PlatformLogger;
+ import sun.util.logging.PlatformLogger.Level;
+ 
+@@ -681,6 +682,23 @@ 
+                 e.getCaret().getInsertionIndex());
+     }
+
++    // FIXME: once we move to JDK 9 as the boot JDK we should remove the
++    // reflection code from this method, consider changing it to
++    // use double rather than int, and account for the possibility of
++    // a different scale factor in X and Y.
++    private int getDefaultScale(SurfaceData surfaceData) {
++        /*
++          double scale = surfaceData.getDefaultScaleX();
++        */
++        double scale = 1;
++        try {
++            Method meth = SurfaceData.class.getMethod("getDefaultScaleX");
++            scale = (Double)meth.invoke(surfaceData);
++        } catch (Exception ex) {
++        }
++
++        return (int)Math.round(scale);
++    }
+ 
+     /**
+      * Overrides the {@link javax.swing.JComponent#paintComponent(Graphics)}
+@@ -720,7 +738,7 @@ public class JFXPanel extends JComponent {
+ 
+             int newScaleFactor = scaleFactor;
+             if (g instanceof SunGraphics2D) {
+-                newScaleFactor = ((SunGraphics2D)g).surfaceData.getDefaultScale();
++                newScaleFactor = getDefaultScale(((SunGraphics2D)g).surfaceData);
+             }
+             if (scaleFactor != newScaleFactor) {
+                 resizePixelBuffer(newScaleFactor);
+--
+2.24.1
+
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39745] [v3 1/2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8
  2020-02-22 20:17 ` [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable Alexey Abramov
  2020-03-04  3:04   ` Leo Famulari
  2020-03-09 16:15   ` [bug#39745] [v2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8 Alexey Abramov
@ 2020-03-09 16:36   ` Alexey Abramov
  2020-03-09 16:36     ` [bug#39745] [v3 2/2] gnu: java-openjfx-swing: Add new variable Alexey Abramov
  2020-03-11 10:36   ` [bug#39745] [v4 1/2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8 Alexey Abramov
  3 siblings, 1 reply; 34+ messages in thread
From: Alexey Abramov @ 2020-03-09 16:36 UTC (permalink / raw)
  To: 39745; +Cc: Alexey Abramov

* gnu/packages/java.scm (java-openjfx-build)[source]: Use it.
* gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch:
  New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/java.scm                         |  3 +-
 ...ld-swing-compile-JFXPanel-with-JDK-8.patch | 64 +++++++++++++++++++
 3 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 0bcbde7301..7e4554198c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1034,6 +1034,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/java-commons-collections-fix-java8.patch \
   %D%/packages/patches/java-jeromq-fix-tests.patch		\
   %D%/packages/patches/java-openjfx-build-get_guix_jdk_version.patch    \
+  %D%/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.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 349b22419a..21217b0211 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2363,7 +2363,8 @@ new Date();"))
               (sha256
                (base32
                 "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
-              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"))))
+              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"
+                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
diff --git a/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch b/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch
new file mode 100644
index 0000000000..8f222e1780
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch
@@ -0,0 +1,64 @@
+From 173e65937d9e76872df51f7ba39c9d58986dc38f Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Fri, 3 Jan 2020 01:17:45 +0100
+Subject: [PATCH] java-openjfx-build: Cannot compile JFXPanel with JDK 8
+
+In JDKu9 getDefaultScale method was removed and sun.java2d.SurfaceData class now
+has separate getDefaultScaleX() and getDefaultScaleY() methods. See
+https://bugs.openjdk.java.net/browse/JDK-8073320 for more info.
+
+Backport the missing port to build openjfx-swing package using JDKu8. For more
+info please see https://bugs.openjdk.java.net/browse/JDK-8149967
+
+---
+ .../java/javafx/embed/swing/JFXPanel.java     | 20 ++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
+index 97515e2290..614ed656b9 100644
+--- a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
++++ b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
+@@ -81,6 +81,7 @@ import sun.awt.AppContext;
+ import sun.awt.CausedFocusEvent;
+ import sun.awt.SunToolkit;
+ import sun.java2d.SunGraphics2D;
++import sun.java2d.SurfaceData;
+ import sun.util.logging.PlatformLogger;
+ import sun.util.logging.PlatformLogger.Level;
+ 
+@@ -681,6 +682,23 @@ 
+                 e.getCaret().getInsertionIndex());
+     }
+
++    // FIXME: once we move to JDK 9 as the boot JDK we should remove the
++    // reflection code from this method, consider changing it to
++    // use double rather than int, and account for the possibility of
++    // a different scale factor in X and Y.
++    private int getDefaultScale(SurfaceData surfaceData) {
++        /*
++          double scale = surfaceData.getDefaultScaleX();
++        */
++        double scale = 1;
++        try {
++            Method meth = SurfaceData.class.getMethod("getDefaultScaleX");
++            scale = (Double)meth.invoke(surfaceData);
++        } catch (Exception ex) {
++        }
++
++        return (int)Math.round(scale);
++    }
+ 
+     /**
+      * Overrides the {@link javax.swing.JComponent#paintComponent(Graphics)}
+@@ -720,7 +738,7 @@ public class JFXPanel extends JComponent {
+ 
+             int newScaleFactor = scaleFactor;
+             if (g instanceof SunGraphics2D) {
+-                newScaleFactor = ((SunGraphics2D)g).surfaceData.getDefaultScale();
++                newScaleFactor = getDefaultScale(((SunGraphics2D)g).surfaceData);
+             }
+             if (scaleFactor != newScaleFactor) {
+                 resizePixelBuffer(newScaleFactor);
+--
+2.24.1
+
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39745] [v3 2/2] gnu: java-openjfx-swing: Add new variable.
  2020-03-09 16:36   ` [bug#39745] [v3 1/2] " Alexey Abramov
@ 2020-03-09 16:36     ` Alexey Abramov
  0 siblings, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-09 16:36 UTC (permalink / raw)
  To: 39745; +Cc: Alexey Abramov

---
 gnu/packages/java.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 21217b0211..6d3f0f6771 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3084,6 +3084,19 @@ distribution.")))
      `(("java-openjfx-base" ,java-openjfx-base)
        ("java-swt" ,java-swt)))))
 
+(define-public java-openjfx-swing
+  (package (inherit java-openjfx-build)
+    (name "java-openjfx-swing")
+    (arguments
+     `(#:jar-name "java-openjfx-swing.jar"
+       #:source-dir "modules/swing/src/main/java"
+       #:tests? #f))
+    (inputs
+     `(("antlr3" ,antlr3)
+       ("java-stringtemplate" ,java-stringtemplate)))
+    (propagated-inputs
+     `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public java-openjfx-media
   (package (inherit java-openjfx-build)
     (name "java-openjfx-media")
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39741] [v2] gnu: java-openjfx-swt: Add new variable.
  2020-02-22 20:17 ` [bug#39741] [PATCH 5/7] gnu: java-openjfx-swt: " Alexey Abramov
@ 2020-03-09 16:41   ` Alexey Abramov
  0 siblings, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-09 16:41 UTC (permalink / raw)
  To: 39741; +Cc: Alexey Abramov

---
 gnu/packages/java.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 6d3f0f6771..1625195120 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3097,6 +3097,19 @@ distribution.")))
     (propagated-inputs
      `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
 
+(define-public java-openjfx-swt
+  (package (inherit java-openjfx-build)
+    (name "java-openjfx-swt")
+    (arguments
+     `(#:jar-name "java-openjfx-swt.jar"
+       #:source-dir "modules/swt/src/main/java"
+       #:tests? #f))
+    (inputs
+     `(("antlr3" ,antlr3)
+       ("java-stringtemplate" ,java-stringtemplate)))
+    (propagated-inputs
+     `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public java-openjfx-media
   (package (inherit java-openjfx-build)
     (name "java-openjfx-media")
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39743] [v2] gnu: java-openjfx-controls: Add new variable.
  2020-02-22 20:17 ` [bug#39743] [PATCH 6/7] gnu: java-openjfx-controls: " Alexey Abramov
@ 2020-03-09 16:54   ` Alexey Abramov
  0 siblings, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-09 16:54 UTC (permalink / raw)
  To: 39743; +Cc: Alexey Abramov

---
 gnu/packages/java.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 1625195120..21ff1b4a30 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3110,6 +3110,22 @@ distribution.")))
     (propagated-inputs
      `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
 
+(define-public java-openjfx-controls
+  (package (inherit java-openjfx-build)
+    (name "java-openjfx-controls")
+    (arguments
+     `(#:jar-name "java-openjfx-controls.jar"
+       #:source-dir "modules/controls/src/main/java"
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'copy-resources
+           (lambda _
+             (let ((resources (string-append (getcwd) "/modules/controls/src/main/resources")))
+               (copy-recursively resources "build/classes")) #t)))))
+    (propagated-inputs
+     `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public java-openjfx-media
   (package (inherit java-openjfx-build)
     (name "java-openjfx-media")
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39746] [v2 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web
  2020-02-22 20:17 ` [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: " Alexey Abramov
  2020-03-04  3:07   ` Leo Famulari
@ 2020-03-09 21:41   ` Alexey Abramov
  2020-03-09 21:41     ` [bug#39746] [v2 2/2] gnu: java-openjfx-web: Add new variable Alexey Abramov
  2020-03-14  6:10   ` [bug#39746] [v3 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web Alexey Abramov
  2 siblings, 1 reply; 34+ messages in thread
From: Alexey Abramov @ 2020-03-09 21:41 UTC (permalink / raw)
  To: 39746; +Cc: Alexey Abramov

* gnu/packages/java.scm (java-openjfx-build)[source]: Use it.
* gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch:
  New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/java.scm                         |  3 +-
 ...uild-web-Check-xlocale.h-header-file.patch | 56 +++++++++++++++++++
 3 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 7e4554198c..7b9af7794a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1035,6 +1035,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/java-jeromq-fix-tests.patch		\
   %D%/packages/patches/java-openjfx-build-get_guix_jdk_version.patch    \
   %D%/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch     \
+  %D%/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.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 21ff1b4a30..7d044ead89 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2364,7 +2364,8 @@ new Date();"))
                (base32
                 "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
               (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"
-                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"))))
+                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"
+                                       "java-openjfx-build-web-Check-xlocale.h-header-file.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
diff --git a/gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch b/gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch
new file mode 100644
index 0000000000..9200911d17
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch
@@ -0,0 +1,56 @@
+From 95fe8463a3283f0f2c72fcf3416ebfac095688e5 Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Sun, 9 Feb 2020 18:31:26 +0100
+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.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39746] [v2 2/2] gnu: java-openjfx-web: Add new variable
  2020-03-09 21:41   ` [bug#39746] [v2 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web Alexey Abramov
@ 2020-03-09 21:41     ` Alexey Abramov
  0 siblings, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-09 21:41 UTC (permalink / raw)
  To: 39746; +Cc: Alexey Abramov

---
 gnu/packages/java.scm | 152 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 152 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 7d044ead89..1e383ed7b0 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -47,11 +47,13 @@
   #: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 gettext)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages gperf)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages ghostscript) ;lcms
@@ -71,8 +73,10 @@
   #: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 xml)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages texinfo)
@@ -3142,6 +3146,154 @@ modern, efficient, and fully featured toolkit for developing rich client
 applications.  This package contains media-related 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")
+                                 ";")
+       #:tests? #f
+       #:modules ((ice-9 match)
+                  (guix build ant-build-system)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((module (string-append (getcwd) "/modules/web"))
+                    (classes (string-append module "/build/classes/java/main")))
+               (invoke "ant" "compile" (string-append "-Dclasses.dir=" classes)))
+             #t))
+         (add-after 'build 'generate-headers
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((module (string-append (getcwd) "/modules/web"))
+                    (classes (string-append module "/build/classes/java/main"))
+                    (web-generated-headers (string-append module "/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)))
+             #t))
+
+         (add-after 'generate-headers 'compile-native-linux
+           (lambda* (#:key inputs system #: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"))
+                     ;; 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"))))
+
+               (mkdir-p webkit-native-dest)
+               (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"
+                       "--verbose"
+                       (string-append "--cmakeargs="
+                                      (string-join `("-DCMAKE_SYSTEM_NAME=Linux"
+                                                     ,(string-append "-DCMAKE_SYSTEM_PROCESSOR=" machine)
+                                                     "-DJAVAFX_RELEASE_VERSION=8.0"
+                                                     "-W"
+                                                     "-Wall"
+                                                     "-Werror=implicit-function-declaration"
+                                                     "-Wl,--gc-sections"
+                                                     "-Wno-parentheses"
+                                                     "-Wno-unused"
+                                                     "-fPIC"
+                                                     "-fno-omit-frame-pointer"
+                                                     "-fno-strict-aliasing"
+                                                     "-fstack-protector")))))
+             #t))
+
+         (add-after 'compile-native-linux 'install-native
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((lib (string-append (assoc-ref outputs "out") "/share/amd64")))
+               (for-each (lambda (file)
+                           (install-file file lib))
+                         (find-files "." "\\.so$"))
+               #t)))
+
+         (add-before 'install 'build-jar
+           (lambda _
+             (let* ((module (string-append (getcwd) "/modules/web"))
+                    (resources (string-append module "/src/main/resources"))
+                    (classes (string-append module "/build/classes/java/main")))
+               (copy-recursively resources classes)
+               (invoke "ant" "jar" (string-append "-Dclasses.dir=" classes)))
+             #t)))))
+    (inputs
+     `(("antlr3" ,antlr3)
+       ("java-stringtemplate" ,java-stringtemplate)
+       ("pkg-config" ,pkg-config)))
+    (native-inputs
+     `(("java-junit" ,java-junit)
+       ("java-hamcrest-core" ,java-hamcrest-core)
+       ("cmake" ,cmake)
+       ("gcc" ,gcc)
+       ("gtk" ,gtk+-2)
+       ("gtk3" ,gtk+)
+       ("ruby" ,ruby)
+       ("perl" ,perl)
+       ("gperf" ,gperf)
+       ("python-2" ,python-2)))
+    (propagated-inputs
+     `(("java-openjfx-controls" ,java-openjfx-controls)
+       ("java-openjfx-media" ,java-openjfx-media)
+       ("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public javacc-4
   (package
     (name "javacc")
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39741] [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable.
  2020-03-04  3:04   ` Leo Famulari
@ 2020-03-09 22:08     ` levenson
  0 siblings, 0 replies; 34+ messages in thread
From: levenson @ 2020-03-09 22:08 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 39745, 39741, Alexey Abramov


Thank you!

Leo Famulari <leo@famulari.name> writes:

> On Sat, Feb 22, 2020 at 09:17:52PM +0100, Alexey Abramov wrote:
>> * gnu/packages/java.scm (java-openjfx-build): Add patch to the base package.
>> * gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch: Fix swing compilation for jdk8.
>
> This commit adds the patch file but also makes a new package
> java-openjfx-swing. Adding the patch to java-openjfx-build and adding
> the new package should be done in separate commits.

I split the change into two separated commits. v3

> Also remember to add the patch to 'gnu/local.mk'.
>
>> +From 173e65937d9e76872df51f7ba39c9d58986dc38f Mon Sep 17 00:00:00 2001
>> +From: Alexey Abramov <levenson@mmer.org>
>> +Date: Fri, 3 Jan 2020 01:17:45 +0100
>> +Subject: [PATCH] java-openjfx-build: Cannot compile JFXPanel with JDK 8
>> +
>> +For more info please see https://bugs.openjdk.java.net/browse/JDK-8149967
>
> This link is great but please add a brief summary of why we need the
> patch and what it does (one or two sentences is enough).

--
Alexey

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39741] [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: Add new variable.
  2020-03-04  3:07   ` Leo Famulari
@ 2020-03-09 22:13     ` levenson
  2020-03-17 22:17       ` Tobias Geerinckx-Rice via Guix-patches via
  0 siblings, 1 reply; 34+ messages in thread
From: levenson @ 2020-03-09 22:13 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 39746, 39741, Alexey Abramov

Leo Famulari <leo@famulari.name> writes:

> On Sat, Feb 22, 2020 at 09:17:55PM +0100, Alexey Abramov wrote:
>> * gnu/packages/java.scm (java-openjfx-build): Add patch to the base package.
>> * gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch: New
>>   file. Remove hardcoded xlocale definitions.
>
> I have the same comments as previously. We need to fix up the commit
> message, add java-openjfx-web in a separate commit, and add some
> description to the xlocale patch file.

I fixed the comment, add description to the patch and split the change
into two commits.

> Can you send a revised patch series? You can add the argument
> '--subject-prefix=v2' to your `git send-email` or `git format-patch`
> command to distinguish the new patches from the old ones.
>
> Thanks!

Thank you for subject-prefix tip! 

-- 
Alexey

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39745] [v4 1/2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8
  2020-02-22 20:17 ` [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable Alexey Abramov
                     ` (2 preceding siblings ...)
  2020-03-09 16:36   ` [bug#39745] [v3 1/2] " Alexey Abramov
@ 2020-03-11 10:36   ` Alexey Abramov
  2020-03-11 10:36     ` [bug#39745] [v4 2/2] gnu: java-openjfx-swing: Add new variable Alexey Abramov
  3 siblings, 1 reply; 34+ messages in thread
From: Alexey Abramov @ 2020-03-11 10:36 UTC (permalink / raw)
  To: 39745; +Cc: Alexey Abramov

* gnu/packages/java.scm (java-openjfx-build)[source]: Use it.
* gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch:
  New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/java.scm                         |  3 +-
 ...ld-swing-compile-JFXPanel-with-JDK-8.patch | 63 +++++++++++++++++++
 3 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 476aa00511..010247be3b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1033,6 +1033,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/java-commons-collections-fix-java8.patch \
   %D%/packages/patches/java-jeromq-fix-tests.patch		\
   %D%/packages/patches/java-openjfx-build-get_guix_jdk_version.patch    \
+  %D%/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.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 6c1c2dba6c..768fbf09a1 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2363,7 +2363,8 @@ new Date();"))
               (sha256
                (base32
                 "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
-              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"))))
+              (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"
+                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
diff --git a/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch b/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch
new file mode 100644
index 0000000000..363ce9509b
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch
@@ -0,0 +1,63 @@
+From 173e65937d9e76872df51f7ba39c9d58986dc38f Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Fri, 3 Jan 2020 01:17:45 +0100
+Subject: [PATCH] java-openjfx-build: Cannot compile JFXPanel with JDK 8
+
+In JDKu9 getDefaultScale method was removed and sun.java2d.SurfaceData class now
+has separate getDefaultScaleX() and getDefaultScaleY() methods. See
+https://bugs.openjdk.java.net/browse/JDK-8073320 for more info.
+
+Backport the missing port to build openjfx-swing package using JDKu8. For more
+info please see https://bugs.openjdk.java.net/browse/JDK-8149967
+
+---
+ .../java/javafx/embed/swing/JFXPanel.java     | 20 ++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
+index 97515e2290..614ed656b9 100644
+--- a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
++++ b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
+@@ -81,6 +81,7 @@ import sun.awt.AppContext;
+ import sun.awt.CausedFocusEvent;
+ import sun.awt.SunToolkit;
+ import sun.java2d.SunGraphics2D;
++import sun.java2d.SurfaceData;
+ import sun.util.logging.PlatformLogger;
+ import sun.util.logging.PlatformLogger.Level;
+
+@@ -681,6 +682,23 @@
+                 e.getCaret().getInsertionIndex());
+     }
+
++    // FIXME: once we move to JDK 9 as the boot JDK we should remove the
++    // reflection code from this method, consider changing it to
++    // use double rather than int, and account for the possibility of
++    // a different scale factor in X and Y.
++    private int getDefaultScale(SurfaceData surfaceData) {
++        /*
++          double scale = surfaceData.getDefaultScaleX();
++        */
++        double scale = 1;
++        try {
++            Method meth = SurfaceData.class.getMethod("getDefaultScaleX");
++            scale = (Double)meth.invoke(surfaceData);
++        } catch (Exception ex) {
++        }
++
++        return (int)Math.round(scale);
++    }
+
+     /**
+      * Overrides the {@link javax.swing.JComponent#paintComponent(Graphics)}
+@@ -720,7 +738,7 @@ public class JFXPanel extends JComponent {
+
+             int newScaleFactor = scaleFactor;
+             if (g instanceof SunGraphics2D) {
+-                newScaleFactor = ((SunGraphics2D)g).surfaceData.getDefaultScale();
++                newScaleFactor = getDefaultScale(((SunGraphics2D)g).surfaceData);
+             }
+             if (scaleFactor != newScaleFactor) {
+                 resizePixelBuffer(newScaleFactor);
+--
+2.24.1
--
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39745] [v4 2/2] gnu: java-openjfx-swing: Add new variable.
  2020-03-11 10:36   ` [bug#39745] [v4 1/2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8 Alexey Abramov
@ 2020-03-11 10:36     ` Alexey Abramov
  0 siblings, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-11 10:36 UTC (permalink / raw)
  To: 39745; +Cc: Alexey Abramov

---
 gnu/packages/java.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 768fbf09a1..494f5e360d 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3084,6 +3084,19 @@ distribution.")))
      `(("java-openjfx-base" ,java-openjfx-base)
        ("java-swt" ,java-swt)))))
 
+(define-public java-openjfx-swing
+  (package (inherit java-openjfx-build)
+    (name "java-openjfx-swing")
+    (arguments
+     `(#:jar-name "java-openjfx-swing.jar"
+       #:source-dir "modules/swing/src/main/java"
+       #:tests? #f))
+    (inputs
+     `(("antlr3" ,antlr3)
+       ("java-stringtemplate" ,java-stringtemplate)))
+    (propagated-inputs
+     `(("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public java-openjfx-media
   (package (inherit java-openjfx-build)
     (name "java-openjfx-media")
--
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39746] [v3 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web.
  2020-02-22 20:17 ` [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: " Alexey Abramov
  2020-03-04  3:07   ` Leo Famulari
  2020-03-09 21:41   ` [bug#39746] [v2 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web Alexey Abramov
@ 2020-03-14  6:10   ` Alexey Abramov
  2020-03-14  6:10     ` [bug#39746] [v3 2/2] gnu: java-openjfx-web: Add new variable Alexey Abramov
  2 siblings, 1 reply; 34+ messages in thread
From: Alexey Abramov @ 2020-03-14  6:10 UTC (permalink / raw)
  To: 39746; +Cc: Alexey Abramov

* gnu/packages/java.scm (java-openjfx-build)[source]: Use it.
* gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch:
  New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/java.scm                         |  3 +-
 ...uild-web-Check-xlocale.h-header-file.patch | 55 +++++++++++++++++++
 3 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 8722e371ad..49b4710295 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1035,6 +1035,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/java-jeromq-fix-tests.patch		\
   %D%/packages/patches/java-openjfx-build-get_guix_jdk_version.patch    \
   %D%/packages/patches/java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch     \
+  %D%/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.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 7a69a8d756..6db8a3ec7c 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2364,7 +2364,8 @@ new Date();"))
                (base32
                 "0yg38mwpivswccv9n96k06x3iv82i4px1a9xg9l8dswzwmfj259f"))
               (patches (search-patches "java-openjfx-build-get_guix_jdk_version.patch"
-                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"))))
+                                       "java-openjfx-build-swing-compile-JFXPanel-with-JDK-8.patch"
+                                       "java-openjfx-build-web-Check-xlocale.h-header-file.patch"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-openjfx.jar"
diff --git a/gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch b/gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch
new file mode 100644
index 0000000000..a5cb9730e4
--- /dev/null
+++ b/gnu/packages/patches/java-openjfx-build-web-Check-xlocale.h-header-file.patch
@@ -0,0 +1,55 @@
+From 95fe8463a3283f0f2c72fcf3416ebfac095688e5 Mon Sep 17 00:00:00 2001
+From: Alexey Abramov <levenson@mmer.org>
+Date: Sun, 9 Feb 2020 18:31:26 +0100
+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.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [bug#39746] [v3 2/2] gnu: java-openjfx-web: Add new variable.
  2020-03-14  6:10   ` [bug#39746] [v3 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web Alexey Abramov
@ 2020-03-14  6:10     ` Alexey Abramov
  0 siblings, 0 replies; 34+ messages in thread
From: Alexey Abramov @ 2020-03-14  6:10 UTC (permalink / raw)
  To: 39746; +Cc: Alexey Abramov

---
 gnu/packages/java.scm | 179 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 179 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 6db8a3ec7c..826e027fa4 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -47,11 +47,13 @@
   #: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 gettext)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages gperf)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages ghostscript) ;lcms
@@ -71,8 +73,10 @@
   #: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 xml)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages texinfo)
@@ -3142,6 +3146,181 @@ modern, efficient, and fully featured toolkit for developing rich client
 applications.  This package contains media-related 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")
+                                 ";")
+       #:tests? #f
+       #:modules ((ice-9 match)
+                  (guix build ant-build-system)
+                  (guix build utils))
+       #:phases
+       (let ((lib-path (string-append (assoc-ref %outputs "out")
+                                      ,(match (%current-system)
+                                         ("i686-linux"
+                                          "/lib/i386")
+                                         ("x86_64-linux"
+                                          "/lib/amd64")
+                                         ("armhf-linux"
+                                          "/lib/arm")
+                                         ("aarch64-linux"
+                                          "/lib/aarch64")
+                                         ;; We need a catch-all, dropping
+                                         ;; '-linux' works in most cases.
+                                         (_
+                                          (string-append
+                                           "/lib/"
+                                           (string-drop-right
+                                            (%current-system) 6)))))))
+         (modify-phases %standard-phases
+           (replace 'build
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((module (string-append (getcwd) "/modules/web"))
+                      (classes (string-append module "/build/classes/java/main")))
+                 (invoke "ant" "compile" (string-append "-Dclasses.dir=" classes)))
+               #t))
+           (add-after 'build 'generate-headers
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((module (string-append (getcwd) "/modules/web"))
+                      (classes (string-append module "/build/classes/java/main"))
+                      (web-generated-headers (string-append module "/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))
+               #t))
+
+           (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"))
+                       ;; 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"))))
+
+                 (mkdir-p webkit-native-dest)
+                 (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"
+                         "--verbose"
+                         (string-append
+                          "--cmakeargs="
+                          (string-join
+                           (list "-DCMAKE_SYSTEM_NAME=Linux"
+                                 ;; ensure that the libraries are installed into /lib
+                                 (string-append "-DCMAKE_INSTALL_LIBDIR=" lib-path)
+                                 ;; 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-path "\"")
+                                 (string-append "-DCMAKE_SYSTEM_PROCESSOR=" machine)
+
+                                 "-DJAVAFX_RELEASE_VERSION=8.0"
+                                 "-W"
+                                 "-Wall"
+                                 "-Werror=implicit-function-declaration"
+                                 "-Wl,--gc-sections"
+                                 "-Wno-parentheses"
+                                 "-Wno-unused"
+                                 "-fPIC"
+                                 "-fno-omit-frame-pointer"
+                                 "-fno-strict-aliasing"
+                                 "-fstack-protector")))))
+               #t))
+
+           (add-after 'compile-native-linux 'install-native
+             (lambda* (#:key outputs #:allow-other-keys)
+               (for-each (lambda (file)
+                           (install-file file lib-path))
+                         (find-files "." "\\.so$"))))
+
+           (add-before 'install 'build-jar
+             (lambda _
+               (let* ((module (string-append (getcwd) "/modules/web"))
+                      (resources (string-append module "/src/main/resources"))
+                      (classes (string-append module "/build/classes/java/main")))
+                 (copy-recursively resources classes)
+                 (invoke "ant" "jar" (string-append "-Dclasses.dir=" classes)))
+               #t))))))
+    (inputs
+     `(("antlr3" ,antlr3)
+       ("java-stringtemplate" ,java-stringtemplate)))
+    (native-inputs
+     `(("java-junit" ,java-junit)
+       ("java-hamcrest-core" ,java-hamcrest-core)
+       ("cmake" ,cmake)
+       ("gcc" ,gcc)
+       ("gtk" ,gtk+-2)
+       ("gtk3" ,gtk+)
+       ("ruby" ,ruby)
+       ("perl" ,perl)
+       ("gperf" ,gperf)
+       ("python-2" ,python-2)
+       ("pkg-config" ,pkg-config)))
+    (propagated-inputs
+     `(("java-openjfx-controls" ,java-openjfx-controls)
+       ("java-openjfx-media" ,java-openjfx-media)
+       ("java-openjfx-graphics" ,java-openjfx-graphics)))))
+
 (define-public javacc-4
   (package
     (name "javacc")
--
2.24.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* bug#39742: [v2] gnu: java-openjfx-build: Add helpful patch.
  2020-03-08 19:40 ` [bug#39742] [v2] " Alexey Abramov
@ 2020-03-15 18:19   ` Leo Famulari
  2020-03-17 21:12     ` [bug#39742] " Björn Höfling
  0 siblings, 1 reply; 34+ messages in thread
From: Leo Famulari @ 2020-03-15 18:19 UTC (permalink / raw)
  To: Alexey Abramov; +Cc: 39742-done

I'm closing this bug ticket because Alexey is still working on some of
the patches and it's confusing to have the patches spread over multiple
tickets, even though we merged them. Alexey will open a new ticket soon.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39742] [v2] gnu: java-openjfx-build: Add helpful patch.
  2020-03-15 18:19   ` bug#39742: " Leo Famulari
@ 2020-03-17 21:12     ` Björn Höfling
  0 siblings, 0 replies; 34+ messages in thread
From: Björn Höfling @ 2020-03-17 21:12 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 39742-done, Alexey Abramov

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

On Sun, 15 Mar 2020 14:19:53 -0400
Leo Famulari <leo@famulari.name> wrote:

> I'm closing this bug ticket because Alexey is still working on some of
> the patches and it's confusing to have the patches spread over
> multiple tickets, even though we merged them. Alexey will open a new
> ticket soon.

Thanks for the information. I'm happy to review the patches, but was
very confused about the different mails and patches.

Alexey, if you need some help, don't hesitate to ask.

Björn


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [bug#39741] [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: Add new variable.
  2020-03-09 22:13     ` [bug#39741] " levenson
@ 2020-03-17 22:17       ` Tobias Geerinckx-Rice via Guix-patches via
  0 siblings, 0 replies; 34+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2020-03-17 22:17 UTC (permalink / raw)
  Cc: 39746, 39741, Alexey Abramov, Leo Famulari

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

Alexey,

levenson@mmer.org 写道:
> Thank you for subject-prefix tip! 

The shorter ‘-v2’ will do the right thing too.

(While writing this I found out it's not documented in the man 
page, but it works.)

Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2020-03-17 22:18 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-22 20:17 [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Alexey Abramov
2020-02-22 20:17 ` [bug#39744] [PATCH 2/7] gnu: java-openjfx-build: Fix indentation Alexey Abramov
2020-02-22 20:17 ` [bug#39747] [PATCH 3/7] gnu: java-openjfx-graphics: Implement a complete compilation Alexey Abramov
2020-03-04  3:00   ` Leo Famulari
2020-03-09 13:08     ` levenson
2020-03-09 12:46   ` [bug#39747] [v2] " Alexey Abramov
2020-02-22 20:17 ` [bug#39745] [PATCH 4/7] gnu: java-openjfx-swing: Add new variable Alexey Abramov
2020-03-04  3:04   ` Leo Famulari
2020-03-09 22:08     ` [bug#39741] " levenson
2020-03-09 16:15   ` [bug#39745] [v2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8 Alexey Abramov
2020-03-09 16:36   ` [bug#39745] [v3 1/2] " Alexey Abramov
2020-03-09 16:36     ` [bug#39745] [v3 2/2] gnu: java-openjfx-swing: Add new variable Alexey Abramov
2020-03-11 10:36   ` [bug#39745] [v4 1/2] gnu: java-openjfx-build: Fix openjfx-swing component build for JDKu8 Alexey Abramov
2020-03-11 10:36     ` [bug#39745] [v4 2/2] gnu: java-openjfx-swing: Add new variable Alexey Abramov
2020-02-22 20:17 ` [bug#39741] [PATCH 5/7] gnu: java-openjfx-swt: " Alexey Abramov
2020-03-09 16:41   ` [bug#39741] [v2] " Alexey Abramov
2020-02-22 20:17 ` [bug#39743] [PATCH 6/7] gnu: java-openjfx-controls: " Alexey Abramov
2020-03-09 16:54   ` [bug#39743] [v2] " Alexey Abramov
2020-02-22 20:17 ` [bug#39746] [PATCH 7/7] gnu: java-openjfx-web: " Alexey Abramov
2020-03-04  3:07   ` Leo Famulari
2020-03-09 22:13     ` [bug#39741] " levenson
2020-03-17 22:17       ` Tobias Geerinckx-Rice via Guix-patches via
2020-03-09 21:41   ` [bug#39746] [v2 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web Alexey Abramov
2020-03-09 21:41     ` [bug#39746] [v2 2/2] gnu: java-openjfx-web: Add new variable Alexey Abramov
2020-03-14  6:10   ` [bug#39746] [v3 1/2] gnu: java-openjfx-build: Prepare a patch to build openjfx-web Alexey Abramov
2020-03-14  6:10     ` [bug#39746] [v3 2/2] gnu: java-openjfx-web: Add new variable Alexey Abramov
2020-03-04  2:56 ` [bug#39742] [PATCH 1/7] gnu: java-openjfx-build: Add helpful patch Leo Famulari
2020-03-05 20:42   ` Alexey Abramov
2020-03-05 19:09 ` Björn Höfling
2020-03-05 20:10   ` Alexey Abramov
2020-03-05 21:35   ` Björn Höfling
2020-03-08 19:40 ` [bug#39742] [v2] " Alexey Abramov
2020-03-15 18:19   ` bug#39742: " Leo Famulari
2020-03-17 21:12     ` [bug#39742] " Björn Höfling

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).