public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* building for jdk / openfx 13 (patch)
@ 2019-12-16 23:43 Michael Zucchi
  2019-12-16 23:49 ` ian
  2019-12-17  1:20 ` Per Bothner
  0 siblings, 2 replies; 11+ messages in thread
From: Michael Zucchi @ 2019-12-16 23:43 UTC (permalink / raw)
  To: kawa


Morning,

Apologies if this should go to the bug tracker, I didn't see any 
specific details for patch submission.

I wanted to have a look at kawa including the javafx parts but I didn't 
want to install the oracle jdk as i've moved everything i do to 
openjdk.  So I've created a small patch that allows compilation with 
openjdk13 and openjfx13 (although it should work with 11+). It is 
enabled by adding --with-javafx-sdk=path to configure:

./configure --with-javafx-sdk=<path to sdk directory>

Because of the removal of the java ee modules from java se, 'make check' 
fails as java.xml.* has been removed.  But passing --disable-xml to 
configure (which i only guess as to be related) breaks the build in more 
ways.

I modified bin/kawa.sh.in to load the javafx modules this option is used 
to configure (or if JAVAFX_HOME is set) so the hello example still 
works.  I didn't look at build.xml or kawa.bat.

I guess ideally it should create a modular jar that publishes it's 
dependencies particularly if other modular components are included in 
the future.  Because javafx.web is very large it may make sense to be 
able to exclude it as a build option, but I included it by default.

Cheers,
  Michael



---
  ChangeLog                   |  8 ++++++++
  Make-rules                  |  2 +-
  Makefile.am                 |  5 ++++-
  bin/ChangeLog               |  6 ++++++
  bin/kawa.sh.in              |  7 +++++--
  configure.ac                |  7 +++++++
  doc/ChangeLog               |  5 +++++
  doc/kawa.texi               | 24 ++++++++++++++++++++++++
  gnu/kawa/javafx/ChangeLog   |  5 +++++
  gnu/kawa/javafx/Makefile.am |  4 ++++
  10 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fb974c2df..9f505d845 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-12-16  Michael Zucchi  <notzed@gmail.com>
+
+    * Make-rules (KAWA_COMPILER): Add KAWA_COMPILER_JAVA_FLAGS for jvm
+    flags for compiler.
+    * Makefile.am: Enable JAVAFX_SUBDIRS if --with=javafx-sdk used.
+    * configure.ac: Add support for --with-javafx-sdk=path for modular
+    javafx sdk.
+
  2019-08-06  Per Bothner  <per@bothner.com>

      * conigure.ac: Change missing Posix find from error to warning.
diff --git a/Make-rules b/Make-rules
index d08811bed..4793d479f 100644
--- a/Make-rules
+++ b/Make-rules
@@ -15,7 +15,7 @@ java-classes.stamp: $(java_Java)
      echo timestamp > java-classes.stamp
      echo timestamp > $(TO_TOPDIR)/kawa-jar.stamp

-KAWA_COMPILER = $(JAVA) -classpath "$(CLASSPATH)" kawa.repl -d 
$(top_builddir) \
+KAWA_COMPILER = $(JAVA) -classpath "$(CLASSPATH)" 
$(KAWA_COMPILER_JAVA_FLAGS) kawa.repl -d $(top_builddir) \
    -P `echo $(PACKAGE_FNAME)|sed -e s/-/./g`.

  scm-classes.stamp: $(java_SCM)
diff --git a/Makefile.am b/Makefile.am
index 859d23c72..e27b38929 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,6 +33,9 @@ endif
  if WITH_JAVAFX
  SUBDIRS += $(JAVAFX_SUBDIRS)
  endif
+if WITH_JAVAFX_SDK
+SUBDIRS += $(JAVAFX_SUBDIRS)
+endif

  DIST_SUBDIRS = $(FIXED_SUBDIRS) \
    $(ANDROID_SUBDIRS) \
@@ -120,7 +123,7 @@ dist-kawa.jar: dist
        && ./kawa-$(VERSION)/configure 
--with-java-source=$(DEFAULT_JAVA_VERSION) \
          --with-domterm="@WITH_DOMTERM_ARG@" \
          --with-jline$(JLINE_VERSION_MAJOR)="@WITH_JLINE_PATH@" \
-        --with-servlet=@WITH_SERVLET_ARG@ --with-javafx=@WITH_JAVAFX_ARG@ \
+        --with-servlet=@WITH_SERVLET_ARG@ 
--with-javafx=@WITH_JAVAFX_ARG@ --with-javafx-sdk=@WITH_JAVAFX_SDK_ARG@ \
        && CLASSPATH=@conf_classpath@.$(CLASSPATH_SEPARATOR)$$CLASSPATH 
$(MAKE) all JAVAC="$(JAVAC) -source $(DEFAULT_JAVA_VERSION) -target 
$(DEFAULT_JAVA_VERSION)" \
        && mv lib/kawa.jar ../dist-kawa.jar \
        && cd .. && rm -rf tmpdir
diff --git a/bin/ChangeLog b/bin/ChangeLog
index 7263f0543..f8cea7ad8 100644
--- a/bin/ChangeLog
+++ b/bin/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-16  Michael Zucchi  <notzed@gmail.com>
+
+    * kawa.sh.in (JAVAFX_HOME, JVM_FLAGS): If JAVAFX_HOME is defined
+    or configure was compiled using --with-javafx-sdk then add javafx
+    modules to module path.
+
  2017-05-03  Per Bothner  <per@bothner.com>

      * kawa.sh.in:  Avoid needless bash-specific 'type' command.
