Files
buildroot/package/openjdk/openjdk.mk
Thomas Devoogdt 6106c2c21c package/openjdk{-bin}: add OpenJDK25 and configure it as latest
OpenJDK 25 is the latest release.
See: https://endoflife.date/oracle-jdk

- BR2_OPENJDK_VERSION_LATEST is now set to 25.

- Add version-specific patches for 25.0.2+10:
  - 0001: Add ARCv2 ISA processors support to Zero
  - 0002: Compile OpenJDK in headless mode without requirements
  - 0003: Fix ambiguous cmp() overload in aarch64 macro assembler
          (older GCC 6.x compatibility)
  - 0004: Fix constexpr on non-literal type in Shenandoah GC
          (older GCC 6.x compatibility)

- Add -fpermissive to fix template definition error with older GCC.

- Update HOST_OPENJDK_BIN_VERSION for OpenJDK 25.

- Update the expectedVersion variable in JniTest.java from 0x00150000
  (JNI 21) to 0x00180000 (JNI 24/25).

Tested with:
$ ./support/testing/run-tests -o ~/br-test-py/ -d ~/br-test-dl/ \
    tests.package.test_openjdk.TestOpenJdk

Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
[Bernd:
 - rebased on bump of versions 17 & 21
 - build-tested with gcc 16-snapshot]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[Julien:
 - add .checkpackageignore entry to fix check-package error
 - reformat patches with without numbering to fix check-package error
]
Signed-off-by: Julien Olivain <ju.o@free.fr>
2026-05-30 15:48:42 +02:00

165 lines
5.0 KiB
Makefile

