public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Michael Zucchi <notzed@gmail.com>
To: kawa@sourceware.org
Subject: building for jdk / openfx 13 (patch)
Date: Mon, 16 Dec 2019 23:43:00 -0000	[thread overview]
Message-ID: <55c6385c-84ae-439d-0336-abc41085ac82@gmail.com> (raw)


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


             reply	other threads:[~2019-12-16 23:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 23:43 Michael Zucchi [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55c6385c-84ae-439d-0336-abc41085ac82@gmail.com \
    --to=notzed@gmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).