diff --git a/bin/kawa.sh.in b/bin/kawa.sh.in
index 296ce731f..4252bc026 100644
--- a/bin/kawa.sh.in
+++ b/bin/kawa.sh.in
@@ -34,6 +34,9 @@ else
      JAVA=${JAVA-java}
  fi

+JAVAFX_HOME=${JAVAFX_HOME:=@WITH_JAVAFX_SDK_ARG@}
+JVM_FLAGS=${JAVAFX_HOME:+"--module-path=${JAVAFX_HOME}/lib" 
--add-modules=javafx.web}
+
  # This ugly duplication is so we only have to use arrays and substrings
  # (which are non-Posix and non-portable) if there is a -D or -J option.
  case "$1" in
@@ -53,9 +56,9 @@ case "$1" in
                  ;;
              esac
          done
-        exec ${JAVA} -Dkawa.command.line="${command_line}" 
-Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" "${jvm_args[@]}" 
kawa.repl ${no_console} "$@"
+        exec ${JAVA} ${JVM_FLAGS} -Dkawa.command.line="${command_line}" 
-Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" "${jvm_args[@]}" 
kawa.repl ${no_console} "$@"
          ;;
      *)
-        exec ${JAVA} -Dkawa.command.line="${command_line}" 
-Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" kawa.repl ${no_console} 
"$@"
+        exec ${JAVA} ${JVM_FLAGS} -Dkawa.command.line="${command_line}" 
-Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" kawa.repl ${no_console} 
"$@"
          ;;
  esac
diff --git a/configure.ac b/configure.ac
index bd1f8cd37..8e9eb2e53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,10 @@ AC_ARG_WITH(javafx,
    AS_HELP_STRING(--with-javafx@<:@=jfxrt.jar@:>@,Enable support for 
JavaFX))
  WITH_JAVAFX_ARG="${with_javafx}"