################################################################################
#
# openjdk
#
################################################################################
ifeq ($(BR2_PACKAGE_OPENJDK_VERSION_25),y)
OPENJDK_VERSION_MAJOR = 25
OPENJDK_VERSION_MINOR = 0.2
OPENJDK_VERSION_BUILD = 10
else ifeq ($(BR2_PACKAGE_OPENJDK_VERSION_21),y)
OPENJDK_VERSION_MAJOR = 21
OPENJDK_VERSION_MINOR = 0.10
OPENJDK_VERSION_BUILD = 7
else
OPENJDK_VERSION_MAJOR = 17
OPENJDK_VERSION_MINOR = 0.18
OPENJDK_VERSION_BUILD = 8
endif
OPENJDK_VERSION = $(OPENJDK_VERSION_MAJOR).$(OPENJDK_VERSION_MINOR)+$(OPENJDK_VERSION_BUILD)
OPENJDK_SITE = $(call github,openjdk,jdk$(OPENJDK_VERSION_MAJOR)u,jdk-$(OPENJDK_VERSION))
OPENJDK_LICENSE = GPL-2.0+ with exception
OPENJDK_LICENSE_FILES = LICENSE
OPENJDK_INSTALL_STAGING = YES
OPENJDK_DEPENDENCIES = \
host-gawk \
host-openjdk-bin \
host-pkgconf \
host-zip \
host-zlib \
alsa-lib \
cups \
fontconfig \
giflib \
jpeg \
lcms2 \
libpng \
libusb \
zlib
# JVM variants
ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_CLIENT),y)
OPENJDK_JVM_VARIANT = client
endif
ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_SERVER),y)
OPENJDK_JVM_VARIANT = server
endif
ifeq ($(BR2_PACKAGE_OPENJDK_JVM_VARIANT_ZERO),y)
OPENJDK_JVM_VARIANT = zero
OPENJDK_DEPENDENCIES += libffi
endif
ifeq ($(BR2_PACKAGE_OPENJDK_FULL_JDK),y)
OPENJDK_VARIANT = jdk
OPENJDK_MAKE_TARGET = jdk-image
else
OPENJDK_VARIANT = jre
OPENJDK_MAKE_TARGET = legacy-jre-image
endif
# OpenJDK installs a file named 'modules' in jre/lib, which gets installed as
# /usr/lib/modules. However, with a merged /usr, this conflicts with the
# directory named 'modules' installed by the kernel. If OpenJDK gets built
# after the kernel, this manifests itself with: "cp: cannot overwrite
# directory '/usr/lib/modules with non-directory."
OPENJDK_INSTALL_BASE = /usr/lib/jvm
# OpenJDK ignores some variables unless passed via the environment.
# These variables are PATH, LD, CC, CXX, and CPP.
# OpenJDK defaults ld to the ld binary but passes -Xlinker and -z as
# arguments during the linking process, which causes compilation failures.
# To fix this issue, LD is set to point to gcc.
OPENJDK_CONF_ENV = \
PATH=$(BR_PATH) \
CC=$(TARGET_CC) \
CPP=$(TARGET_CPP) \
CXX=$(TARGET_CXX) \
LD=$(TARGET_CC) \
BUILD_SYSROOT_CFLAGS="$(HOST_CFLAGS)" \
BUILD_SYSROOT_LDFLAGS="$(HOST_LDFLAGS)"
OPENJDK_CONF_OPTS = \
--disable-full-docs \
--disable-warnings-as-errors \
--enable-openjdk-only \
--enable-unlimited-crypto \
--openjdk-target=$(GNU_TARGET_NAME) \
--with-boot-jdk=$(HOST_OPENJDK_BIN_ROOT_DIR) \
--with-stdc++lib=dynamic \
--with-debug-level=release \
--with-devkit=$(HOST_DIR) \
--with-extra-cflags="$(TARGET_CFLAGS)" \
--with-extra-cxxflags="$(TARGET_CXXFLAGS) -fpermissive" \
--with-extra-ldflags="-Wl,-rpath,$(OPENJDK_INSTALL_BASE)/lib,-rpath,$(OPENJDK_INSTALL_BASE)/lib/$(OPENJDK_JVM_VARIANT)" \
--with-giflib=system \
--with-jobs=$(PARALLEL_JOBS) \
--with-jvm-variants=$(OPENJDK_JVM_VARIANT) \
--with-lcms=system \
--with-libjpeg=system \
--with-libpng=system \
--with-zlib=system \
--with-native-debug-symbols=none \
--without-version-pre \
--with-sysroot=$(STAGING_DIR) \
--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
endif
ifeq ($(BR2_CCACHE),y)
OPENJDK_CONF_OPTS += \
--enable-ccache \
--with-ccache-dir=$(BR2_CCACHE_DIR)
endif
# Autogen and configure are performed in a single step.
define OPENJDK_CONFIGURE_CMDS
chmod +x $(@D)/configure
cd $(@D); $(OPENJDK_CONF_ENV) ./configure autogen $(OPENJDK_CONF_OPTS)
endef
# Make -jn is unsupported. Instead, set the "--with-jobs=" configure option,
# and use $(MAKE1).
define OPENJDK_BUILD_CMDS
$(TARGET_MAKE_ENV) $(OPENJDK_CONF_ENV) $(MAKE1) -C $(@D) $(OPENJDK_MAKE_TARGET)
endef
# Calling make install always builds and installs the JDK instead of the JRE,
# which makes manual installation necessary.
define OPENJDK_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)$(OPENJDK_INSTALL_BASE)
cp -dpfr $(@D)/build/linux-*-release/images/$(OPENJDK_VARIANT)/* \
$(TARGET_DIR)$(OPENJDK_INSTALL_BASE)/
cd $(TARGET_DIR)/usr/bin && ln -snf ../..$(OPENJDK_INSTALL_BASE)/bin/* .
endef
define OPENJDK_INSTALL_STAGING_CMDS
mkdir -p $(STAGING_DIR)/usr/include/jvm
cp -dpfr $(@D)/build/linux-*-release/jdk/include/* \
$(STAGING_DIR)/usr/include/jvm
endef
# Demos and includes are not needed on the target
ifeq ($(BR2_PACKAGE_OPENJDK_FULL_JDK),y)
define OPENJDK_REMOVE_UNEEDED_JDK_DIRECTORIES
$(RM) -r $(TARGET_DIR)$(OPENJDK_INSTALL_BASE)/include/
$(RM) -r $(TARGET_DIR)$(OPENJDK_INSTALL_BASE)/demo/
endef
OPENJDK_TARGET_FINALIZE_HOOKS += OPENJDK_REMOVE_UNEEDED_JDK_DIRECTORIES
endif
$(eval $(generic-package))