Bug 244942 - Mk/bsd.java.mk: allow use of DEFAULT_VERSIONS+= java=13
Summary: Mk/bsd.java.mk: allow use of DEFAULT_VERSIONS+= java=13
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: frebsd-java
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2020-03-21 03:22 UTC by Tommy P
Modified: 2020-03-24 02:05 UTC (History)
2 users (show)

See Also:
koobs: maintainer-feedback? (glewis)


Attachments
Patch for Mk/bsd.default-versions.mk and Mk/bsd.java.mk (4.15 KB, patch)
2020-03-21 03:31 UTC, Tommy P
no flags Details | Diff
Patch for Mk/bsd.default-versions.mk and Mk/bsd.java.mk (4.14 KB, patch)
2020-03-21 03:37 UTC, Tommy P
no flags Details | Diff
Patch for Mk/bsd.default-versions.mk and Mk/bsd.java.mk (4.34 KB, patch)
2020-03-21 04:44 UTC, Tommy P
no flags Details | Diff
Patch for Mk/bsd.default-versions.mk and Mk/bsd.java.mk (1.17 KB, patch)
2020-03-24 02:05 UTC, Tommy P
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tommy P 2020-03-21 03:22:59 UTC
Since I was unable to find a way to explicitly define the desired default version for Java, I've patched Mk/bsd.default-versions.mk and Mk/bsd.java.mk to enable use of:

DEFAULT_VERSIONS+= java=11

in the make.conf.  Jonathan Chen has hinted to use:

JAVA_PREFERRED_PORTS=   JAVA_PORT_NATIVE_OPENJDK_JDK_11

Which I think is too long and not with the DEFAULT_VERSIONS standard like other languages.  I've spot check (via 'make java-debug') for some of the ports and it works.  It ensures the strictness of the port while attempting to meet the user's needs.
==========================================================================
databases/jdbc-oracle11g

# User specified parameters:
JAVA_VERSION=                   1.7 1.8 (7 8)
JAVA_OS=                                (native linux)
JAVA_VENDOR=                            (openjdk oracle)
JAVA_BUILD=
JAVA_RUN=                       jre
JAVA_EXTRACT=
JAVA_DEFAULT=                   11

# JDK port dependency selection process:
_JAVA_PORTS_POSSIBLE=           JAVA_PORT_NATIVE_OPENJDK_JDK_8 JAVA_PORT_NATIVE_OPENJDK_JDK_7 JAVA_PORT_LINUX_ORACLE_JDK_8

_JAVA_PORTS_INSTALLED=
_JAVA_PORTS_INSTALLED_POSSIBLE=
_JAVA_PORT=                     JAVA_PORT_NATIVE_OPENJDK_JDK_8
_JAVA_PORT_INFO=                PORT=java/openjdk8 HOME=/usr/local/openjdk8 VERSION=8 OS=native VENDOR=openjdk
_JAVA_VERSION_MIN=              8
_CAN_USE_NEWER=

# Selected JDK port:
JAVA_PORT=                      java/openjdk8
JAVA_HOME=                      /usr/local/openjdk8
JAVA_PORT_VERSION=              8
JAVA_PORT_OS=                   native  (Native)
JAVA_PORT_VENDOR=               openjdk (OpenJDK BSD Porting Team)

# Additional variables:
JAVAC=
JAVA_CLASSES=                   /usr/local/openjdk8/jre/lib/rt.jar
==========================================================================
www/tomcat9

# User specified parameters:
JAVA_VERSION=                   1.8+    (8 11 12 13)
JAVA_OS=                                (native linux)
JAVA_VENDOR=                            (openjdk oracle)
JAVA_BUILD=
JAVA_RUN=                       jre
JAVA_EXTRACT=
JAVA_DEFAULT=                   11

# JDK port dependency selection process:
_JAVA_PORTS_POSSIBLE=           JAVA_PORT_NATIVE_OPENJDK_JDK_8 JAVA_PORT_NATIVE_OPENJDK_JDK_11 JAVA_PORT_NATIVE_OPENJDK_JDK_12 JAVA_PORT_NATIVE_OPENJDK_JDK_13 JAVA_PORT_LINUX_ORACLE_JDK_8

_JAVA_PORTS_INSTALLED=
_JAVA_PORTS_INSTALLED_POSSIBLE=
_JAVA_PORT=                     JAVA_PORT_NATIVE_OPENJDK_JDK_11
_JAVA_PORT_INFO=                PORT=java/openjdk11 HOME=/usr/local/openjdk11 VERSION=11 OS=native VENDOR=openjdk
_JAVA_VERSION_MIN=              8
_CAN_USE_NEWER=                 +

# Selected JDK port:
JAVA_PORT=                      java/openjdk11
JAVA_HOME=                      /usr/local/openjdk11
JAVA_PORT_VERSION=              11
JAVA_PORT_OS=                   native  (Native)
JAVA_PORT_VENDOR=               openjdk (OpenJDK BSD Porting Team)