+AC_ARG_WITH(javafx-sdk,
+  AS_HELP_STRING(--with-javafx-sdk=path,Enable support for JavaFX SDK 
Modules))
+WITH_JAVAFX_SDK_ARG="${with_javafx_sdk}"
+
  AC_ARG_WITH(lsp4j,
    AS_HELP_STRING(--with-lsp4j=<:@=lsp4j.jar@>))
  AC_ARG_WITH(lsp4j.jsonrpc,
@@ -196,6 +200,8 @@ AM_CONDITIONAL(WITH_DOMTERM,
    test "$with_domterm" != "" -a "$with_domterm" != "no")
  AM_CONDITIONAL(WITH_JAVAFX,
    test "$with_javafx" != "" -a "$with_javafx" != "no")
+AM_CONDITIONAL(WITH_JAVAFX_SDK,
+  test "$with_javafx_sdk" != "" -a "$with_javafx_sdk" != "no")
  AM_CONDITIONAL(WITH_SWT, test "$with_swt" = "yes")
  AM_CONDITIONAL(WITH_AWT, test "$with_awt" != "no")
  AM_CONDITIONAL(WITH_SAX2, test "$with_sax2" != "no")
@@ -264,6 +270,7 @@ AC_SUBST(pathsep)
  AC_SUBST(filesep)
  AC_SUBST(WITH_SERVLET_ARG)
  AC_SUBST(WITH_JAVAFX_ARG)
+AC_SUBST(WITH_JAVAFX_SDK_ARG)
  AC_SUBST(WITH_JLINE3)
  AC_SUBST(WITH_GSON_PATH)
  AC_SUBST(WITH_JLINE_PATH)
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 0cc771bfe..905d77bdf 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-16  Michael Zucchi  <notzed@gmail.com>
+
+    * kawa.texi (Building JavaFX applications): Added subsection about
+    JDK11+ JavaFX.
+
  2019-01-17  Per Bothner  <per@bothner.com>

      * kawa.texi (Arithmetic operations): Document 'expt'.
diff --git a/doc/kawa.texi b/doc/kawa.texi
index d709b7100..2c14825df 100644
--- a/doc/kawa.texi
+++ b/doc/kawa.texi
@@ -23138,6 +23138,30 @@ The resulting Kawa binary sets up the path to 
@code{jfxrt.jar} so you just need
  $ kawa HelloButton1.scm
  @end example

+@subsection Using JavaFX with JDK 11+
+Starting with JDK 11, JavaFX has been moved to a separate project and
+is no longer included in the JDK.  The separate project OpenJFX
+provides an SDK that includes modular jar files which can be added to
+the @code{CLASSPATH} or via the @code{--module-path} parameter to
+@code{javac} and @code{java}.
+
+To run the previous @code{HelloButton1.scm} you can do:
+@example
+$ java -cp $KAVA_HOME/kawa.jar --module-path $JAVAFX_HOME/lib \
+  --add-modules javafx.web HelloButton1.scm
+@end example
+
+If you build Kawa from source you must use an appropriate JDK version
+and enable the modular OpenJFX SDK:
+@example
+$ ./configure --with-javafx-sdk=path-to-sdk ...other-args...
+@end example
+The resulting Kawa binary sets up the module path and the boostrap
+module so you just need to do:
+@example
+$ kawa HelloButton1.scm
+@end example
+
  @node Building for Android
  @section Building for Android

diff --git a/gnu/kawa/javafx/ChangeLog b/gnu/kawa/javafx/ChangeLog
index 3c8b6d99f..99d2f1f88 100644
--- a/gnu/kawa/javafx/ChangeLog
+++ b/gnu/kawa/javafx/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-16  Michael Zucchi  <notzed@gmail.com>
+
+    * Makefile.am (KAVA_COMPILER_JAVA_FLAGS): Add support for modular
+    javafx sdk.
+
  2017-05-13  Per Bothner  <per@bothner.com>

      * MakeScene.scm (add): Don't set root.
diff --git a/gnu/kawa/javafx/Makefile.am b/gnu/kawa/javafx/Makefile.am
index 5d0325aad..80de370e5 100644
--- a/gnu/kawa/javafx/Makefile.am
+++ b/gnu/kawa/javafx/Makefile.am
@@ -2,6 +2,10 @@

  include $(top_srcdir)/Make-rules

+if WITH_JAVAFX_SDK
+KAWA_COMPILER_JAVA_FLAGS=--module-path $(WITH_JAVAFX_SDK_ARG)/lib 
--add-modules javafx.web
+endif
+
  java_sources=

  java_SCM = GroupObjectBuilder.scm MakeScene.scm defs.scm


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

* Re: building for jdk / openfx 13 (patch)
  2019-12-16 23:43 building for jdk / openfx 13 (patch) Michael Zucchi
@ 2019-12-16 23:49 ` ian
  2019-12-17  1:53   ` Per Bothner
  2019-12-17  1:20 ` Per Bothner
  1 sibling, 1 reply; 11+ messages in thread
From: ian @ 2019-12-16 23:49 UTC (permalink / raw)
  To: kawa, Michael Zucchi

Neat,

But just to say, openjdk is Oracle's too....

'Night.

ian

Le 17/12/2019 à 00:43, Michael Zucchi a écrit :
>
> Morning,
>
> Apologies if this should go to the bug tracker, I didn't see any
> specific details for patch submission.
>
> I wanted to have a look at kawa including the javafx parts but I
> didn't want to install the oracle jdk as i've moved everything i do to
> openjdk.  So I've created a small patch that allows compilation with
> openjdk13 and openjfx13 (although it should work with 11+). It is
> enabled by adding --with-javafx-sdk=path to configure:
>
> ./configure --with-javafx-sdk=<path to sdk directory>
>
> Because of the removal of the java ee modules from java se, 'make
> check' fails as java.xml.* has been removed.  But passing
> --disable-xml to configure (which i only guess as to be related)
> breaks the build in more ways.
>
> I modified bin/kawa.sh.in to load the javafx modules this option is
> used to configure (or if JAVAFX_HOME is set) so the hello example
> still works.  I didn't look at build.xml or kawa.bat.
>
> I guess ideally it should create a modular jar that publishes it's
> dependencies particularly if other modular components are included in
> the future.  Because javafx.web is very large it may make sense to be
> able to exclude it as a build option, but I included it by default.
>
> Cheers,
>  Michael
>
>
>
> ---
>  ChangeLog                   |  8 ++++++++
>  Make-rules                  |  2 +-
>  Makefile.am                 |  5 ++++-
>  bin/ChangeLog               |  6 ++++++
>  bin/kawa.sh.in              |  7 +++++--
>  configure.ac                |  7 +++++++
>  doc/ChangeLog               |  5 +++++
>  doc/kawa.texi               | 24 ++++++++++++++++++++++++
>  gnu/kawa/javafx/ChangeLog   |  5 +++++
>  gnu/kawa/javafx/Makefile.am |  4 ++++
>  10 files changed, 69 insertions(+), 4 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index fb974c2df..9f505d845 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,11 @@
> +2019-12-16  Michael Zucchi  <notzed@gmail.com>
> +
> +    * Make-rules (KAWA_COMPILER): Add KAWA_COMPILER_JAVA_FLAGS for jvm
> +    flags for compiler.
> +    * Makefile.am: Enable JAVAFX_SUBDIRS if --with=javafx-sdk used.
> +    * configure.ac: Add support for --with-javafx-sdk=path for modular
> +    javafx sdk.
> +
>  2019-08-06  Per Bothner  <per@bothner.com>
>
>      * conigure.ac: Change missing Posix find from error to warning.
> diff --git a/Make-rules b/Make-rules
> index d08811bed..4793d479f 100644
> --- a/Make-rules
> +++ b/Make-rules
> @@ -15,7 +15,7 @@ java-classes.stamp: $(java_Java)
>      echo timestamp > java-classes.stamp
>      echo timestamp > $(TO_TOPDIR)/kawa-jar.stamp
>
> -KAWA_COMPILER = $(JAVA) -classpath "$(CLASSPATH)" kawa.repl -d
> $(top_builddir) \
> +KAWA_COMPILER = $(JAVA) -classpath "$(CLASSPATH)"
> $(KAWA_COMPILER_JAVA_FLAGS) kawa.repl -d $(top_builddir) \
>    -P `echo $(PACKAGE_FNAME)|sed -e s/-/./g`.
>
>  scm-classes.stamp: $(java_SCM)
> diff --git a/Makefile.am b/Makefile.am
> index 859d23c72..e27b38929 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -33,6 +33,9 @@ endif
>  if WITH_JAVAFX
>  SUBDIRS += $(JAVAFX_SUBDIRS)
>  endif
> +if WITH_JAVAFX_SDK
> +SUBDIRS += $(JAVAFX_SUBDIRS)
> +endif
>
>  DIST_SUBDIRS = $(FIXED_SUBDIRS) \
>    $(ANDROID_SUBDIRS) \
> @@ -120,7 +123,7 @@ dist-kawa.jar: dist
>        && ./kawa-$(VERSION)/configure
> --with-java-source=$(DEFAULT_JAVA_VERSION) \
>          --with-domterm="@WITH_DOMTERM_ARG@" \
>          --with-jline$(JLINE_VERSION_MAJOR)="@WITH_JLINE_PATH@" \
> -        --with-servlet=@WITH_SERVLET_ARG@
> --with-javafx=@WITH_JAVAFX_ARG@ \
> +        --with-servlet=@WITH_SERVLET_ARG@
> --with-javafx=@WITH_JAVAFX_ARG@ --with-javafx-sdk=@WITH_JAVAFX_SDK_ARG@ \
>        && CLASSPATH=@conf_classpath@.$(CLASSPATH_SEPARATOR)$$CLASSPATH
> $(MAKE) all JAVAC="$(JAVAC) -source $(DEFAULT_JAVA_VERSION) -target
> $(DEFAULT_JAVA_VERSION)" \
>        && mv lib/kawa.jar ../dist-kawa.jar \
>        && cd .. && rm -rf tmpdir
> diff --git a/bin/ChangeLog b/bin/ChangeLog
> index 7263f0543..f8cea7ad8 100644
> --- a/bin/ChangeLog
> +++ b/bin/ChangeLog
> @@ -1,3 +1,9 @@
> +2019-12-16  Michael Zucchi  <notzed@gmail.com>
> +
> +    * kawa.sh.in (JAVAFX_HOME, JVM_FLAGS): If JAVAFX_HOME is defined
> +    or configure was compiled using --with-javafx-sdk then add javafx
> +    modules to module path.
> +
>  2017-05-03  Per Bothner  <per@bothner.com>
>
>      * kawa.sh.in:  Avoid needless bash-specific 'type' command.
> diff --git a/bin/kawa.sh.in b/bin/kawa.sh.in
> index 296ce731f..4252bc026 100644
> --- a/bin/kawa.sh.in
> +++ b/bin/kawa.sh.in
> @@ -34,6 +34,9 @@ else
>      JAVA=${JAVA-java}
>  fi
>
> +JAVAFX_HOME=${JAVAFX_HOME:=@WITH_JAVAFX_SDK_ARG@}
> +JVM_FLAGS=${JAVAFX_HOME:+"--module-path=${JAVAFX_HOME}/lib"
> --add-modules=javafx.web}
> +
>  # This ugly duplication is so we only have to use arrays and substrings
>  # (which are non-Posix and non-portable) if there is a -D or -J option.
>  case "$1" in
> @@ -53,9 +56,9 @@ case "$1" in
>                  ;;
>              esac
>          done
> -        exec ${JAVA} -Dkawa.command.line="${command_line}"
> -Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" "${jvm_args[@]}"
> kawa.repl ${no_console} "$@"
> +        exec ${JAVA} ${JVM_FLAGS}
> -Dkawa.command.line="${command_line}" -Dkawa.command.pid="$$"
> -Dkawa.home="${kawadir}" "${jvm_args[@]}" kawa.repl ${no_console} "$@"
>          ;;
>      *)
> -        exec ${JAVA} -Dkawa.command.line="${command_line}"
> -Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" kawa.repl
> ${no_console} "$@"
> +        exec ${JAVA} ${JVM_FLAGS}
> -Dkawa.command.line="${command_line}" -Dkawa.command.pid="$$"
> -Dkawa.home="${kawadir}" kawa.repl ${no_console} "$@"
>          ;;
>  esac
> diff --git a/configure.ac b/configure.ac
> index bd1f8cd37..8e9eb2e53 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -31,6 +31,10 @@ AC_ARG_WITH(javafx,
>    AS_HELP_STRING(--with-javafx@<:@=jfxrt.jar@:>@,Enable support for
> JavaFX))
>  WITH_JAVAFX_ARG="${with_javafx}"
>
> +AC_ARG_WITH(javafx-sdk,
> +  AS_HELP_STRING(--with-javafx-sdk=path,Enable support for JavaFX SDK
> Modules))
> +WITH_JAVAFX_SDK_ARG="${with_javafx_sdk}"
> +
>  AC_ARG_WITH(lsp4j,
>    AS_HELP_STRING(--with-lsp4j=<:@=lsp4j.jar@>))
>  AC_ARG_WITH(lsp4j.jsonrpc,
> @@ -196,6 +200,8 @@ AM_CONDITIONAL(WITH_DOMTERM,
>    test "$with_domterm" != "" -a "$with_domterm" != "no")
>  AM_CONDITIONAL(WITH_JAVAFX,
>    test "$with_javafx" != "" -a "$with_javafx" != "no")
> +AM_CONDITIONAL(WITH_JAVAFX_SDK,
> +  test "$with_javafx_sdk" != "" -a "$with_javafx_sdk" != "no")
>  AM_CONDITIONAL(WITH_SWT, test "$with_swt" = "yes")
>  AM_CONDITIONAL(WITH_AWT, test "$with_awt" != "no")
>  AM_CONDITIONAL(WITH_SAX2, test "$with_sax2" != "no")
> @@ -264,6 +270,7 @@ AC_SUBST(pathsep)
>  AC_SUBST(filesep)
>  AC_SUBST(WITH_SERVLET_ARG)
>  AC_SUBST(WITH_JAVAFX_ARG)
> +AC_SUBST(WITH_JAVAFX_SDK_ARG)
>  AC_SUBST(WITH_JLINE3)
>  AC_SUBST(WITH_GSON_PATH)
>  AC_SUBST(WITH_JLINE_PATH)
> diff --git a/doc/ChangeLog b/doc/ChangeLog
> index 0cc771bfe..905d77bdf 100644
> --- a/doc/ChangeLog
> +++ b/doc/ChangeLog
> @@ -1,3 +1,8 @@
> +2019-12-16  Michael Zucchi  <notzed@gmail.com>
> +
> +    * kawa.texi (Building JavaFX applications): Added subsection about
> +    JDK11+ JavaFX.
> +
>  2019-01-17  Per Bothner  <per@bothner.com>
>
>      * kawa.texi (Arithmetic operations): Document 'expt'.
> diff --git a/doc/kawa.texi b/doc/kawa.texi
> index d709b7100..2c14825df 100644
> --- a/doc/kawa.texi
> +++ b/doc/kawa.texi
> @@ -23138,6 +23138,30 @@ The resulting Kawa binary sets up the path to
> @code{jfxrt.jar} so you just need
>  $ kawa HelloButton1.scm
>  @end example
>
> +@subsection Using JavaFX with JDK 11+
> +Starting with JDK 11, JavaFX has been moved to a separate project and
> +is no longer included in the JDK.  The separate project OpenJFX
> +provides an SDK that includes modular jar files which can be added to
> +the @code{CLASSPATH} or via the @code{--module-path} parameter to
> +@code{javac} and @code{java}.
> +
> +To run the previous @code{HelloButton1.scm} you can do:
> +@example
> +$ java -cp $KAVA_HOME/kawa.jar --module-path $JAVAFX_HOME/lib \
> +  --add-modules javafx.web HelloButton1.scm
> +@end example
> +
> +If you build Kawa from source you must use an appropriate JDK version
> +and enable the modular OpenJFX SDK:
> +@example
> +$ ./configure --with-javafx-sdk=path-to-sdk ...other-args...
> +@end example
> +The resulting Kawa binary sets up the module path and the boostrap
> +module so you just need to do:
> +@example
> +$ kawa HelloButton1.scm
> +@end example
> +
>  @node Building for Android
>  @section Building for Android
>
> diff --git a/gnu/kawa/javafx/ChangeLog b/gnu/kawa/javafx/ChangeLog
> index 3c8b6d99f..99d2f1f88 100644
> --- a/gnu/kawa/javafx/ChangeLog
> +++ b/gnu/kawa/javafx/ChangeLog
> @@ -1,3 +1,8 @@
> +2019-12-16  Michael Zucchi  <notzed@gmail.com>
> +
> +    * Makefile.am (KAVA_COMPILER_JAVA_FLAGS): Add support for modular
> +    javafx sdk.
> +
>  2017-05-13  Per Bothner  <per@bothner.com>
>
>      * MakeScene.scm (add): Don't set root.
> diff --git a/gnu/kawa/javafx/Makefile.am b/gnu/kawa/javafx/Makefile.am
> index 5d0325aad..80de370e5 100644
> --- a/gnu/kawa/javafx/Makefile.am
> +++ b/gnu/kawa/javafx/Makefile.am
> @@ -2,6 +2,10 @@
>
>  include $(top_srcdir)/Make-rules
>
> +if WITH_JAVAFX_SDK
> +KAWA_COMPILER_JAVA_FLAGS=--module-path $(WITH_JAVAFX_SDK_ARG)/lib
> --add-modules javafx.web
> +endif
> +
>  java_sources=
>
>  java_SCM = GroupObjectBuilder.scm MakeScene.scm defs.scm
>
>
-- 
-- ian@sibian.fr
-- Développeur compulsif

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

* Re: building for jdk / openfx 13 (patch)
  2019-12-16 23:43 building for jdk / openfx 13 (patch) Michael Zucchi
  2019-12-16 23:49 ` ian
@ 2019-12-17  1:20 ` Per Bothner
  2019-12-17  3:51   ` Michael Zucchi
  1 sibling, 1 reply; 11+ messages in thread
From: Per Bothner @ 2019-12-17  1:20 UTC (permalink / raw)
  To: Michael Zucchi, kawa

On 12/16/19 3:43 PM, Michael Zucchi wrote:

> Apologies if this should go to the bug tracker, I didn't see any specific details for patch submission.

email is fine.

> I wanted to have a look at kawa including the javafx parts but I didn't want to install the oracle jdk as i've moved everything i do to openjdk.  So I've created a small patch that allows compilation with openjdk13 and openjfx13 (although it should work with 11+). It is enabled by adding --with-javafx-sdk=path to configure:

We already have a --with-javafx, with optional argument: --with-javafx=ARG.
The ARG is used to set WITH_JAVAFX_ARG, which was intended to be used
to specify the path the JavaFX, but doesn't seem to be used.
So probably we should use WITH_JAVAFX_ARG instead of WITH_JAVAFX_SDK_ARG.

The configure script might need to check that the ARG specified for
--with-javafx is for java 9 or later - i.e. modularized.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

* Re: building for jdk / openfx 13 (patch)
  2019-12-16 23:49 ` ian
@ 2019-12-17  1:53   ` Per Bothner
  0 siblings, 0 replies; 11+ messages in thread
From: Per Bothner @ 2019-12-17  1:53 UTC (permalink / raw)
  To: kawa

On 12/16/19 3:49 PM, ian wrote:
> Neat,
> 
> But just to say, openjdk is Oracle's too....

I don't know who does what in the OpenJDK world,
but other companies besides Oracle put serious effort and money into
developing and maintaining OpenJDK.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

* Re: building for jdk / openfx 13 (patch)
  2019-12-17  1:20 ` Per Bothner
@ 2019-12-17  3:51   ` Michael Zucchi
  2019-12-17  5:58     ` Per Bothner
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Zucchi @ 2019-12-17  3:51 UTC (permalink / raw)
  To: Per Bothner, kawa

On 17/12/19 11:50 am, Per Bothner wrote:
> On 12/16/19 3:43 PM, Michael Zucchi wrote:
>
>> I wanted to have a look at kawa including the javafx parts but I 
>> didn't want to install the oracle jdk as i've moved everything i do 
>> to openjdk.  So I've created a small patch that allows compilation 
>> with openjdk13 and openjfx13 (although it should work with 11+). It 
>> is enabled by adding --with-javafx-sdk=path to configure:
>
> We already have a --with-javafx, with optional argument: 
> --with-javafx=ARG.
> The ARG is used to set WITH_JAVAFX_ARG, which was intended to be used
> to specify the path the JavaFX, but doesn't seem to be used.
> So probably we should use WITH_JAVAFX_ARG instead of WITH_JAVAFX_SDK_ARG.
>
> The configure script might need to check that the ARG specified for
> --with-javafx is for java 9 or later - i.e. modularized.
Right, no wonder i couldn't find where WITH_JAVAFX_ARG was used.  The 
documentation says it's only needed for javafx on JDK7 but presumably 
that no longer works and isn't worth worrying about any more.

jdk9/10 still include javafx so no path should/need be specified for 
--with-javafx.  For openjdk11+ it is necessary but could also be via 
CLASSPATH (I think).

Below is what i came up with.  If --with-javafx != no|yes it assumes 
it's a path to an sdk.  I removed the jdk7 mention from the docs since 
that shouldn't have worked anyway.  I tested with openjdk13+openjfx13, 
jdk8 and jdk9.

I had to add a WITH_JAVAFX_MODULE conditional so the makefile and script 
can do the right thing.

  Michael


---
  ChangeLog                   |  8 ++++++++
  Make-rules                  |  2 +-
  bin/ChangeLog               |  6 ++++++
  bin/kawa.sh.in              |  7 +++++--
  configure.ac                |  6 +++++-
  doc/ChangeLog               |  5 +++++
  doc/kawa.texi               | 23 ++++++++++++++---------
  gnu/kawa/javafx/ChangeLog   |  5 +++++
  gnu/kawa/javafx/Makefile.am |  4 ++++
  9 files changed, 53 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fb974c2df..0027947ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-12-16  Michael Zucchi  <notzed@gmail.com>
+
+    * Make-rules (KAWA_COMPILER): Add KAWA_COMPILER_JAVA_FLAGS for jvm
+    flags for compiler.
+    * Makefile.am: Enable JAVAFX_SUBDIRS if --with=javafx-sdk used.
+    * configure.ac: Changed --with-javafx=non-empty-path to enable modular
+        java sdk.
+
  2019-08-06  Per Bothner  <per@bothner.com>

      * conigure.ac: Change missing Posix find from error to warning.
diff --git a/Make-rules b/Make-rules
index d08811bed..4793d479f 100644
--- a/Make-rules
+++ b/Make-rules
@@ -15,7 +15,7 @@ java-classes.stamp: $(java_Java)
      echo timestamp > java-classes.stamp
      echo timestamp > $(TO_TOPDIR)/kawa-jar.stamp

-KAWA_COMPILER = $(JAVA) -classpath "$(CLASSPATH)" kawa.repl -d 
$(top_builddir) \
+KAWA_COMPILER = $(JAVA) -classpath "$(CLASSPATH)" 
$(KAWA_COMPILER_JAVA_FLAGS) kawa.repl -d $(top_builddir) \
    -P `echo $(PACKAGE_FNAME)|sed -e s/-/./g`.

  scm-classes.stamp: $(java_SCM)
diff --git a/bin/ChangeLog b/bin/ChangeLog
index 7263f0543..bc6f755d3 100644
--- a/bin/ChangeLog
+++ b/bin/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-16  Michael Zucchi  <notzed@gmail.com>
+
+    * kawa.sh.in (JAVAFX_HOME, JVM_FLAGS): If JAVAFX_HOME is defined
+    or configure was compiled using --with-javafx=path then add javafx
+    modules to module path.
+
  2017-05-03  Per Bothner  <per@bothner.com>

      * kawa.sh.in:  Avoid needless bash-specific 'type' command.
diff --git a/bin/kawa.sh.in b/bin/kawa.sh.in
index 296ce731f..c263e26b6 100644
--- a/bin/kawa.sh.in
+++ b/bin/kawa.sh.in
@@ -34,6 +34,9 @@ else
      JAVA=${JAVA-java}
  fi

+@WITH_JAVAFX_MODULE_TRUE@ JAVAFX_HOME=${JAVAFX_HOME:=@WITH_JAVAFX_ARG@}
+JVM_FLAGS=${JAVAFX_HOME:+"--module-path=${JAVAFX_HOME}/lib" 
--add-modules=javafx.web}
+
  # This ugly duplication is so we only have to use arrays and substrings
  # (which are non-Posix and non-portable) if there is a -D or -J option.
  case "$1" in
@@ -53,9 +56,9 @@ case "$1" in
                  ;;
              esac
          done
-        exec ${JAVA} -Dkawa.command.line="${command_line}" 
-Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" "${jvm_args[@]}" 
kawa.repl ${no_console} "$@"
+        exec ${JAVA} ${JVM_FLAGS} -Dkawa.command.line="${command_line}" 
-Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" "${jvm_args[@]}" 
kawa.repl ${no_console} "$@"
          ;;
      *)
-        exec ${JAVA} -Dkawa.command.line="${command_line}" 
-Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" kawa.repl ${no_console} 
"$@"
+        exec ${JAVA} ${JVM_FLAGS} -Dkawa.command.line="${command_line}" 
-Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" kawa.repl ${no_console} 
"$@"
          ;;
  esac
diff --git a/configure.ac b/configure.ac
index bd1f8cd37..c9ab36517 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,7 +28,7 @@ AC_ARG_WITH(android,
    AS_HELP_STRING(--with-android@<:@=android.jar@:>@,Build for the 
Android platform))

  AC_ARG_WITH(javafx,
-  AS_HELP_STRING(--with-javafx@<:@=jfxrt.jar@:>@,Enable support for 
JavaFX))
+ AS_HELP_STRING(--with-javafx@<:@=javafx-sdk-home@:>@,Enable support 
for JavaFX))
  WITH_JAVAFX_ARG="${with_javafx}"

  AC_ARG_WITH(lsp4j,
@@ -196,6 +196,9 @@ AM_CONDITIONAL(WITH_DOMTERM,
    test "$with_domterm" != "" -a "$with_domterm" != "no")
  AM_CONDITIONAL(WITH_JAVAFX,
    test "$with_javafx" != "" -a "$with_javafx" != "no")
+AM_CONDITIONAL(WITH_JAVAFX_MODULE,
+  test "$with_javafx" != "" -a "$with_javafx" != "no" -a "$with_javafx" 
!= "yes")
+
  AM_CONDITIONAL(WITH_SWT, test "$with_swt" = "yes")
  AM_CONDITIONAL(WITH_AWT, test "$with_awt" != "no")
  AM_CONDITIONAL(WITH_SAX2, test "$with_sax2" != "no")
@@ -264,6 +267,7 @@ AC_SUBST(pathsep)
  AC_SUBST(filesep)
  AC_SUBST(WITH_SERVLET_ARG)
  AC_SUBST(WITH_JAVAFX_ARG)
+AC_SUBST(WITH_JAVAFX_MODULE)
  AC_SUBST(WITH_JLINE3)
  AC_SUBST(WITH_GSON_PATH)
  AC_SUBST(WITH_JLINE_PATH)
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 0cc771bfe..6ea8e8a17 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-16  Michael Zucchi  <notzed@gmail.com>
+
+    * kawa.texi (Building JavaFX applications): Removed the subsection 
about
+        JDK7 and added subsection about JDK11+ JavaFX.
+
  2019-01-17  Per Bothner  <per@bothner.com>

      * kawa.texi (Arithmetic operations): Document 'expt'.
diff --git a/doc/kawa.texi b/doc/kawa.texi
index d709b7100..2a300f057 100644
--- a/doc/kawa.texi
+++ b/doc/kawa.texi
@@ -23119,21 +23119,26 @@ and
  The @code{browse-kawa-manual} script in the @code{doc} directory 
(source only)
  uses JavaFX WebView to create a window for browsing the Kawa 
documentation.

-@subsection Using JavaFX with JDK 7
-JDK 8 ships with JavaFX, and it is in the default @code{CLASSPATH}.
-JDK 7 update 9 or later does have JavaFX included, but it is a separate
-@code{jfxrt.jar} which not in the default @code{CLASSPATH}.
-Thus you have to explicitly add @code{jfxrt.jar}.
+@subsection Using JavaFX with JDK 11+
+Starting with JDK 11, JavaFX has been moved to a separate project and
+is no longer included in the JDK.  The separate project OpenJFX
+provides an SDK that includes modular jar files which can be added to
+the @code{CLASSPATH} or via the @code{--module-path} parameter to
+@code{javac} and @code{java}.
+
  To run the previous @code{HelloButton1.scm} you can do:
  @example
-java -cp $JAVA_HOME/lib/jfxrt.jar:$KAWA_HOME/kawa.jar HelloButton1.scm
+$ java -cp $KAVA_HOME/kawa.jar --module-path $JAVAFX_HOME/lib \
+  --add-modules javafx.web HelloButton1.scm
  @end example

-If you build Kawa from source, do:
+If you build Kawa from source you must use an appropriate JDK version
+and enable the modular OpenJFX SDK:
  @example
-$ ./configure --with-javafx=$JAVA_HOME --enable-kawa-frontend 
...other-args...
+$ ./configure --with-javafx-sdk=path-to-sdk ...other-args...
  @end example
-The resulting Kawa binary sets up the path to @code{jfxrt.jar} so you 
just need to do:
+The resulting Kawa binary sets up the module path and the boostrap
+module so you just need to do:
  @example
  $ kawa HelloButton1.scm
  @end example
diff --git a/gnu/kawa/javafx/ChangeLog b/gnu/kawa/javafx/ChangeLog
index 3c8b6d99f..99d2f1f88 100644
--- a/gnu/kawa/javafx/ChangeLog
+++ b/gnu/kawa/javafx/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-16  Michael Zucchi  <notzed@gmail.com>
+
+    * Makefile.am (KAVA_COMPILER_JAVA_FLAGS): Add support for modular
+    javafx sdk.
+
  2017-05-13  Per Bothner  <per@bothner.com>

      * MakeScene.scm (add): Don't set root.
diff --git a/gnu/kawa/javafx/Makefile.am b/gnu/kawa/javafx/Makefile.am
index 5d0325aad..68554aca2 100644
--- a/gnu/kawa/javafx/Makefile.am
+++ b/gnu/kawa/javafx/Makefile.am
@@ -2,6 +2,10 @@

  include $(top_srcdir)/Make-rules

+if WITH_JAVAFX_MODULE
+KAWA_COMPILER_JAVA_FLAGS=--module-path $(WITH_JAVAFX_ARG)/lib 
--add-modules javafx.web
+endif
+
  java_sources=

  java_SCM = GroupObjectBuilder.scm MakeScene.scm defs.scm
-- 
2.24.1


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

* Re: building for jdk / openfx 13 (patch)
  2019-12-17  3:51   ` Michael Zucchi
@ 2019-12-17  5:58     ` Per Bothner
  2019-12-17  6:31       ` Michael Zucchi
  0 siblings, 1 reply; 11+ messages in thread
From: Per Bothner @ 2019-12-17  5:58 UTC (permalink / raw)
  To: Michael Zucchi, kawa

On 12/16/19 7:51 PM, Michael Zucchi wrote:

Looking pretty good.

I may not have time to try this until tomorrow evening or Wednesday.

One thing I noticed:

>   @example
> -$ ./configure --with-javafx=$JAVA_HOME --enable-kawa-frontend ...other-args...
> +$ ./configure --with-javafx-sdk=path-to-sdk ...other-args...
>   @end example

Should this be:

+$ ./configure --with-javafx=path-to-sdk ...other-args...
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

* Re: building for jdk / openfx 13 (patch)
  2019-12-17  5:58     ` Per Bothner
@ 2019-12-17  6:31       ` Michael Zucchi
  2019-12-19 17:51         ` Per Bothner
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Zucchi @ 2019-12-17  6:31 UTC (permalink / raw)
  To: Per Bothner, kawa

On 17/12/19 4:28 pm, Per Bothner wrote:
> On 12/16/19 7:51 PM, Michael Zucchi wrote:
>
> Looking pretty good.
>
> I may not have time to try this until tomorrow evening or Wednesday.
>
> One thing I noticed:
>
>>   @example
>> -$ ./configure --with-javafx=$JAVA_HOME --enable-kawa-frontend 
>> ...other-args...
>> +$ ./configure --with-javafx-sdk=path-to-sdk ...other-args...
>>   @end example
>
> Should this be:
>
> +$ ./configure --with-javafx=path-to-sdk ...other-args...

Oops yes thanks.  Actually I must admit I didn't check too closely in 
case other changes are necessary.

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

* Re: building for jdk / openfx 13 (patch)
  2019-12-17  6:31       ` Michael Zucchi
@ 2019-12-19 17:51         ` Per Bothner
  2019-12-19 20:05           ` spellcard199
  0 siblings, 1 reply; 11+ messages in thread
From: Per Bothner @ 2019-12-19 17:51 UTC (permalink / raw)
  To: Michael Zucchi, kawa

I checked these changes in.  Thanks!
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

* Re: building for jdk / openfx 13 (patch)
  2019-12-19 17:51         ` Per Bothner
@ 2019-12-19 20:05           ` spellcard199
  2019-12-19 20:09             ` Per Bothner
  2019-12-20  1:43             ` Per Bothner
  0 siblings, 2 replies; 11+ messages in thread
From: spellcard199 @ 2019-12-19 20:05 UTC (permalink / raw)
  To: Per Bothner; +Cc: Michael Zucchi, kawa

Hello, I have no idea how those .in files work, but after the last commit doing the following...

  git clone git@gitlab.com:kashell/Kawa.git
  cd Kawa
  ant
  ./bin/kawa.sh

... gives an error that says something like:

  ./bin/kawa.sh: row 37: @WITH_JAVAFX_MODULE_TRUE@: command not found
  Error occurred during initialization of boot layer
  java.lang.module.FindException: Module javafx.web not found

If it's useful, my `java --version` gives:

  openjdk 11.0.1 2018-10-16
  OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
  OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, December 19, 2019 6:50 PM, Per Bothner <per@bothner.com> wrote:

> I checked these changes in. Thanks!
>
> ------------------------------------
>
>     --Per Bothner
>
>
> per@bothner.com http://per.bothner.com/


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

* Re: building for jdk / openfx 13 (patch)
  2019-12-19 20:05           ` spellcard199
@ 2019-12-19 20:09             ` Per Bothner
  2019-12-20  1:43             ` Per Bothner
  1 sibling, 0 replies; 11+ messages in thread
From: Per Bothner @ 2019-12-19 20:09 UTC (permalink / raw)
  To: kawa

On 12/19/19 12:05 PM, spellcard199 wrote:
> Hello, I have no idea how those .in files work, but after the last commit doing the following...
> 
>    git clone git@gitlab.com:kashell/Kawa.git
>    cd Kawa
>    ant
>    ./bin/kawa.sh
> 
> ... gives an error that says something like:
> 
>    ./bin/kawa.sh: row 37: @WITH_JAVAFX_MODULE_TRUE@: command not found
>    Error occurred during initialization of boot layer
>    java.lang.module.FindException: Module javafx.web not found

Sorry, I don't use/test ant enough.
We need to update build.xml.

It should work if you use configure+make.  What platform are you on?
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

* Re: building for jdk / openfx 13 (patch)
  2019-12-19 20:05           ` spellcard199
  2019-12-19 20:09             ` Per Bothner
@ 2019-12-20  1:43             ` Per Bothner
  1 sibling, 0 replies; 11+ messages in thread
From: Per Bothner @ 2019-12-20  1:43 UTC (permalink / raw)
  To: spellcard199; +Cc: Michael Zucchi, kawa

On 12/19/19 12:05 PM, spellcard199 wrote:
>    git clone git@gitlab.com:kashell/Kawa.git
>    cd Kawa
>    ant
>    ./bin/kawa.sh
> 
> ... gives an error that says something like:
> 
>    ./bin/kawa.sh: row 37: @WITH_JAVAFX_MODULE_TRUE@: command not found
>    Error occurred during initialization of boot layer
>    java.lang.module.FindException: Module javafx.web not found

I checked in a fix for this.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

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

end of thread, other threads:[~2019-12-20  1:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-16 23:43 building for jdk / openfx 13 (patch) Michael Zucchi
2019-12-16 23:49 ` ian
2019-12-17  1:53   ` Per Bothner
2019-12-17  1:20 ` Per Bothner
2019-12-17  3:51   ` Michael Zucchi
2019-12-17  5:58     ` Per Bothner
2019-12-17  6:31       ` Michael Zucchi
2019-12-19 17:51         ` Per Bothner
2019-12-19 20:05           ` spellcard199
2019-12-19 20:09             ` Per Bothner
2019-12-20  1:43             ` Per Bothner

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).