From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88419 invoked by alias); 17 Dec 2019 03:51:45 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 88408 invoked by uid 89); 17 Dec 2019 03:51:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=with X-HELO: mail-pf1-f196.google.com Received: from mail-pf1-f196.google.com (HELO mail-pf1-f196.google.com) (209.85.210.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Dec 2019 03:51:41 +0000 Received: by mail-pf1-f196.google.com with SMTP id y206so6779105pfb.0 for ; Mon, 16 Dec 2019 19:51:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=+8+Qq2nnAlF51ExBBmB+kAmx/91I51Xr13CenmOz6FQ=; b=fsjW5RENtNtbByTJakUSXjRDHtE53BfvV5hvtwqyUVNksCnwBU5hBgpBfd/Kdd5VNK W/yh8qkYqtww13ZhZAIpWRoUVfclunn+fLgT6TcIFewHB2LIwe7ZbgsfKXfu6mRt3eZg miUtIqdVwkZuHCNBi8Gj8arYTIDgvpE2fn218xXVdJP/la4pm0nlcUy2iqW8xVNt2aXs FaAZck1Aqr7BvaFWasFgHm9UeGcfr3IRupePk7+doxDTFwDfsy13iMkQ5Zo+Rn+T9NRO n8h/mT+Bl2G4TzL/3BqGecinAJF2Qc2touQdLLtdWzl6Z2VeJxX5DIQ2ylREJGBmWLUR YsxA== Return-Path: Received: from ?IPv6:2001:44b8:203:1200:be5f:f4ff:fef7:7bdc? (2001-44b8-0203-1200-be5f-f4ff-fef7-7bdc.static.ipv6.internode.on.net. [2001:44b8:203:1200:be5f:f4ff:fef7:7bdc]) by smtp.googlemail.com with ESMTPSA id o6sm24386828pgg.37.2019.12.16.19.51.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Dec 2019 19:51:39 -0800 (PST) Subject: Re: building for jdk / openfx 13 (patch) To: Per Bothner , kawa@sourceware.org References: <55c6385c-84ae-439d-0336-abc41085ac82@gmail.com> From: Michael Zucchi Message-ID: <8d47a991-a45d-8028-dfac-cd08d634a5ec@gmail.com> Date: Tue, 17 Dec 2019 03:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-q4/txt/msg00015.txt.bz2 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  + +    * 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       * 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  + +    * 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       * 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  + +    * kawa.texi (Building JavaFX applications): Removed the subsection about +        JDK7 and added subsection about JDK11+ JavaFX. +  2019-01-17  Per Bothner       * 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  + +    * Makefile.am (KAVA_COMPILER_JAVA_FLAGS): Add support for modular +    javafx sdk. +  2017-05-13  Per Bothner       * 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