# Additional variables:
JAVAC=
JAVA_CLASSES=                   /usr/local/openjdk11/jre/lib/rt.jar
==========================================================================
devel/smc

# User specified parameters:
JAVA_VERSION=                           (7 8 11 12 13)
JAVA_OS=                                (native linux)
JAVA_VENDOR=                            (openjdk oracle)
JAVA_BUILD=
JAVA_RUN=                       jre
JAVA_EXTRACT=
JAVA_DEFAULT=                   11

# JDK port dependency selection process:
_JAVA_PORTS_POSSIBLE=           JAVA_PORT_NATIVE_OPENJDK_JDK_8 JAVA_PORT_NATIVE_OPENJDK_JDK_11 JAVA_PORT_NATIVE_OPENJDK_JDK_12 JAVA_PORT_NATIVE_OPENJDK_JDK_13 JAVA_PORT_NATIVE_OPENJDK_JDK_7 JAVA_PORT_LINUX_ORACLE_JDK_8

_JAVA_PORTS_INSTALLED=
_JAVA_PORTS_INSTALLED_POSSIBLE=
_JAVA_PORT=                     JAVA_PORT_NATIVE_OPENJDK_JDK_11
_JAVA_PORT_INFO=                PORT=java/openjdk11 HOME=/usr/local/openjdk11 VERSION=11 OS=native VENDOR=openjdk
_JAVA_VERSION_MIN=
_CAN_USE_NEWER=

# Selected JDK port:
JAVA_PORT=                      java/openjdk11
JAVA_HOME=                      /usr/local/openjdk11
JAVA_PORT_VERSION=              11
JAVA_PORT_OS=                   native  (Native)
JAVA_PORT_VENDOR=               openjdk (OpenJDK BSD Porting Team)

# Additional variables:
JAVAC=
JAVA_CLASSES=                   /usr/local/openjdk11/jre/lib/rt.jar
Comment 1 Tommy P 2020-03-21 03:31:12 UTC
Created attachment 212564 [details]
Patch for Mk/bsd.default-versions.mk and Mk/bsd.java.mk
Comment 2 Tommy P 2020-03-21 03:37:58 UTC
Created attachment 212565 [details]
Patch for Mk/bsd.default-versions.mk and Mk/bsd.java.mk
Comment 3 Tommy P 2020-03-21 04:44:56 UTC
Created attachment 212566 [details]
Patch for Mk/bsd.default-versions.mk and Mk/bsd.java.mk

Fix for another variation 8+:

devel/jna

# User specified parameters:
JAVA_VERSION=                   8+      (8 11 12 13)
JAVA_OS=                                (native linux)
JAVA_VENDOR=                            (openjdk oracle)
JAVA_BUILD=                     jdk
JAVA_RUN=                       jre
JAVA_EXTRACT=
JAVA_DEFAULT=                   11

# JDK port dependency selection process:
_JAVA_PORTS_POSSIBLE=           JAVA_PORT_NATIVE_OPENJDK_JDK_8 JAVA_PORT_NATIVE_OPENJDK_JDK_11 JAVA_PORT_NATIVE_OPENJDK_JDK_12 JAVA_PORT_NATIVE_OPENJDK_JDK_13 JAVA_PORT_LINUX_ORACLE_JDK_8
_JAVA_PORTS_INSTALLED=
_JAVA_PORTS_INSTALLED_POSSIBLE=
_JAVA_PORT=                     JAVA_PORT_NATIVE_OPENJDK_JDK_11
_JAVA_PORT_INFO=                PORT=java/openjdk11 HOME=/usr/local/openjdk11 VERSION=11 OS=native VENDOR=openjdk
_JAVA_VERSION_MIN=              8
_CAN_USE_NEWER=                 +

# Selected JDK port:
JAVA_PORT=                      java/openjdk11
JAVA_HOME=                      /usr/local/openjdk11
JAVA_PORT_VERSION=              11
JAVA_PORT_OS=                   native  (Native)
JAVA_PORT_VENDOR=               openjdk (OpenJDK BSD Porting Team)

# Additional variables:
JAVAC=                          /usr/local/openjdk11/bin/javac
JAVA_CLASSES=                   /usr/local/openjdk11/jre/lib/rt.jar
Comment 4 Greg Lewis freebsd_committer 2020-03-21 07:49:32 UTC
Thanks for the patch.  I wonder if it might not be simpler though to just change how bsd.java.mk sets up _JAVA_PORTS_ALL and add in JAVA_PORT_NATIVE_OPENJDK_JDK_${JAVA_DEFAULT} in between ${JAVA_PREFERRED_PORTS} and ${__JAVA_PORTS_ALL}.  Wouldn't that essentially achieve what you want?
Comment 5 Tommy P 2020-03-24 02:03:34 UTC
(In reply to Greg Lewis from comment #4)
Hi Greg,

Yes, it would.  It works like my patch.

Thank you.
Comment 6 Tommy P 2020-03-24 02:05:12 UTC
Created attachment 212666 [details]
Patch for Mk/bsd.default-versions.mk and Mk/bsd.java.mk

Better patch based on Greg's suggestion.