Page MenuHomeFreeBSD

java/openjdk25: Add jre and headless flavors
ClosedPublic

Authored by haraldei on Wed, Oct 29, 6:01 PM.
Tags
None
Referenced Files
F134804995: D53450.diff
Tue, Nov 4, 5:29 PM
F134798177: D53450.id165726.diff
Tue, Nov 4, 4:45 PM
F134797101: D53450.id165347.diff
Tue, Nov 4, 4:37 PM
F134796357: D53450.id.diff
Tue, Nov 4, 4:30 PM
F134796171: D53450.id165802.diff
Tue, Nov 4, 4:29 PM
F134795959: D53450.diff
Tue, Nov 4, 4:26 PM
F134769459: D53450.id165726.diff
Tue, Nov 4, 12:47 PM
F134769401: D53450.diff
Tue, Nov 4, 12:47 PM
Subscribers
None

Details

Summary

Add FLAVORS to allow building jre and headless variants from the same
port. For backwards compatibility, it is also possible to build the jre
version by setting the BUILD_JRE env var.

Also reorganize the Makefile to make portclippy happy

portlint and portclippy don't agree fully on the order in the makefile,
but I hope this is ok.

Sponsored by: The FreeBSD Foundation

Test Plan
  • Run tomcat and other non-gui apps under headless
  • Run gui apps under jre

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

haraldei created this revision.

portlint and portclippy don't agree fully on the order in the makefile, but I hope this is ok.

Don't worry about this too much. The tools are a guideline not a gospel.

java/openjdk25/Makefile
35

It might be a good idea to name the default flavour something descriptive. As is, I have no idea what is built when the default flavour is selected. Maybe you could do jdk, jre, and headless? Up to you in the end.

36

Looks good to me.

In D53450#1220816, @fuz wrote:

portlint and portclippy don't agree fully on the order in the makefile, but I hope this is ok.

Don't worry about this too much. The tools are a guideline not a gospel.

jrm@ser /usr/ports/java/openjdk25 [arcpatch-D53450|✔] % portlint -AC
WARN: /usr/ports/java/openjdk25/pkg-descr: contains less than 2 lines, make it longer if possible.(currently 1 line)
WARN: Makefile: save for ports directly related to the Java language, porters are encouraged not to use ``java'' as the main category for a port
FATAL: Makefile: extra item "WWW" placed in the LICENSE section.
WARN: Makefile: "LICENSE" has to appear earlier.
WARN: Makefile: "LIB_DEPENDS" has to appear earlier.
WARN: Makefile: "BUILD_DEPENDS" has to appear earlier.
WARN: Makefile: "RUN_DEPENDS" has to appear earlier.
WARN: Makefile: "FLAVORS" has to appear earlier.
WARN: Makefile: "FLAVOR" has to appear earlier.
WARN: Makefile: "USES" has to appear earlier.

The pkg-descr warning is reasonable, but I think Java is so well known that expanding on what you have probably isn't all that useful.
I agree that the other FATAL/WARNs aren't worth worrying about. They result from misinterpreting WWW=... and/or the .if ${FLAVORS:U}... lines. If you really wanted to try to make portlint happy, you could replace the .if ${FLAVORS:U} instances with flavor helpers (e.g., jre_USES=...), but that seems like busy work for little benefit.

Another thought for the future: It's helpful to separate no-op changes (formatting to make linters happy) from functional changes (adding new flavors) into different reviews and commits. This is just a minor personal preference, so feel free to ignore me.

This revision is now accepted and ready to land.Fri, Oct 31, 2:15 AM
java/openjdk25/Makefile
35

Good suggestion!

36

The original (and previous openjdk ports) Makefile would build the JRE as long as the BUILD_JRE variable is defined. As the only reason for keeping this mechanism is backwards compatibility, I'm not sure making it stricter is a good idea.

In D53450#1221235, @jrm wrote:

If you really wanted to try to make portlint happy, you could replace the .if ${FLAVORS:U} instances with flavor helpers (e.g., jre_USES=...), but that seems like busy work for little benefit.

flavor_USES= is not documented in the handbook, so I missed it. If it works, I'm happy to try it if it can make the Makefile a bit less complex.

Another thought for the future: It's helpful to separate no-op changes (formatting to make linters happy) from functional changes (adding new flavors) into different reviews and commits. This is just a minor personal preference, so feel free to ignore me.

That's my preference as well, and they are in different commits in my tree. I can reduce this review to be just the flavors stuff, and hold the cleanup/reorg to a later review.

I discovered during testing that it seems the headless build happyly also runs gui programs. That's not as intended, so I'll have to explore that before pushing this in any case.

I could alternatively postpone the headless flavor for later, and just add support for jre now. That's in any case all that's supported by the existing/previous ports.

  • java/openjdk25: Update with comments for review
This revision now requires review to proceed.Mon, Nov 3, 1:12 PM

The reason I was able to run tuxguitar (a gui app) under the -headless variant was that it bundles swt.jar which dynamically loads gtk. The -headless variant only affects awt based apps.

Looks good to me. Please proceed with a commit.

This revision is now accepted and ready to land.Mon, Nov 3, 1:57 PM
In D53450#1222561, @fuz wrote:

Looks good to me. Please proceed with a commit.

Cool, one final question though: Should there be a PORTREVISION line in there?

Afaict there's no difference in the port for anyone who has already installed it, but another FLAVOR has been added. Technically the port itself is updated, but I don't think it's worth rebuilding/reinstalling for those who already have it installed.

Yes, indeed. If the port doesn't have to be rebuilt, no PORTREVISION bump is needed, though when in doubt don't worry about doing one anyway.