package/openjdk: allow compiling without X11 support
Added patches (17.0.12+7 and 21.0.4+7) to allow compilation
without X11 support.
0003-autoconf-libraries-drop-the-need-for-X11-in-headless.patch
is only needed for 21.0.4+7, 17.0.12+7 already has this commit:
f97ec359ec
Next to that, add a new option BR2_PACKAGE_OPENJDK_X11,
to allow compilation with both head and headless support.
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
[Thomas: split into two commits]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
f2992604a3
commit
3dd73c30d3
@@ -0,0 +1,83 @@
|
||||
From 8df09bb41f8aec8904a2231facc76660d2a83236 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Devoogdt <thomas@devoogdt.com>
|
||||
Date: Thu, 13 Nov 2025 17:23:44 +0100
|
||||
Subject: [PATCH] awt: fix HEADLESS compilation without X11
|
||||
|
||||
Upstream: https://github.com/openjdk/jdk/pull/28310
|
||||
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
|
||||
---
|
||||
make/modules/java.desktop/lib/Awt2dLibraries.gmk | 16 ++++++++++++++--
|
||||
.../unix/native/common/awt/utility/rect.h | 4 ++--
|
||||
2 files changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
|
||||
index 46e3b1677f7..0e92ce6aeca 100644
|
||||
--- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk
|
||||
+++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
|
||||
@@ -77,6 +77,10 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
#
|
||||
endif
|
||||
|
||||
+ifeq ($(ENABLE_HEADLESS_ONLY), true)
|
||||
+ LIBAWT_CFLAGS += -DHEADLESS
|
||||
+endif
|
||||
+
|
||||
ifeq ($(call isTargetOs, linux macosx aix), true)
|
||||
LIBAWT_EXFILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c
|
||||
endif
|
||||
@@ -362,13 +366,20 @@ ifeq ($(call isTargetOs, windows macosx), false)
|
||||
$(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
|
||||
#
|
||||
|
||||
- LIBAWT_HEADLESS_EXCLUDES := medialib
|
||||
+ LIBAWT_HEADLESS_EXCLUDES := medialib opengl
|
||||
+
|
||||
+ LIBAWT_HEADLESS_EXCLUDE_FILES := \
|
||||
+ GLXGraphicsConfig.c \
|
||||
+ GLXSurfaceData.c \
|
||||
+ X11PMBlitLoops.c \
|
||||
+ X11Renderer.c \
|
||||
+ X11SurfaceData.c \
|
||||
+ #
|
||||
|
||||
LIBAWT_HEADLESS_EXTRA_HEADER_DIRS := \
|
||||
$(LIBAWT_DEFAULT_HEADER_DIRS) \
|
||||
common/awt/debug \
|
||||
common/font \
|
||||
- common/java2d/opengl \
|
||||
#
|
||||
|
||||
LIBAWT_HEADLESS_CFLAGS := $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) $(X_CFLAGS) \
|
||||
@@ -378,6 +389,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
|
||||
NAME := awt_headless, \
|
||||
EXTRA_SRC := $(LIBAWT_HEADLESS_EXTRA_SRC), \
|
||||
EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
|
||||
+ EXCLUDE_FILES := $(LIBAWT_HEADLESS_EXCLUDE_FILES), \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
$(LIBAWT_HEADLESS_CFLAGS), \
|
||||
diff --git a/src/java.desktop/unix/native/common/awt/utility/rect.h b/src/java.desktop/unix/native/common/awt/utility/rect.h
|
||||
index ceea38f4349..91b5a17ec58 100644
|
||||
--- a/src/java.desktop/unix/native/common/awt/utility/rect.h
|
||||
+++ b/src/java.desktop/unix/native/common/awt/utility/rect.h
|
||||
@@ -28,7 +28,7 @@
|
||||
#ifndef _AWT_RECT_H
|
||||
#define _AWT_RECT_H
|
||||
|
||||
-#ifndef MACOSX
|
||||
+#if !defined(HEADLESS) && !defined(MACOSX)
|
||||
#include <X11/Xlib.h>
|
||||
typedef XRectangle RECT_T;
|
||||
#else
|
||||
@@ -39,7 +39,7 @@ typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
} RECT_T;
|
||||
-#endif /* !MACOSX */
|
||||
+#endif /* !HEADLESS && !MACOSX */
|
||||
|
||||
#define RECT_EQ_X(r1,r2) ((r1).x==(r2).x && (r1).width==(r2).width)
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
From 13a908b3d192e477b7572b522837efd771f5e2f9 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Devoogdt <thomas@devoogdt.com>
|
||||
Date: Thu, 13 Nov 2025 17:23:44 +0100
|
||||
Subject: [PATCH] awt: fix HEADLESS compilation without X11
|
||||
|
||||
Upstream: https://github.com/openjdk/jdk/pull/28310
|
||||
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
|
||||
---
|
||||
make/modules/java.desktop/lib/Awt2dLibraries.gmk | 16 ++++++++++++++--
|
||||
.../unix/native/common/awt/utility/rect.h | 4 ++--
|
||||
2 files changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
|
||||
index a33f219e83e..de57e88a4ce 100644
|
||||
--- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk
|
||||
+++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
|
||||
@@ -77,6 +77,10 @@ ifeq ($(call isTargetOs, windows), true)
|
||||
#
|
||||
endif
|
||||
|
||||
+ifeq ($(ENABLE_HEADLESS_ONLY), true)
|
||||
+ LIBAWT_CFLAGS += -DHEADLESS
|
||||
+endif
|
||||
+
|
||||
ifeq ($(call isTargetOs, linux macosx aix), true)
|
||||
LIBAWT_EXFILES += awt_Font.c CUPSfuncs.c fontpath.c X11Color.c
|
||||
endif
|
||||
@@ -368,13 +372,20 @@ ifeq ($(call isTargetOs, windows macosx), false)
|
||||
$(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
|
||||
#
|
||||
|
||||
- LIBAWT_HEADLESS_EXCLUDES := medialib
|
||||
+ LIBAWT_HEADLESS_EXCLUDES := medialib opengl
|
||||
+
|
||||
+ LIBAWT_HEADLESS_EXCLUDE_FILES := \
|
||||
+ GLXGraphicsConfig.c \
|
||||
+ GLXSurfaceData.c \
|
||||
+ X11PMBlitLoops.c \
|
||||
+ X11Renderer.c \
|
||||
+ X11SurfaceData.c \
|
||||
+ #
|
||||
|
||||
LIBAWT_HEADLESS_EXTRA_HEADER_DIRS := \
|
||||
$(LIBAWT_DEFAULT_HEADER_DIRS) \
|
||||
common/awt/debug \
|
||||
common/font \
|
||||
- common/java2d/opengl \
|
||||
#
|
||||
|
||||
LIBAWT_HEADLESS_CFLAGS := $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) $(X_CFLAGS) \
|
||||
@@ -384,6 +395,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
|
||||
NAME := awt_headless, \
|
||||
EXTRA_SRC := $(LIBAWT_HEADLESS_EXTRA_SRC), \
|
||||
EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
|
||||
+ EXCLUDE_FILES := $(LIBAWT_HEADLESS_EXCLUDE_FILES), \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
$(LIBAWT_HEADLESS_CFLAGS), \
|
||||
diff --git a/src/java.desktop/unix/native/common/awt/utility/rect.h b/src/java.desktop/unix/native/common/awt/utility/rect.h
|
||||
index ceea38f4349..91b5a17ec58 100644
|
||||
--- a/src/java.desktop/unix/native/common/awt/utility/rect.h
|
||||
+++ b/src/java.desktop/unix/native/common/awt/utility/rect.h
|
||||
@@ -28,7 +28,7 @@
|
||||
#ifndef _AWT_RECT_H
|
||||
#define _AWT_RECT_H
|
||||
|
||||
-#ifndef MACOSX
|
||||
+#if !defined(HEADLESS) && !defined(MACOSX)
|
||||
#include <X11/Xlib.h>
|
||||
typedef XRectangle RECT_T;
|
||||
#else
|
||||
@@ -39,7 +39,7 @@ typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
} RECT_T;
|
||||
-#endif /* !MACOSX */
|
||||
+#endif /* !HEADLESS && !MACOSX */
|
||||
|
||||
#define RECT_EQ_X(r1,r2) ((r1).x==(r2).x && (r1).width==(r2).width)
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 46b9a0ad24f7f299ff23e13bc8ef01c188d246b6 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Devoogdt <thomas@devoogdt.com>
|
||||
Date: Thu, 13 Nov 2025 23:10:20 +0100
|
||||
Subject: [PATCH] autoconf: libraries: drop the need for X11 in headless mode
|
||||
|
||||
Upstream: https://github.com/openjdk/jdk/pull/28310
|
||||
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
|
||||
---
|
||||
make/autoconf/libraries.m4 | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
|
||||
index 51d4f724c33..6a8b925c3f2 100644
|
||||
--- a/make/autoconf/libraries.m4
|
||||
+++ b/make/autoconf/libraries.m4
|
||||
@@ -42,12 +42,12 @@ m4_include([lib-tests.m4])
|
||||
AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
|
||||
[
|
||||
# Check if X11 is needed
|
||||
- if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
- # No X11 support on windows or macosx
|
||||
+ if test "x$OPENJDK_TARGET_OS" = xwindows ||
|
||||
+ test "x$OPENJDK_TARGET_OS" = xmacosx ||
|
||||
+ test "x$ENABLE_HEADLESS_ONLY" = xtrue; then
|
||||
NEEDS_LIB_X11=false
|
||||
else
|
||||
- # All other instances need X11, even if building headless only, libawt still
|
||||
- # needs X11 headers.
|
||||
+ # All other instances need X11 for libawt.
|
||||
NEEDS_LIB_X11=true
|
||||
fi
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -29,7 +29,6 @@ config BR2_PACKAGE_OPENJDK
|
||||
depends on BR2_HOST_GCC_AT_LEAST_4_9 # C++14
|
||||
depends on BR2_TOOLCHAIN_USES_GLIBC
|
||||
depends on BR2_USE_MMU # cups
|
||||
depends on BR2_PACKAGE_XORG7
|
||||
select BR2_PACKAGE_ALSA_LIB
|
||||
select BR2_PACKAGE_ALSA_LIB_MIXER
|
||||
select BR2_PACKAGE_ALSA_LIB_PCM
|
||||
@@ -42,10 +41,6 @@ config BR2_PACKAGE_OPENJDK
|
||||
select BR2_PACKAGE_LCMS2
|
||||
select BR2_PACKAGE_LIBPNG
|
||||
select BR2_PACKAGE_LIBUSB
|
||||
select BR2_PACKAGE_XLIB_LIBXRANDR
|
||||
select BR2_PACKAGE_XLIB_LIBXRENDER
|
||||
select BR2_PACKAGE_XLIB_LIBXT
|
||||
select BR2_PACKAGE_XLIB_LIBXTST
|
||||
select BR2_PACKAGE_ZLIB
|
||||
help
|
||||
OpenJDK is a free and open-source implementation of the
|
||||
@@ -71,6 +66,17 @@ config BR2_PACKAGE_OPENJDK_VERSION_21
|
||||
|
||||
endchoice
|
||||
|
||||
config BR2_PACKAGE_OPENJDK_X11
|
||||
bool "Build with AWT head support"
|
||||
depends on BR2_PACKAGE_XORG7
|
||||
select BR2_PACKAGE_XLIB_LIBXRANDR
|
||||
select BR2_PACKAGE_XLIB_LIBXRENDER
|
||||
select BR2_PACKAGE_XLIB_LIBXT
|
||||
select BR2_PACKAGE_XLIB_LIBXTST
|
||||
|
||||
comment "openjdk AWT head support needs X.org"
|
||||
depends on !BR2_PACKAGE_XORG7
|
||||
|
||||
config BR2_PACKAGE_OPENJDK_FULL_JDK
|
||||
bool "Build the full JDK"
|
||||
help
|
||||
@@ -155,12 +161,6 @@ config BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO
|
||||
endchoice
|
||||
endif
|
||||
|
||||
comment "openjdk needs X.Org"
|
||||
depends on BR2_PACKAGE_OPENJDK_ARCH_SUPPORTS
|
||||
depends on BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
|
||||
depends on BR2_USE_MMU
|
||||
depends on !BR2_PACKAGE_XORG7
|
||||
|
||||
comment "openjdk needs glibc, and a toolchain w/ wchar, dynamic library, threads, C++, gcc >= 4.9, host gcc >= 4.9"
|
||||
depends on BR2_USE_MMU
|
||||
depends on BR2_PACKAGE_OPENJDK_ARCH_SUPPORTS
|
||||
|
||||
@@ -21,8 +21,6 @@ OPENJDK_LICENSE = GPL-2.0+ with exception
|
||||
OPENJDK_LICENSE_FILES = LICENSE
|
||||
OPENJDK_INSTALL_STAGING = YES
|
||||
|
||||
# OpenJDK requires Alsa, cups, and X11 even for a headless build.
|
||||
# host-zip is needed for the zip executable.
|
||||
OPENJDK_DEPENDENCIES = \
|
||||
host-gawk \
|
||||
host-openjdk-bin \
|
||||
@@ -37,10 +35,6 @@ OPENJDK_DEPENDENCIES = \
|
||||
lcms2 \
|
||||
libpng \
|
||||
libusb \
|
||||
xlib_libXrandr \
|
||||
xlib_libXrender \
|
||||
xlib_libXt \
|
||||
xlib_libXtst \
|
||||
zlib
|
||||
|
||||
# JVM variants
|
||||
@@ -88,7 +82,6 @@ OPENJDK_CONF_OPTS = \
|
||||
--disable-full-docs \
|
||||
--disable-manpages \
|
||||
--disable-warnings-as-errors \
|
||||
--enable-headless-only \
|
||||
--enable-openjdk-only \
|
||||
--enable-unlimited-crypto \
|
||||
--openjdk-target=$(GNU_TARGET_NAME) \
|
||||
@@ -112,6 +105,13 @@ OPENJDK_CONF_OPTS = \
|
||||
--with-version-build="$(OPENJDK_VERSION_BUILD)" \
|
||||
--with-version-string="$(OPENJDK_VERSION_MAJOR).$(OPENJDK_VERSION_MINOR)"
|
||||
|
||||
ifeq ($(BR2_PACKAGE_OPENJDK_X11),y)
|
||||
OPENJDK_CONF_OPTS += --disable-headless-only
|
||||
OPENJDK_DEPENDENCIES += xlib_libXrandr xlib_libXrender xlib_libXt xlib_libXtst
|
||||
else
|
||||
OPENJDK_CONF_OPTS += --enable-headless-only
|
||||
endif
|
||||
|
||||
# If building for AArch64, use the provided CPU port.
|
||||
ifeq ($(BR2_aarch64),y)
|
||||
OPENJDK_CONF_OPTS += --with-abi-profile=aarch64
|
||||
|
||||
Reference in New Issue
Block a user