Bug 294358 - java/openjdk25: really build headless without installing Xorg libs
Summary: java/openjdk25: really build headless without installing Xorg libs
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-java (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-04-09 12:49 UTC by Raivo Hool
Modified: 2026-09-01 08:10 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (java)


Attachments
Patch for openjdk25 headless install w/o Xorg libs (1.13 KB, patch)
2026-04-09 12:49 UTC, Raivo Hool
no flags Details | Diff
Patch for openjdk25 headless install w/o Xorg libs (1.13 KB, patch)
2026-08-15 01:36 UTC, Mark Linimon
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raivo Hool 2026-04-09 12:49:06 UTC
Created attachment 269549 [details]
Patch for openjdk25 headless install w/o Xorg libs

As it is, java/openjdk25 always pulls in and installs Xorg libs, even in the case of a headless install, which should by definition not require any Xorg libs installed. This is because of 'USES = xorg'. I have concocted a simple Makefile patch that avoids installing various Xorg libs as mandatory dependencies in case of a headless install, and only requires five header files as BUILD_DEPENDS.
Comment 1 Harald Eilertsen freebsd_committer freebsd_triage 2026-08-04 14:56:22 UTC
(In reply to Raivo Hool from comment #0)
Sorry I didn't respond to this sooner. I think the suggestion is interesting! Have you done much testing of the headless JVM on a system without these libs installed?
Comment 2 Raivo Hool 2026-08-04 15:09:16 UTC
I've been running Apache Solr and Tika with OpenJDK 25 headless built that way, since April without a single glitch.
Comment 3 Harald Eilertsen freebsd_committer freebsd_triage 2026-08-04 18:48:30 UTC
(In reply to Raivo Hool from comment #2)
Nice! I'll see about merging the patch as soon as I can.
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2026-08-15 01:36:21 UTC
Created attachment 273776 [details]
Patch for openjdk25 headless install w/o Xorg libs

^Triage: update patch so that it will apply properly.
Comment 5 Harald Eilertsen freebsd_committer freebsd_triage 2026-08-26 13:49:21 UTC
(In reply to Raivo Hool from comment #2)
Hi, see the comments on the review here: https://reviews.freebsd.org/D59167

Are the BUILD_DEPENDS lines really necessary?
Comment 6 Raivo Hool 2026-08-26 19:20:07 UTC
(In reply to Harald Eilertsen from comment #5)

They are no longer necessary. I made the patch for 25.0.3, and for that version, those lines were a must, but building headless was fixed in 25.0.4:

https://mail.openjdk.org/archives/list/jdk-updates-dev@openjdk.org/thread/BRREMPN6BLLC2CYAKLXGRHHNMCIQQSR5/

"- JDK-8376684: Compile OpenJDK in headless mode without required X11 libraries"
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-09-01 08:09:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9c0054517dd7d300ae4950a7d3004c70f02976c9

commit 9c0054517dd7d300ae4950a7d3004c70f02976c9
Author:     Raivo Hool <raivo@lehma.com>
AuthorDate: 2026-08-25 08:45:31 +0000
Commit:     Harald Eilertsen <haraldei@FreeBSD.org>
CommitDate: 2026-09-01 08:07:34 +0000

    java/openjdk{25,26}: Don't req xorg for headless

    We no longer need the xorg libs to build OpenJDK headless variants for
    OpenJDK 25 and 26.

    Relevant upstream JBS issues:
    - OpenJDK 25.0.4: https://bugs.openjdk.org/browse/JDK-8381011
    - OpenJDK 26.0.2: https://bugs.openjdk.org/browse/JDK-8378158

    PR:             294358
    Reported by:    raivo@lehma.com
    Reviewed by:    haraldei, jrm
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D59167

 java/openjdk25/Makefile | 9 ++++++++-
 java/openjdk26/Makefile | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)